Discover AWS/Bedrock application inference profiles for tag/name enrichment - #1913
Open
AdilKh4n wants to merge 2 commits into
Open
Discover AWS/Bedrock application inference profiles for tag/name enrichment#1913AdilKh4n wants to merge 2 commits into
AdilKh4n wants to merge 2 commits into
Conversation
…chment AWS/Bedrock had no ResourceFilters entry, so the tagging client's resourcegroupstaggingapi-based discovery never ran for it: metrics were always emitted with empty tag_* labels and a "global" name label, regardless of exportedTagsOnMetrics config. Application inference profile tags aren't reliably surfaced through the tagging API in a way that also carries the profile's human-readable name, so this adds a dedicated ServiceFilter that calls bedrock:ListInferenceProfiles and bedrock:ListTagsForResource directly, similar to the existing AWS/StorageGateway resource discovery. The resource's ARN field is repurposed to "<profile-id>/<profile-name>" so the ModelId dimension regex still matches while the name label becomes human-readable instead of "global". Signed-off-by: Adil Khan <adikhan@adobe.com>
AdilKh4n
force-pushed
the
bedrock-inference-profile-tags
branch
from
July 31, 2026 22:23
b11d642 to
38eafba
Compare
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.
Summary
AWS/Bedrockhas noResourceFiltersentry inpkg/config/services.go, so the tagging client'sresourcegroupstaggingapi-based discovery (pkg/clients/tagging/client.go) never runs for it (if len(svc.ResourceFilters) > 0). As a result,AWS/Bedrockmetrics are always emitted with:tag_*labels, regardless ofexportedTagsOnMetricsconfigurationname="global"label, since no resource is ever associated to the metricThis is easy to reproduce: configure
exportedTagsOnMetrics.AWS/Bedrockwith any tag key, scrapeAWS/Bedrockmetrics, and the resultingtag_*label value is always"".Unlike most namespaces, Bedrock application inference profile tags aren't reliably obtainable through the tagging API in a way that also carries the profile's human-readable name (
InferenceProfileName), which isn't part of the ARN. So instead of addingResourceFilters, this PR adds a dedicatedServiceFilter(see the existingAWS/StorageGatewayentry for precedent) that:bedrock:ListInferenceProfilesdirectly to discover inference profilesbedrock:ListTagsForResourceper profile to fetch tags (best-effort:SYSTEM_DEFINEDprofiles are AWS-owned and don't support tagging, so a failed call is treated as "no tags" rather than aborting discovery)ARNfield to"<profile-id>/<profile-name>"instead of the real ARN (same trickAWS/StorageGatewayuses with"<gateway-id>/<gateway-name>"), since CloudWatch'sModelIddimension for these metrics is the bare profile ID, not the full ARN. This lets theModelIddimension regex match the id prefix while the profile's name still ends up in the metric'snamelabel instead of"global".Changes
pkg/config/services.go: dropResourceFiltersfromAWS/Bedrock, update theDimensionRegexpsentry to match the new<id>/<name>schemepkg/clients/tagging/filters.go: add aServiceFilterforAWS/Bedrockpkg/clients/tagging/adapters.go,client.go: wire up abedrockclient adapter, following the existing closure-based adapter patternpkg/clients/factory.go: construct the*bedrock.Clientpkg/promutil/prometheus.go: addBedrockAPICounterscrape metricpkg/job/maxdimassociator/associator_bedrock_test.go: new associator test covering the match/skip casesREADME.md: document the newbedrock:ListInferenceProfiles/bedrock:ListTagsForResourceIAM permissionsgo.mod/go.sum: addgithub.com/aws/aws-sdk-go-v2/service/bedrock(minor patch bumps toaws-sdk-go-v2core andsmithy-gocame along viago mod tidy)Test plan
go build ./...go vet ./...go test ./...(all packages pass)tag_applabel (added viaexportedTagsOnMetrics) andnamelabel are both populated correctly once this discovery path runs