forked from openzipkin/zipkin-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds convenience functions Sample() and Discard() for request sampler…
… decisions
- Loading branch information
1 parent
0ef9e89
commit 8774349
Showing
5 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package http | ||
|
||
import "net/http" | ||
|
||
// RequestSamplerFunc can be implemented for client and/or server side sampling decisions that can override the existing | ||
// upstream sampling decision. If the implementation returns nil, the existing sampling decision stays as is. | ||
type RequestSamplerFunc func(r *http.Request) *bool | ||
|
||
// Sample is a convenience function that returns a pointer to a boolean true. Use this for RequestSamplerFuncs when | ||
// wanting the RequestSampler to override the sampling decision to yes. | ||
func Sample() *bool { | ||
sample := true | ||
return &sample | ||
} | ||
|
||
// Discard is a convenience function that returns a pointer to a boolean false. Use this for RequestSamplerFuncs when | ||
// wanting the RequestSampler to override the sampling decision to no. | ||
func Discard() *bool { | ||
sample := false | ||
return &sample | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters