Description
Component(s)
connector/spanmetrics
What happened?
Description
Currently while generating metrics out of traces, the start timestamp of a metric is currently tied to the root span. When a "new" subspan appears for trace (eg : unhappy path on an api call which results in a new subspan), the time starttimestamp for the new metric for the new subspan is that of the root span(which can be well in the past).
Steps to Reproduce
- Setup otelcol with traces and spanmetricsconnector to generate metrics.
- Generate periodic traces to the collector with consistent spans for a long duration.
- Generate a trace that contains a "new" span for the same parent span.
We store start-timestamp at resource level rawmetrics in the spanconnector. This starttimestamp is used regardless of when the "new" subspan appeared.
Expected Result
The metric generated for the new span has a timestamp of the first occurance of the "new" span.
Actual Result
The metric generated for the new span has the time stamp corresponding start of the periodic trace
Collector version
v0.112.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response