Skip to content

Commit

Permalink
[ENG-2343] Stream attempts metric
Browse files Browse the repository at this point in the history
  • Loading branch information
pwilczynskiclearcode committed Jan 10, 2025
1 parent b026313 commit 35fab19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,13 @@ func InitCensus(nodeType NodeType, version string) {
TagKeys: baseTagsWithOrchInfo,
Aggregation: view.Distribution(0, .10, .20, .50, .100, .150, .200, .500, .1000, .5000, 10.000),
},
{
Name: "ai_live_attempt",
Measure: census.mAILiveAttempt,

Check failure on line 996 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

census.mAILiveAttempt undefined (type censusMetricsCounter has no field or method mAILiveAttempt)

Check failure on line 996 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

census.mAILiveAttempt undefined (type censusMetricsCounter has no field or method mAILiveAttempt)

Check failure on line 996 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-amd64

census.mAILiveAttempt undefined (type censusMetricsCounter has no field or method mAILiveAttempt)

Check failure on line 996 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-arm64

census.mAILiveAttempt undefined (type censusMetricsCounter has no field or method mAILiveAttempt)
Description: "AI Live start attempted",
TagKeys: baseTags,
Aggregation: view.Count(),
},
}

// Register the views
Expand Down Expand Up @@ -1991,6 +1998,9 @@ func AIFirstSegmentDelay(delayMs int64, orchInfo *lpnet.OrchestratorInfo) {
glog.Errorf("Error recording metrics err=%q", err)
}
}
func AILiveVideoAttempt() {
stats.Record(census.ctx, census.mAILiveAttempts.M())

Check failure on line 2002 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

census.mAILiveAttempts undefined (type censusMetricsCounter has no field or method mAILiveAttempts)) (typecheck)

Check failure on line 2002 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

census.mAILiveAttempts undefined (type censusMetricsCounter has no field or method mAILiveAttempts)) (typecheck)

Check failure on line 2002 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-amd64

census.mAILiveAttempts undefined (type censusMetricsCounter has no field or method mAILiveAttempts)

Check failure on line 2002 in monitor/census.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-arm64

census.mAILiveAttempts undefined (type censusMetricsCounter has no field or method mAILiveAttempts)
}

// Convert wei to gwei
func wei2gwei(wei *big.Int) float64 {
Expand Down
3 changes: 3 additions & 0 deletions server/ai_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,9 @@ const initPixelsToPay = 30 * 30 * 3200 * 1800 // 30 seconds, 30fps, 1800p

func submitLiveVideoToVideo(ctx context.Context, params aiRequestParams, sess *AISession, req worker.GenLiveVideoToVideoJSONRequestBody) (any, error) {
startTime := time.Now()
if monitor.Enabled {
monitor.AILiveVideoAttempt()
}
// Live Video should not reuse the existing session balance, because it could lead to not sending the init
// payment, which in turns may cause "Insufficient Balance" on the Orchestrator's side.
// It works differently than other AI Jobs, because Live Video is accounted by mid on the Orchestrator's side.
Expand Down

0 comments on commit 35fab19

Please sign in to comment.