Skip to content

Commit

Permalink
Merge pull request #3184 from livepeer/ai-video-orch-version-prom-tags
Browse files Browse the repository at this point in the history
Add ochestrator_version tag to ai_request_latency_score and ai_request_errors metrics
  • Loading branch information
pwilczynskiclearcode authored Sep 26, 2024
2 parents d1b4dec + 277935b commit 7ae8e2c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -1815,9 +1815,13 @@ func (cen *censusMetricsCounter) recordAIRequestLatencyScore(Pipeline string, Mo
cen.lock.Lock()
defer cen.lock.Unlock()

if err := stats.RecordWithTags(cen.ctx,
[]tag.Mutator{tag.Insert(cen.kPipeline, Pipeline), tag.Insert(cen.kModelName, Model), tag.Insert(cen.kOrchestratorURI, orchInfo.GetTranscoder()), tag.Insert(cen.kOrchestratorAddress, common.BytesToAddress(orchInfo.GetAddress()).String())},
cen.mAIRequestLatencyScore.M(latencyScore)); err != nil {
tags := []tag.Mutator{tag.Insert(cen.kPipeline, Pipeline), tag.Insert(cen.kModelName, Model), tag.Insert(cen.kOrchestratorURI, orchInfo.GetTranscoder()), tag.Insert(cen.kOrchestratorAddress, common.BytesToAddress(orchInfo.GetAddress()).String())}
capabilities := orchInfo.GetCapabilities()
if capabilities != nil {
tags = append(tags, tag.Insert(cen.kOrchestratorVersion, orchInfo.GetCapabilities().GetVersion()))
}

if err := stats.RecordWithTags(cen.ctx, tags, cen.mAIRequestLatencyScore.M(latencyScore)); err != nil {
glog.Errorf("Error recording metrics err=%q", err)
}
}
Expand All @@ -1841,9 +1845,13 @@ func AIRequestError(code string, Pipeline string, Model string, orchInfo *lpnet.
orchAddr = common.BytesToAddress(addr).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.Insert(census.kOrchestratorURI, orchInfo.GetTranscoder()), tag.Insert(census.kOrchestratorAddress, orchAddr)},
census.mAIRequestError.M(1)); err != nil {
tags := []tag.Mutator{tag.Insert(census.kErrorCode, code), tag.Insert(census.kPipeline, Pipeline), tag.Insert(census.kModelName, Model), tag.Insert(census.kOrchestratorURI, orchInfo.GetTranscoder()), tag.Insert(census.kOrchestratorAddress, orchAddr)}
capabilities := orchInfo.GetCapabilities()
if capabilities != nil {
tags = append(tags, tag.Insert(census.kOrchestratorVersion, orchInfo.GetCapabilities().GetVersion()))
}

if err := stats.RecordWithTags(census.ctx, tags, census.mAIRequestError.M(1)); err != nil {
glog.Errorf("Error recording metrics err=%q", err)
}
}
Expand Down

0 comments on commit 7ae8e2c

Please sign in to comment.