Documentation
¶
Overview ¶
Copyright 2021 The Fission 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.
Index ¶
- Constants
- func GetAttributesForDeployment(deployment *appsv1.Deployment) []attribute.KeyValue
- func GetAttributesForEnv(env *fv1.Environment) []attribute.KeyValue
- func GetAttributesForFunction(fn *fv1.Function) []attribute.KeyValue
- func GetAttributesForHPA(hpa *asv1.HorizontalPodAutoscaler) []attribute.KeyValue
- func GetAttributesForPackage(pkg *fv1.Package) []attribute.KeyValue
- func GetAttributesForPod(pod *apiv1.Pod) []attribute.KeyValue
- func GetAttributesForSvc(svc *apiv1.Service) []attribute.KeyValue
- func GetHandlerWithOTEL(h http.Handler, name string, filter ...otelhttp.Filter) http.Handler
- func GetPropogater(logger *zap.Logger) []propagation.TextMapPropagator
- func GetSampler() (sdktrace.Sampler, error)
- func InitProvider(ctx context.Context, logger *zap.Logger, serviceName string) (func(context.Context), error)
- func LoggerWithTraceID(context context.Context, logger *zap.Logger) *zap.Logger
- func MapToAttributes(m map[string]string) []attribute.KeyValue
- func OtelEnvForContainer() []apiv1.EnvVar
- func SpanTrackEvent(ctx context.Context, event string, attributes ...attribute.KeyValue)
- func UrlsToIgnore(ignoreEndpoints ...string) func(r *http.Request) bool
- type OtelConfig
Constants ¶
const ( OtelEnvPrefix = "OTEL_" OtelEndpointEnvVar = "OTEL_EXPORTER_OTLP_ENDPOINT" OtelInsecureEnvVar = "OTEL_EXPORTER_OTLP_INSECURE" OtelTracesSampler = "OTEL_TRACES_SAMPLER" OtelTracesSamplerArg = "OTEL_TRACES_SAMPLER_ARG" OtelPropogaters = "OTEL_PROPOGATORS" )
Variables ¶
This section is empty.
Functions ¶
func GetAttributesForDeployment ¶
func GetAttributesForDeployment(deployment *appsv1.Deployment) []attribute.KeyValue
func GetAttributesForEnv ¶
func GetAttributesForEnv(env *fv1.Environment) []attribute.KeyValue
func GetAttributesForFunction ¶
GetAttributesForFunction returns a set of attributes for a function. Attributes returned: function-name function-namespace environment-name environment-namespace
These attributes are tags that can be used to filter traces.
func GetAttributesForHPA ¶
func GetAttributesForHPA(hpa *asv1.HorizontalPodAutoscaler) []attribute.KeyValue
func GetHandlerWithOTEL ¶
func GetPropogater ¶
func GetPropogater(logger *zap.Logger) []propagation.TextMapPropagator
GetPropogater returns a slice of propagators to be used by the OpenTelemetry
provider.
Supported providers: tracecontext - W3C Trace Context baggage - W3C Baggage b3 - B3 Single b3multi - B3 Multi jaeger - Jaeger uber-trace-id header xray - AWS X-Ray (third party) ottrace - OpenTracing Trace (third party)
func GetSampler ¶
GetSampler returns a sampler that can be used to sample traces. This is based on https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#general-sdk-configuration We have to implement as open-telemetry Go sdk doesn't support configuration of different samplers. Once its added we may remove this code.
Supported samplers: always_on - Sampler that always samples spans, regardless of the parent span's sampling decision. always_off - Sampler that never samples spans, regardless of the parent span's sampling decision. traceidratio - Sampler that samples probabalistically based on rate. parentbased_always_on - (default) Sampler that respects its parent span's sampling decision, but otherwise always samples. parentbased_always_off - Sampler that respects its parent span's sampling decision, but otherwise never samples. parentbased_traceidratio - Sampler that respects its parent span's sampling decision, but otherwise samples probabalistically based on rate.
Environment variables: OTEL_TRACES_SAMPLER - Sampler to use(one of the above samplers) OTEL_TRACES_SAMPLER_ARG - Argument to pass to the sampler(float value)
func InitProvider ¶
func InitProvider(ctx context.Context, logger *zap.Logger, serviceName string) (func(context.Context), error)
Initializes an OTLP exporter, and configures the corresponding trace and metric providers.
func LoggerWithTraceID ¶
func OtelEnvForContainer ¶
OtelEnvForContainer returns a list of environment variables for the container, which start with prefix OTEL_
func SpanTrackEvent ¶
Types ¶
type OtelConfig ¶
type OtelConfig struct {
// contains filtered or unexported fields
}