Copyright 2018, OpenCensus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package ochttp
import (
)
Handler is an http.Handler wrapper to instrument your HTTP server with OpenCensus. It supports both stats and tracing. Tracing This handler is aware of the incoming request's span, reading it from request headers as configured using the Propagation field. The extracted span can be accessed from the incoming request's context. span := trace.FromContext(r.Context()) The server span will be automatically ended at the end of ServeHTTP.
Propagation defines how traces are propagated. If unspecified, B3 propagation will be used.
StartOptions are applied to the span started by this Handler around each request. StartOptions.SpanKind will always be set to trace.SpanKindServer for spans started by this transport.
IsPublicEndpoint should be set to true for publicly accessible HTTP(S) servers. If true, any trace metadata set on the incoming request will be added as a linked trace instead of being added as a parent of the current trace.
FormatSpanName holds the function to use for generating the span name from the information found in the incoming HTTP Request. By default the name equals the URL Path.
IsHealthEndpoint holds the function to use for determining if the incoming HTTP request should be considered a health check. This is in addition to the private isHealthEndpoint func which may also indicate tracing should be skipped.
wrappedResponseWriter returns a wrapped version of the original ResponseWriter and only implements the same combination of additional interfaces as the original. This implementation is based on https://github.com/felixge/httpsnoop.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.