77 "time"
88
99 "github.com/google/uuid"
10+ "go.opentelemetry.io/otel/attribute"
1011 "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
1112 "go.opentelemetry.io/otel/metric"
1213 sdkmetric "go.opentelemetry.io/otel/sdk/metric"
@@ -90,7 +91,7 @@ func (so *TeamObserver) Start(store *sandbox.Store) (err error) {
9091 // Reset the max for the new interval to the current counts
9192 // Observe the max concurrent sandbox counts for each team
9293 for teamID , count := range sbxsPerTeam {
93- obs .ObserveInt64 (so .teamSandboxRunning , count , metric .WithAttributes (telemetry . WithTeamID ( teamID )))
94+ obs .ObserveInt64 (so .teamSandboxRunning , count , metric .WithAttributes (attribute . String ( "team_id" , teamID )))
9495 }
9596
9697 return nil
@@ -105,7 +106,12 @@ func (so *TeamObserver) Start(store *sandbox.Store) (err error) {
105106}
106107
107108func (so * TeamObserver ) Add (ctx context.Context , teamID uuid.UUID ) {
108- so .teamSandboxesCreated .Add (ctx , 1 , metric .WithAttributes (telemetry .WithTeamID (teamID .String ())))
109+ // Count started only if the sandbox was created
110+ attributes := []attribute.KeyValue {
111+ attribute .String ("team_id" , teamID .String ()),
112+ }
113+
114+ so .teamSandboxesCreated .Add (ctx , 1 , metric .WithAttributes (attributes ... ))
109115}
110116
111117func (so * TeamObserver ) Close (ctx context.Context ) error {
0 commit comments