Skip to content

Commit f57ee1f

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 db2450f commit f57ee1f

3 files changed

Lines changed: 13 additions & 8 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
@@ -375,7 +375,7 @@ func (s *Server) Start(ctx context.Context) error {
375375
logger.Info("RFC 9728 OAuth discovery endpoints enabled at /.well-known/")
376376
}
377377

378-
// MCP endpoint - apply middleware chain: auth → discovery
378+
// MCP endpoint - apply middleware chain: auth → discovery → telemetry
379379
var mcpHandler http.Handler = streamableServer
380380

381381
if s.config.TelemetryProvider != nil {

pkg/vmcp/server/telemetry.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,19 @@ func monitorBackends(
3838
}
3939
backendCount.Record(ctx, int64(len(backends)))
4040

41-
requestsTotal, err := meter.Int64Counter("toolhive_vmcp_backend_requests_total", metric.WithDescription("Total number of requests per backend"))
41+
requestsTotal, err := meter.Int64Counter("toolhive_vmcp_backend_requests", metric.WithDescription("Total number of requests per backend"))
4242
if err != nil {
4343
return nil, fmt.Errorf("failed to create requests total counter: %w", err)
4444
}
45-
errorsTotal, err := meter.Int64Counter("toolhive_vmcp_backend_errors_total", metric.WithDescription("Total number of errors per backend"))
45+
errorsTotal, err := meter.Int64Counter("toolhive_vmcp_backend_errors", metric.WithDescription("Total number of errors per backend"))
4646
if err != nil {
4747
return nil, fmt.Errorf("failed to create errors total counter: %w", err)
4848
}
49-
requestsDuration, err := meter.Float64Histogram("toolhive_vmcp_backend_requests_duration", metric.WithDescription("Duration of requests in seconds per backend"))
49+
requestsDuration, err := meter.Float64Histogram(
50+
"toolhive_vmcp_backend_requests_duration",
51+
metric.WithDescription("Duration of requests in seconds per backend"),
52+
metric.WithUnit("s"),
53+
)
5054
if err != nil {
5155
return nil, fmt.Errorf("failed to create requests duration histogram: %w", err)
5256
}
@@ -142,24 +146,25 @@ func monitorWorkflowExecutors(
142146
meter := meterProvider.Meter(instrumentationName)
143147

144148
executionsTotal, err := meter.Int64Counter(
145-
"toolhive_vmcp_workflow_executions_total",
149+
"toolhive_vmcp_workflow_executions",
146150
metric.WithDescription("Total number of workflow executions"),
147151
)
148152
if err != nil {
149153
return nil, fmt.Errorf("failed to create workflow executions counter: %w", err)
150154
}
151155

152156
errorsTotal, err := meter.Int64Counter(
153-
"toolhive_vmcp_workflow_errors_total",
157+
"toolhive_vmcp_workflow_errors",
154158
metric.WithDescription("Total number of workflow execution errors"),
155159
)
156160
if err != nil {
157161
return nil, fmt.Errorf("failed to create workflow errors counter: %w", err)
158162
}
159163

160164
executionDuration, err := meter.Float64Histogram(
161-
"toolhive_vmcp_workflow_duration_seconds",
165+
"toolhive_vmcp_workflow_duration",
162166
metric.WithDescription("Duration of workflow executions in seconds"),
167+
metric.WithUnit("s"),
163168
)
164169
if err != nil {
165170
return nil, fmt.Errorf("failed to create workflow duration histogram: %w", err)

0 commit comments

Comments
 (0)