@@ -208,6 +208,7 @@ type (
208208 mAIResultSaveFailed * stats.Int64Measure
209209 mAIContainersInUse * stats.Int64Measure
210210 mAIContainersIdle * stats.Int64Measure
211+ mLiveAIPricePerPixel * stats.Float64Measure
211212 aiContainersIdleByPipelineByOrchestrator map [string ]map [string ]int
212213 mAIGPUsIdle * stats.Int64Measure
213214 mAICurrentLivePipelines * stats.Int64Measure
@@ -391,6 +392,7 @@ func InitCensus(nodeType NodeType, version string) {
391392 census .mAIResultSaveFailed = stats .Int64 ("ai_result_upload_failed_total" , "AIResultUploadFailed" , "tot" )
392393 census .mAIContainersInUse = stats .Int64 ("ai_container_in_use" , "Number of containers currently used for AI processing" , "tot" )
393394 census .mAIContainersIdle = stats .Int64 ("ai_container_idle" , "Number of containers currently available for AI processing" , "tot" )
395+ census .mLiveAIPricePerPixel = stats .Float64 ("live_ai_price_per_pixel" , "Live AI price per pixel" , "wei/pixel" )
394396 census .aiContainersIdleByPipelineByOrchestrator = make (map [string ]map [string ]int )
395397 census .mAIGPUsIdle = stats .Int64 ("ai_gpus_idle" , "Number of idle GPUs (with no configured container)" , "tot" )
396398 census .mAICurrentLivePipelines = stats .Int64 ("ai_current_live_pipelines" , "Number of live AI pipelines currently running" , "tot" )
@@ -1029,6 +1031,13 @@ func InitCensus(nodeType NodeType, version string) {
10291031 TagKeys : append ([]tag.Key {census .kPipeline , census .kModelName , census .kOrchestratorURI }, baseTags ... ),
10301032 Aggregation : view .LastValue (),
10311033 },
1034+ {
1035+ Name : "live_ai_price_per_pixel" ,
1036+ Measure : census .mLiveAIPricePerPixel ,
1037+ Description : "Live AI price per pixel" ,
1038+ TagKeys : append ([]tag.Key {census .kOrchestratorURI }, baseTags ... ),
1039+ Aggregation : view .LastValue (),
1040+ },
10321041 {
10331042 Name : "ai_gpus_idle" ,
10341043 Measure : census .mAIGPUsIdle ,
@@ -2067,6 +2076,15 @@ func AIContainersIdle(currentContainersIdle int, pipeline, modelID, uri string)
20672076 }
20682077}
20692078
2079+ func LiveAIPricePerPixel (orchestratorURI string , pricePerPixel * big.Rat ) {
2080+ floatPrice , _ := pricePerPixel .Float64 ()
2081+ if err := stats .RecordWithTags (census .ctx ,
2082+ []tag.Mutator {tag .Insert (census .kOrchestratorURI , orchestratorURI )},
2083+ census .mLiveAIPricePerPixel .M (floatPrice )); err != nil {
2084+ glog .Errorf ("Error recording metrics err=%q" , err )
2085+ }
2086+ }
2087+
20702088func AIGPUsIdle (currentGPUsIdle int , pipeline , modelID string ) {
20712089 if err := stats .RecordWithTags (census .ctx ,
20722090 []tag.Mutator {tag .Insert (census .kPipeline , pipeline ), tag .Insert (census .kModelName , modelID )},
0 commit comments