Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MiddlewareBuilder ¶
type MiddlewareBuilder struct {
Tracer trace.Tracer // Tracer is an interface that abstracts the tracing functionality.
}
MiddlewareBuilder is a struct that aids in constructing middleware with tracing capabilities. It holds a reference to a Tracer instance which will be used to trace the flow of HTTP requests.
func InitMiddlewareBuilder ¶ added in v0.0.23
func InitMiddlewareBuilder() *MiddlewareBuilder
InitMiddlewareBuilder initializes and returns a new instance of MiddlewareBuilder. It sets the Tracer field to the global tracer provided by OpenTelemetry with the specified instrumentation name. The instrumentationName must be defined elsewhere in the code. Returns: - a pointer to the newly created MiddlewareBuilder instance.
func (*MiddlewareBuilder) Build ¶
func (m *MiddlewareBuilder) Build() mist.Middleware
Build is a method attached to the MiddlewareBuilder struct. This method initializes and returns a Tracing middleware that can be used in the mist HTTP framework. This middleware is responsible for starting a new span for each incoming HTTP request, sets various attributes related to the request and ensures that the span is ended properly after the request is handled.
func (*MiddlewareBuilder) SetTracer ¶ added in v0.0.24
func (m *MiddlewareBuilder) SetTracer(tracer trace.Tracer) *MiddlewareBuilder
SetTracer updates the Tracer field of the MiddlewareBuilder with the provided tracer. This allows for setting a specific tracer for telemetry data, which could be part of distributed tracing. Parameters: - tracer: the trace.Tracer instance to set as the MiddlewareBuilder's Tracer. Returns: - the pointer to the MiddlewareBuilder instance to allow method chaining.