internal/observability: derive metricProcedure from transport, not encoding - #2503
Open
elliotchance wants to merge 1 commit into
Open
internal/observability: derive metricProcedure from transport, not encoding#2503elliotchance wants to merge 1 commit into
elliotchance wants to merge 1 commit into
Conversation
…coding metricProcedure mirrors the M3 "procedure" tag so logs can be correlated with alert queries. It was derived from the encoding (proto/json -> "/", thrift -> "--", package always stripped), but the M3 tag is shaped by the transport. For a proto service called over HTTP the two diverge: gRPC M3 procedure: uownservice/searchassets (log matched) HTTP M3 procedure: uber.infra.uown.uownservice--searchassets (log did NOT) So availability alerts on HTTP-invoked endpoints linked to log queries that returned nothing. Derive metricProcedure from req.Transport instead: gRPC keeps the short, slash-delimited form with the package path dropped; every other transport (HTTP, TChannel) keeps the fully-qualified name and turns "::" into "--". The M3 "procedure" tag itself is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
metricProcedure(added in #2359) is emitted on logs so an M3 alert can bemapped back to the matching logs — its value is meant to equal the M3
proceduretag. It was derived from the encoding, but the M3 tag is shapedby the transport, so the two diverge when a proto service is called over
HTTP:
proceduretagmetricProcedure(before)uownservice/searchassetsuownservice/searchassetsuber.infra.uown.uownservice--searchassetsuownservice/searchassetsAs a result, availability alerts on HTTP-invoked endpoints linked to log
queries that returned no results, making them hard to debug.
Fix
Derive
metricProcedurefromreq.Transportinstead of the encoding:(
uownservice/searchassets)lowercased, with
::→--(uber.infra.uown.uownservice--searchassets)The M3
proceduretag itself is unchanged; only the log field is corrected tomatch it. Encoding is still used to skip
raw/unknown encodings.Test plan
TestMiddlewareLoggingWithMetricProcedureto be transport-aware,including the gRPC-vs-HTTP regression pair described above.
go test ./internal/observability/...passes;gofmtandgo buildclean.🤖 Generated with Claude Code