Skip to content

Commit deaf3b0

Browse files
Copilotjerm-dro
andcommitted
Fix metric naming inconsistencies and typos
- Remove _total suffix from counter names (auto-added by Prometheus exporter) - Add metric.WithUnit("s") for histogram durations instead of _seconds suffix - Fix spelling: "exection" → "execution" in docs - Update middleware chain comment to include telemetry Co-authored-by: jerm-dro <10532181+jerm-dro@users.noreply.github.com>
1 parent c538252 commit deaf3b0

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

docs/operator/virtualmcpserver-observability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ the workflow name as an attribute.
3939

4040
## Distributed Tracing
4141

42-
The vMCP creates spans for each individual backend operation as well as workflow executions, enabling the attribution of workflow exection errors or latency to specific tool calls.
42+
The vMCP creates spans for each individual backend operation as well as workflow executions, enabling the attribution of workflow execution errors or latency to specific tool calls.
4343

4444

4545
## Configuration

pkg/vmcp/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (s *Server) Start(ctx context.Context) error {
385385
logger.Info("RFC 9728 OAuth discovery endpoints enabled at /.well-known/")
386386
}
387387

388-
// MCP endpoint - apply middleware chain: auth → discovery
388+
// MCP endpoint - apply middleware chain: auth → discovery → telemetry
389389
var mcpHandler http.Handler = streamableServer
390390

391391
if s.config.TelemetryProvider != nil {

pkg/vmcp/server/telemetry.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,21 @@ func monitorBackends(
3939
backendCount.Record(ctx, int64(len(backends)))
4040

4141
requestsTotal, err := meter.Int64Counter(
42-
"toolhive_vmcp_backend_requests_total",
43-
metric.WithDescription("Total number of requests per backend"),
44-
)
42+
"toolhive_vmcp_backend_requests",
43+
metric.WithDescription("Total number of requests per backend"))
4544
if err != nil {
4645
return nil, fmt.Errorf("failed to create requests total counter: %w", err)
4746
}
4847
errorsTotal, err := meter.Int64Counter(
49-
"toolhive_vmcp_backend_errors_total",
50-
metric.WithDescription("Total number of errors per backend"),
51-
)
48+
"toolhive_vmcp_backend_errors",
49+
metric.WithDescription("Total number of errors per backend"))
5250
if err != nil {
5351
return nil, fmt.Errorf("failed to create errors total counter: %w", err)
5452
}
5553
requestsDuration, err := meter.Float64Histogram(
5654
"toolhive_vmcp_backend_requests_duration",
5755
metric.WithDescription("Duration of requests in seconds per backend"),
56+
metric.WithUnit("s"),
5857
)
5958
if err != nil {
6059
return nil, fmt.Errorf("failed to create requests duration histogram: %w", err)
@@ -161,24 +160,25 @@ func monitorWorkflowExecutors(
161160
meter := meterProvider.Meter(instrumentationName)
162161

163162
executionsTotal, err := meter.Int64Counter(
164-
"toolhive_vmcp_workflow_executions_total",
163+
"toolhive_vmcp_workflow_executions",
165164
metric.WithDescription("Total number of workflow executions"),
166165
)
167166
if err != nil {
168167
return nil, fmt.Errorf("failed to create workflow executions counter: %w", err)
169168
}
170169

171170
errorsTotal, err := meter.Int64Counter(
172-
"toolhive_vmcp_workflow_errors_total",
171+
"toolhive_vmcp_workflow_errors",
173172
metric.WithDescription("Total number of workflow execution errors"),
174173
)
175174
if err != nil {
176175
return nil, fmt.Errorf("failed to create workflow errors counter: %w", err)
177176
}
178177

179178
executionDuration, err := meter.Float64Histogram(
180-
"toolhive_vmcp_workflow_duration_seconds",
179+
"toolhive_vmcp_workflow_duration",
181180
metric.WithDescription("Duration of workflow executions in seconds"),
181+
metric.WithUnit("s"),
182182
)
183183
if err != nil {
184184
return nil, fmt.Errorf("failed to create workflow duration histogram: %w", err)

0 commit comments

Comments
 (0)