observability

package
v5.43.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package observability holds the shared OpenTelemetry identifiers that every muster package emits under, so a single TracerProvider / MeterProvider scope joins spans, metrics, and logs across the codebase. The constants are intentionally a leaf package with no internal/* dependencies, so any internal/<svc> package can import them without violating the service-locator pattern.

Index

Constants

View Source
const AttrDownstreamToolName = "muster.downstream.tool.name"

AttrDownstreamToolName is the attribute key for the aggregator-exposed name of the tool a call was dispatched to (x_<server>_<tool> or the family name), the same value as the tool label of muster.downstream_tool_calls. It sits on muster's own server and internal spans, where mcp.tool.name keeps naming the tool the client invoked (call_tool for meta-tool sessions).

View Source
const AttrGenAIToolName = "gen_ai.tool.name"

AttrGenAIToolName is the OpenTelemetry GenAI semantic-convention key for the tool an MCP operation relates to. It is set on the client span to the backend, carrying the backend-native tool name sent on the wire.

View Source
const AttrMCPServerName = "mcpserver.name"

AttrMCPServerName is the attribute key for the MCPServer a tool call was dispatched to. The same key labels the muster.downstream_tool_calls metric (exported as mcpserver_name) and the reconciler's muster_mcpserver_state metrics, so traces and metrics join on one value.

View Source
const AttrToolName = "mcp.tool.name"

AttrToolName is the OpenTelemetry attribute key carrying the MCP tool name dispatched in a request. Shared across every emitter that records tool identity so Grafana joins traces, logs, and metrics on a single key.

View Source
const TracerName = "github.com/giantswarm/muster"

TracerName is the OpenTelemetry instrumentation scope used for every span muster emits — server-side mcp-go spans, the outbound mcp-go client spans on the muster → backend leg, and per-step workflow spans. Span role is encoded in SpanKind (Server / Client / Internal) and span name (mcp.<method>, tool.<name>, workflow.step), so a single scope keeps dashboard filtering readable without a per-package suffix.

Used identically as the OTel meter scope and as the logger scope (see pkg/logging); all join on the same identifier so spans, metrics and logs correlate in Tempo, Mimir and Loki.

The name is an identifier dashboards filter on (the otel_scope_name label), not an import path: it stays at the un-suffixed repository path although the module is github.com/giantswarm/muster/v5, so no filter breaks.

Variables

This section is empty.

Functions

func AnnotateDownstreamCall added in v5.30.0

func AnnotateDownstreamCall(ctx context.Context, serverName, exposedTool, backendTool string) context.Context

AnnotateDownstreamCall labels the current span and, when it differs, the request span with the MCPServer and the exposed tool name of a dispatch, and returns ctx carrying the DownstreamCall for the client span.

func ContextWithDownstreamCall added in v5.30.0

func ContextWithDownstreamCall(ctx context.Context, call DownstreamCall) context.Context

ContextWithDownstreamCall returns ctx carrying call, for the client tracer to attribute the spans it opens toward the backend.

func ContextWithRequestSpan added in v5.30.0

func ContextWithRequestSpan(ctx context.Context, span trace.Span) context.Context

ContextWithRequestSpan returns ctx remembering span as the span of the inbound MCP request, so code below the tool-handler span can still attribute the request span.

func SecondsHistogramBoundaries

func SecondsHistogramBoundaries() []float64

SecondsHistogramBoundaries returns the bucket boundaries applied to every histogram instrument with unit "s".

func SecondsHistogramView

func SecondsHistogramView() sdkmetric.View

SecondsHistogramView returns the sdkmetric.View that applies SecondsHistogramBoundaries to every histogram instrument with unit "s". Matching on unit rather than instrument name covers any seconds-unit histogram without enumerating them.

func WithoutRequestSpan added in v5.30.0

func WithoutRequestSpan(ctx context.Context) context.Context

WithoutRequestSpan returns ctx with no request span. A caller that makes several dispatches under one request (a workflow's steps) uses it so no single dispatch labels the whole request.

Types

type DispatchRecord added in v5.36.0

type DispatchRecord struct {
	// contains filtered or unexported fields
}

DispatchRecord learns where one exposed tool's call was dispatched: the MCPServer and the backend-native tool name the aggregator resolved it to.

func ContextWithDispatchRecord added in v5.36.0

func ContextWithDispatchRecord(ctx context.Context, exposedTool string) (context.Context, *DispatchRecord)

ContextWithDispatchRecord returns ctx carrying a DispatchRecord that the dispatch of exposedTool under ctx fills in. Only that tool's first dispatch is recorded: the dispatches a workflow's steps make under the same context are for other tools and leave it alone.

func (*DispatchRecord) Dispatched added in v5.36.0

func (r *DispatchRecord) Dispatched() (DownstreamCall, bool)

Dispatched returns the backend leg the tool was dispatched to, and false when it was not dispatched to a backend (a core or workflow tool, or a call that failed before resolution).

type DownstreamCall added in v5.30.0

type DownstreamCall struct {
	// Server is the MCPServer name.
	Server string
	// Tool is the backend-native tool name.
	Tool string
}

DownstreamCall identifies the backend leg of a tool call.

func DownstreamCallFromContext added in v5.30.0

func DownstreamCallFromContext(ctx context.Context) (DownstreamCall, bool)

DownstreamCallFromContext returns the DownstreamCall ctx carries, if any.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL