Skip to content

Commit

Permalink
feat(ai): unify AI remote worker pipeline tag
Browse files Browse the repository at this point in the history
This commit ensures that the new metrics functions also use the
`normalizePipelineTag` method to ensure consistent pipeline naming in
the metrics.
  • Loading branch information
rickstaa committed Oct 22, 2024
1 parent e94b188 commit 16de762
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -1947,27 +1947,27 @@ func AIProcessingError(code string, Pipeline string, Model string, sender string

func AIResultUploaded(ctx context.Context, uploadDur time.Duration, pipeline, model, uri string) {
if err := stats.RecordWithTags(ctx,
[]tag.Mutator{tag.Insert(census.kPipeline, pipeline), tag.Insert(census.kModelName, model)}, census.mAIResultUploaded.M(1)); err != nil {
[]tag.Mutator{tag.Insert(census.kPipeline, normalizePipelineTag(pipeline)), tag.Insert(census.kModelName, model)}, census.mAIResultUploaded.M(1)); err != nil {
glog.Errorf("Failed to record metrics with tags: %v", err)
}
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kPipeline, pipeline), tag.Insert(census.kModelName, model), tag.Insert(census.kOrchestratorURI, uri)},
[]tag.Mutator{tag.Insert(census.kPipeline, normalizePipelineTag(pipeline)), tag.Insert(census.kModelName, model), tag.Insert(census.kOrchestratorURI, uri)},
census.mAIResultUploadTime.M(uploadDur.Seconds())); err != nil {
clog.Errorf(ctx, "Error recording metrics err=%q", err)
}
}

func AIResultSaveError(ctx context.Context, pipeline, model, code string) {
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kErrorCode, code), tag.Insert(census.kPipeline, pipeline), tag.Insert(census.kModelName, model)},
[]tag.Mutator{tag.Insert(census.kErrorCode, code), tag.Insert(census.kPipeline, normalizePipelineTag(pipeline)), tag.Insert(census.kModelName, model)},
census.mAIResultSaveFailed.M(1)); err != nil {
glog.Errorf("Error recording metrics err=%q", err)
}
}

func AIResultDownloaded(ctx context.Context, pipeline string, model string, downloadDur time.Duration) {
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kPipeline, pipeline), tag.Insert(census.kModelName, model)},
[]tag.Mutator{tag.Insert(census.kPipeline, normalizePipelineTag(pipeline)), tag.Insert(census.kModelName, model)},
census.mAIResultDownloaded.M(1),
census.mAIResultDownloadTime.M(downloadDur.Seconds())); err != nil {
clog.Errorf(ctx, "Error recording metrics err=%q", err)
Expand Down

0 comments on commit 16de762

Please sign in to comment.