ObservabilityInstance returned by instrumentServer.
Setup once, reuse everywhere
Create your instruments once at module scope so you’re not reallocating histograms or counters on the hot path.instruments.ts
Pattern: time + count an operation
tools/call <toolName>
span if you call this from inside a tool handler.
Pattern: record a histogram with tags
Pattern: business outcomes
Counters are great for outcome tracking even when nothing is timed:Pattern: distributed trace context
If a tool calls an upstream HTTP service, propagate the active context so the upstream’s spans hang under your trace:Pattern: feature-flag the SDK
If you want to gate instrumentation:Pattern: async iterators
If your tool streams events, record one span per batch + a counter per event:Pattern: shut down on signal
See also
Automatic metrics
What the package records without any code.
Data processors
Mutate every attribute set in one place.