Skip to content

Commit 3a890d8

Browse files
committed
Revert attributes
1 parent 2319697 commit 3a890d8

File tree

1 file changed

+8
-2
lines changed
  • packages/api/internal/metrics

1 file changed

+8
-2
lines changed

packages/api/internal/metrics/team.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
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

107108
func (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

111117
func (so *TeamObserver) Close(ctx context.Context) error {

0 commit comments

Comments
 (0)