Skip to content

APIGOV33468 - fix remoteApiName_ prefix not stripped in metric API detail lookups - #1079

Merged
sbolosan merged 3 commits into
mainfrom
APIGOV-33468
Aug 10, 2026
Merged

APIGOV33468 - fix remoteApiName_ prefix not stripped in metric API detail lookups#1079
sbolosan merged 3 commits into
mainfrom
APIGOV-33468

Conversation

@sbolosan

@sbolosan sbolosan commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes a bug where Azure (and any agent whose API ID equals its display name) traceability events showed "unknown" for Subscription, Product, ProductPlan, Quota, AssetResource, APIServiceRevision, consumer Application, api.owner, and api.apiServiceId — even when the correct AccessRequest and APIService were cached.

Root cause: ResolveIDWithPrefix falls back to prefixing the API name with remoteApiName_ when no real ID is available. Five separate cache-lookup call sites only ever stripped the remoteApiId_ prefix, never the remoteApiName_ fallback, so the lookup key never matched and every downstream field defaulted to unknown.

Adds StripSummaryEventPrefix in pkg/transaction/util/util.go, which strips both possible prefixes, and points all five affected call sites at it:

  1. GetAccessRequest (util.go)
  2. ResolveAPIOwner (ownerresolver.go)
  3. buildSummaryAPIDetail's apiServiceId fallback (v2event.go)
  4. createAPIDetail (metricscollector.go)
  5. buildAPIRef (metric/util.go)

Adds table-driven test coverage for all affected sites, including the name-fallback regression case specifically:

  1. TestStripSummaryEventPrefix, updated TestResolveAPIOwner, TestBuildAPIRef, TestCreateAPIDetail,
  2. TestBuildSummaryAPIDetailAPIServiceIDFallback.

No behavior change for any agent whose API ID never collapses to the name-fallback form (e.g. v7, webmethods) — verified live against azure-agents, webmethods-agents, and sample-agent with no regression.

@sbolosan
sbolosan merged commit 22e3ac5 into main Aug 10, 2026
2 checks passed
@sbolosan
sbolosan deleted the APIGOV-33468 branch August 10, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants