Просмотр исходного кода

Add telemetry to credits endpoint

Mauricio Araujo 2 лет назад
Родитель
Сommit
37b2f9e5ce
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      api/server/handlers/billing/credits.go

+ 10 - 0
api/server/handlers/billing/credits.go

@@ -35,6 +35,10 @@ func (c *GetCreditsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 
 	if !proj.GetFeatureFlag(models.MetronomeEnabled, c.Config().LaunchDarklyClient) {
 		c.WriteResult(w, r, "")
+
+		telemetry.WithAttributes(span,
+			telemetry.AttributeKV{Key: "metronome-enabled", Value: false},
+		)
 		return
 	}
 
@@ -45,5 +49,11 @@ func (c *GetCreditsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
+	telemetry.WithAttributes(span,
+		telemetry.AttributeKV{Key: "metronome-enabled", Value: true},
+		telemetry.AttributeKV{Key: "project-id", Value: proj.ID},
+		telemetry.AttributeKV{Key: "usage-id", Value: proj.UsageID},
+	)
+
 	c.WriteResult(w, r, credits)
 }