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

Extract attribute values from a span to generate a new metric #26628

Closed
ssidhu-apm opened this issue Sep 11, 2023 · 10 comments
Closed

Extract attribute values from a span to generate a new metric #26628

ssidhu-apm opened this issue Sep 11, 2023 · 10 comments
Labels

Comments

@ssidhu-apm
Copy link

Component(s)

No response

Is your feature request related to a problem? Please describe.

Assume there is a span with the following data:
name = order.data
service = my.service
location = IN
revenue = 42
status = OK

I'd like to use this span to extract metric data and send it via a metrics exporter.
datapoint = 42
metric.name = order.data
location = IN

I'd like the option to drop the span or retain it in the trace exporter at this stage.

Describe the solution you'd like

Extrapolating the spanmetricsconnector to extract an attribute value from the span to generate the data point from the metric.

Describe alternatives you've considered

No response

Additional context

No response

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

Pinging code owners for connector/spanmetrics: @albertteoh. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

Hello @ssidhu-apm, sorry for the delay. I'm not sure the spanmetrics connector is the best place for this functionality.

From the README's overview:

Aggregates Request, Error and Duration (R.E.D) OpenTelemetry metrics from span data.

It looks like your request is a more general functionality approach of being able to generate any kind of new metric from incoming trace data.

Can you share some more context for your request here? In general, metric receivers should be used to get metrics from whatever source is necessary. Do you have a specific scenario where a receiver can't accomplish what you're trying to do?

@crobert-1
Copy link
Member

Hello @ssidhu-apm, without more information we can't really make progress on this enhancement request. I'm going to close this issue for now, but please feel free to reopen and add more information, we'd be happy to help!

@crobert-1 crobert-1 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
@ssidhu-apm
Copy link
Author

I missed the previous updated. Sorry about that.

The use-case is to extract metadata as a metric at the collector and send it to a metrics endpoint. If there is another processor option to extract metadata from spans, please do let me know.

In the example I shared:
the metric value (i.e. the datapoint) would be 42 (which is present in a span attribute). The metric itself would be augmented with additional attributes from the span.

@ssidhu-apm
Copy link
Author

Looks like I cannot reopen the issue @crobert-1 . Is that something you could do?

@crobert-1
Copy link
Member

I'll have to defer to @albertteoh as he'd be the best person to validate this use case for the span metrics connector.

@albertteoh
Copy link
Contributor

Thanks @crobert-1. Yeah, I agree with you, spanmetrics connector wasn't designed for emitting metrics of individual spans' attribute values, but instead is designed specifically to aggregate the number of occurrences of spans with common attributes.

@ssidhu-apm I'm not aware of other alternative components that can meet your requirements. Have you tried asking in the #opentelemetry/#otel-collector slack channels or SIG groups?

@zacps
Copy link

zacps commented Feb 14, 2024

I'll preface by saying that I'm not super familiar with the project structure, and don't really care where this is implemented as long as it's something that's possible. Is there a repo for general feature requests/user story kind of issues that might be better suited?

This is something we'd really like to have as well. One of the values of opentelemetry for us is the automatic instrumentation across a large number of libraries. If we could leverage this to almost automatically (with some collector configuration) generate metrics as well that would be a huge help.

@crobert-1
Copy link
Member

I think the best path forward is probably to propose a new connector component with this functionality.

@crobert-1
Copy link
Member

I'm going to close this issue for now, feel free to reference in a new issue for context.

@crobert-1 crobert-1 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants