Skip to content

Commit

Permalink
additional fixups; rm total suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Ludwig committed Dec 5, 2022
1 parent 34730d6 commit bd63ba9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions handler/middleware/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ func (th *TraceHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
meter := provider.Meter("couper/server")

counter, _ := meter.SyncInt64().
Counter(instrumentation.ClientRequest, instrument.WithDescription(string(unit.Dimensionless)))
Counter(instrumentation.ClientRequest,
instrument.WithDescription(string(unit.Dimensionless)))
duration, _ := meter.SyncFloat64().
Histogram(instrumentation.ClientRequestDuration, instrument.WithDescription(string(unit.Dimensionless)))
Histogram(instrumentation.ClientRequestDuration,
instrument.WithDescription(string(unit.Dimensionless)))

counter.Add(req.Context(), 1)
duration.Record(req.Context(), end.Seconds())
counter.Add(req.Context(), 1, metricsAttrs...)
duration.Record(req.Context(), end.Seconds(), metricsAttrs...)
}
2 changes: 1 addition & 1 deletion server/http_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestServeMetrics(t *testing.T) {
`couper_client_request_total{code="404",host="localhost:8080",method="GET",service_name="my-service",service_version="0"} 1`,
`couper_client_request_error_types_total{error="route_not_found_error",service_name="my-service",service_version="0"} 1`,
`couper_client_connections_total{service_name="my-service",service_version="0"} 3`,
`go_goroutines{service_name="my-service"}`,
`go_goroutines{service_name="my-service",service_version="0"}`,
}

for _, expMetric := range expMetrics {
Expand Down
8 changes: 4 additions & 4 deletions telemetry/instrumentation/instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const (

BackendConnections = Prefix + "backend_connections_count"
BackendConnectionsLifetime = Prefix + "backend_connections_lifetime_seconds"
BackendConnectionsTotal = Prefix + "backend_connections_total"
BackendConnectionsTotal = Prefix + "backend_connections"
BackendHealthState = Prefix + "backend_up"
BackendRequest = Prefix + "backend_request_total"
BackendRequest = Prefix + "backend_request"
BackendRequestDuration = Prefix + "backend_request_duration_seconds"
ClientConnections = Prefix + "client_connections_count"
ClientConnectionsTotal = Prefix + "client_connections_total"
ClientRequest = Prefix + "client_request_total"
ClientConnectionsTotal = Prefix + "client_connections"
ClientRequest = Prefix + "client_request"
ClientRequestDuration = Prefix + "client_request_duration_seconds"
)

0 comments on commit bd63ba9

Please sign in to comment.