Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 588ded3

Browse files
add HealthEndpoints map as public
add public HealthEndpoints for set custom Health urls
1 parent 71e2e3e commit 588ded3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

plugin/ochttp/trace.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ import (
2828

2929
var defaultFormat propagation.HTTPFormat = &b3.HTTPFormat{}
3030

31+
32+
// Health checking is pretty frequent and
33+
// traces collected for health endpoints
34+
// can be extremely noisy and expensive.
35+
// Disable canonical health checking endpoints
36+
// like /healthz and /_ah/health for now.
37+
var HealthEndpoints = map[string]bool{
38+
"/healthz": true,
39+
"/_ah/health": true,
40+
}
3141
// Attributes recorded on the span for the requests.
3242
// Only trace exporters will need them.
3343
const (
@@ -206,12 +216,7 @@ var codeToStr = map[int32]string{
206216
}
207217

208218
func isHealthEndpoint(path string) bool {
209-
// Health checking is pretty frequent and
210-
// traces collected for health endpoints
211-
// can be extremely noisy and expensive.
212-
// Disable canonical health checking endpoints
213-
// like /healthz and /_ah/health for now.
214-
if path == "/healthz" || path == "/_ah/health" {
219+
if _, exist := HealthEndpoints[path]; exist {
215220
return true
216221
}
217222
return false

0 commit comments

Comments
 (0)