Browse Source

Add telemetry to credits endpoint

Mauricio Araujo 2 năm trước cách đây
mục cha
commit
37b2f9e5ce
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  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)
 }