Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spans emitted by linkerd-proxy make it hard to use SpanMetrics due to spanName cardinality explosion #10968

Open
Tyrion85 opened this issue May 31, 2023 · 2 comments

Comments

@Tyrion85
Copy link
Contributor

What problem are you trying to solve?

According to Jaeger docs, when adding SpanMetrics you can expect the metrics cardinality to be:

max = 324 * num_operations
typical = 72 * num_operations

However, by default spanNames as emitted by linkerd-proxy have a full URL path set (which is a bad practice, according to Opentelemetry specs), which results in the following situation, when URL path contains variables (pretty common for APIs):

Screenshot 2023-05-30 at 19 13 00

It is possible to rename spanNames, and extract variables to attributes, by using Opentelemetry Collector's SpanProcessor, for example in case above:

processors:
...
  span/to_attributes:
        name:
          to_attributes:
            rules:
            - ^\/api\/v1\/users\/(?P<userId>.*)\/own_permissions\/(?P<businessGid>.*)
...
service:
...
  pipelines:
        traces:
          processors: [ batch,span/to_attributes ]

But that would mean you have to hardcode all the paths of all APIs that have variables in URL paths, or devise of some mechanism to automatically update the central Collector's config based on what individual services have/use.

I'm really curious how do other people use SpanMetrics when using linkerd. Do you just live with this issue and cardinality explosion? Is there some other config I'm missing, or some extension/project that deals with this? As far as I can see, linkerd-proxy specifically makes SpanMetrics really hard to use.

How should the problem be solved?

I have no idea what the alternative to using full URL path as spanName would be, considering Linkerd (probably?) doesn't know which parts of the path are fixed, and which are variable.

Any alternatives you've considered?

I gave the OpentelemetryCollector SpanProcessor config above, but like I said, I would have to hardcode the pattern of every such API call. Doesn't seem very maintainable.

How would users interact with this feature?

No response

Would you like to work on this feature?

None

@Tyrion85 Tyrion85 changed the title Spans emitted by linkers-proxy make it hard to use SpanMetrics due to spanName cardinality explosion Spans emitted by linkerd-proxy make it hard to use SpanMetrics due to spanName cardinality explosion May 31, 2023
@stale
Copy link

stale bot commented Sep 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 3, 2023
@wmorgan wmorgan added the pinned label Sep 5, 2023
@stale stale bot removed the wontfix label Sep 5, 2023
@NickAdolf
Copy link

This is causing us grief as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants