Skip to content

Conversation

@spkane31
Copy link
Contributor

@spkane31 spkane31 commented Aug 5, 2025

What changed?

added nexus_{service,operation} tags to metrics for better observability

Why?

Metrics were missing these fields making debugging difficult

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

NA

@spkane31 spkane31 self-assigned this Aug 5, 2025
@spkane31 spkane31 requested a review from a team as a code owner August 5, 2025 18:11
@bergundy
Copy link
Member

bergundy commented Aug 5, 2025

We shouldn't add labels to existing metrics without prior discussion, when we added these label on the frontend, we put them behind a dynamic config to avoid high cardinality issues, which can bring down metrics backends. What's the motivation for adding this?

@spkane31 spkane31 requested a review from rodrigozhou August 6, 2025 19:23
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I would just not add these labels altogether until we see a reason to include them but at this point the work has already been done so we may as well merge it.
Please see my comment below.

tags = append(tags, metrics.NexusOperationTag(operation))
}

for _, mapping := range conf.HeaderTagMappings {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config was meant for the handler side, I'm a bit hesitant to also apply it on the caller side but I guess there's no harm in doing so.

metricTagConfig: h.Config.MetricTagConfig,
}
ctx = rCtx.augmentContext(ctx, r.HTTPRequest.Header)
rCtx.enrichNexusOperationMetrics(r.HTTPRequest.Method, r.HTTPRequest.URL.Path, r.HTTPRequest.Header)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those aren't service and operation names. These labels can't be available on this metric.

PayloadSizeLimit: dynamicconfig.BlobSizeLimitError.Get(coll),
ForwardingEnabledForNamespace: dynamicconfig.EnableNamespaceNotActiveAutoForwarding.Get(coll),
MaxOperationTokenLength: nexusoperations.MaxOperationTokenLength.Get(coll),
MetricTagConfig: dynamicconfig.NewGlobalCachedTypedValue(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to remove this soon (finally). If #7052 lands first then you can just get rid of this and use the setting directly. If this lands first, I'll do it in that PR.

@spkane31 spkane31 closed this Aug 13, 2025
@spkane31 spkane31 deleted the spk/nexus-missing-metrics-fields branch September 25, 2025 16:14
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.

5 participants