Documentation ¶
Overview ¶
Copyright 2023 The Radius 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.
Copyright 2023 The Radius 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 ExtractTraceparent(ctx context.Context) string
- func InitTracer(opts Options) (func(context.Context) error, error)
- func SetAsyncResultStatus(result ctrl.Result, span trace.Span)
- func StartConsumerSpan(ctx context.Context, spanName string, tracerName string) (context.Context, trace.Span)
- func StartCustomSpan(ctx context.Context, spanName string, tracerName string, ...) (context.Context, trace.Span)
- func StartProducerSpan(ctx context.Context, spanName string, tracerName string) (context.Context, trace.Span)
- func WithTraceparent(ctx context.Context, traceparent string) context.Context
- type Options
- type Service
- type ZipkinOptions
Constants ¶
const ( // FrontendTracerName represents the name of frontend tracer name. FrontendTracerName string = "radius-frontend-tracer" // BackendTracerName represents the name of backend tracer name. BackendTracerName string = "radius-backend-tracer" )
Variables ¶
This section is empty.
Functions ¶
func ExtractTraceparent ¶
ExtractTraceparent extracts the traceparent header from the context. Retrieve the current span context from context and serialize it to its w3c string representation using propagator. ref: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md
func InitTracer ¶
InitTracer sets up a tracer provider with a sampler and resource attributes, and optionally registers a Zipkin exporter and batcher. It returns a shutdown function and an error if one occurs.
func SetAsyncResultStatus ¶
SetAsyncResultStatus sets the status of the span based on the result and adds an exception event if the result contains an error.
func StartConsumerSpan ¶
func StartConsumerSpan(ctx context.Context, spanName string, tracerName string) (context.Context, trace.Span)
StartConsumerSpan creates a new span with SpanKindConsumer for dequeing async operations. It creates the span with the given spanName and tracerName, and adds the given attributes.
func StartCustomSpan ¶
func StartCustomSpan(ctx context.Context, spanName string, tracerName string, attrs []attribute.KeyValue, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartCustomSpan creates a new span with the given name, tracer name and attributes and returns a context and the span.
func StartProducerSpan ¶
func StartProducerSpan(ctx context.Context, spanName string, tracerName string) (context.Context, trace.Span)
StartProducerSpan creates a new span with SpanKindProducer for enqueuing async operations. It creates the span with the given spanName and tracerName, and adds the given attributes.
Types ¶
type Options ¶
type Options struct { // ServiceName represents the name of service. ServiceName string `yaml:"serviceName,omitempty"` // Zipkin represents zipkin options. Zipkin *ZipkinOptions `yaml:"zipkin,omitempty"` }
Options represents the trace options.
type Service ¶ added in v0.26.0
type Service struct {
Options Options
}
Service implements the hosting.Service interface for the tracer.
type ZipkinOptions ¶
type ZipkinOptions struct { // URL represents the url of zipkin endpoint. URL string `yaml:"url"` }
ZipkinOptions represents zipkin trace provider options.