Skip to content

Commit 82ac3b1

Browse files
DavidS-ovmactions-user
authored andcommitted
Ensure that source's healthchecks telemetry are sampled (#2213)
This will save about 4.5M events per month. GitOrigin-RevId: f791f98bbba9ccc3064ec9084e5823f97c74137e
1 parent 35db09a commit 82ac3b1

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

aws-source/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var rootCmd = &cobra.Command{
9292
healthCheckPath := "/healthz"
9393

9494
http.HandleFunc(healthCheckPath, func(rw http.ResponseWriter, r *http.Request) {
95-
ctx, span := tracing.Tracer().Start(r.Context(), "healthcheck")
95+
ctx, span := tracing.HealthCheckTracer().Start(r.Context(), "healthcheck")
9696
defer span.End()
9797

9898
err := e.HealthCheck(ctx)

k8s-source/cmd/root.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@ func run(_ *cobra.Command, _ []string) int {
171171
healthCheckPath := "/healthz"
172172

173173
http.HandleFunc(healthCheckPath, func(rw http.ResponseWriter, r *http.Request) {
174+
ctx, span := tracing.HealthCheckTracer().Start(r.Context(), "healthcheck")
175+
defer span.End()
176+
177+
err := e.HealthCheck(ctx)
178+
if err != nil {
179+
http.Error(rw, err.Error(), http.StatusInternalServerError)
180+
return
181+
}
182+
174183
if e.IsNATSConnected() {
175184
fmt.Fprint(rw, "ok")
176185
} else {

sources/gcp/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var rootCmd = &cobra.Command{
5656
healthCheckPath := "/healthz"
5757

5858
http.HandleFunc(healthCheckPath, func(rw http.ResponseWriter, r *http.Request) {
59-
ctx, span := tracing.Tracer().Start(r.Context(), "healthcheck")
59+
ctx, span := tracing.HealthCheckTracer().Start(r.Context(), "healthcheck")
6060
defer span.End()
6161

6262
err := e.HealthCheck(ctx)

stdlib-source/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ var rootCmd = &cobra.Command{
9393
e.EngineConfig.HeartbeatOptions.HealthCheck = healthCheck
9494
}
9595
http.HandleFunc(healthCheckPath, func(rw http.ResponseWriter, r *http.Request) {
96-
ctx, span := tracing.Tracer().Start(r.Context(), "healthcheck")
96+
ctx, span := tracing.HealthCheckTracer().Start(r.Context(), "healthcheck")
9797
defer span.End()
9898

9999
err := healthCheck(ctx)

0 commit comments

Comments
 (0)