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

Commit

Permalink
add HealthEndpoints map as public
Browse files Browse the repository at this point in the history
add public HealthEndpoints for set custom Health urls
  • Loading branch information
sergeylanzman committed Aug 24, 2018
1 parent 71e2e3e commit 588ded3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions plugin/ochttp/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ import (

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


// Health checking is pretty frequent and
// traces collected for health endpoints
// can be extremely noisy and expensive.
// Disable canonical health checking endpoints
// like /healthz and /_ah/health for now.
var HealthEndpoints = map[string]bool{
"/healthz": true,
"/_ah/health": true,
}
// Attributes recorded on the span for the requests.
// Only trace exporters will need them.
const (
Expand Down Expand Up @@ -206,12 +216,7 @@ var codeToStr = map[int32]string{
}

func isHealthEndpoint(path string) bool {
// Health checking is pretty frequent and
// traces collected for health endpoints
// can be extremely noisy and expensive.
// Disable canonical health checking endpoints
// like /healthz and /_ah/health for now.
if path == "/healthz" || path == "/_ah/health" {
if _, exist := HealthEndpoints[path]; exist {
return true
}
return false
Expand Down

0 comments on commit 588ded3

Please sign in to comment.