Skip to content

Commit

Permalink
feat(graphdb): register retry metric counter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenithar committed Nov 28, 2024
1 parent 3cfe99b commit 1240ff0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kubehound/storage/graphdb/janusgraph_edge_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func (jgv *JanusGraphEdgeWriter) startBackgroundWriter(ctx context.Context) {
if errors.As(err, &e) && e.retryable {
// If the error is retryable, retry the write operation with a smaller batch.
if batch.retryCount < jgv.maxRetry {
_ = statsd.Count(ctx, metric.RetryWriterCall, 1, jgv.tags, 1)

// Compute the new batch size.
newBatchSize := len(batch.data) / 2
batch.retryCount++
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubehound/storage/graphdb/janusgraph_vertex_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func (jgv *JanusGraphVertexWriter) startBackgroundWriter(ctx context.Context) {
if errors.As(err, &e) && e.retryable {
// If the error is retryable, retry the write operation with a smaller batch.
if batch.retryCount < jgv.maxRetry {
_ = statsd.Count(ctx, metric.RetryWriterCall, 1, jgv.tags, 1)

// Compute the new batch size.
newBatchSize := len(batch.data) / 2
batch.retryCount++
Expand Down

0 comments on commit 1240ff0

Please sign in to comment.