Skip to content

[connector/spanmetrics] Fix spanmetrics for child spans #36718

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

Merged
merged 12 commits into from
Apr 13, 2025

Conversation

shivanthzen
Copy link
Contributor

@shivanthzen shivanthzen commented Dec 9, 2024

Description

Currently, metric start timestamps are associated with the parent span (resource level). This means that all child spans, even those that occur asynchronously or infrequently, inherit the same start timestamp. This can lead to inaccurate data.

This merge request proposes moving the start timestamp (and last seen timestamp) from the parent span level to the individual child span (metric) level. This will ensure that each metric has its own accurate start and last seen timestamps, regardless of its relationship to other spans.

Link to tracking issue

Fixes #35994

Testing

Documentation

@shivanthzen shivanthzen changed the title Fix spanmetrics [connector/spanmetrics] Fix spanmetrics Dec 9, 2024
@shivanthzen shivanthzen changed the title [connector/spanmetrics] Fix spanmetrics [connector/spanmetrics] Fix spanmetrics for child spans Dec 9, 2024
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Dec 24, 2024
@shivanthzen
Copy link
Contributor Author

not stale

@portertech
Copy link
Contributor

@shivanthzen are you able to look at the failing tests? For example:

FAIL: TestTimestampsForUninterruptedStream/AGGREGATION_TEMPORALITY_CUMULATIVE

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 29, 2025
@shivanthzen
Copy link
Contributor Author

not stale

@github-actions github-actions bot removed the Stale label Feb 4, 2025
Apparently, for delta temporality, all the metrics collected are reset
to empty state after consuming one round of data. Hence storing the
lastseentimestamp within the metric doesn't work. This PR moves
lastseentimestamp  out of metric into a map (as it was stored
previously)
of
@shivanthzen shivanthzen marked this pull request as ready for review February 6, 2025 09:37
@shivanthzen shivanthzen requested a review from a team as a code owner February 6, 2025 09:37
@shivanthzen shivanthzen requested a review from codeboten February 6, 2025 09:37
@shivanthzen
Copy link
Contributor Author

@portertech Sorry about the delay. Please take another look.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 21, 2025
Copy link
Contributor

github-actions bot commented Mar 7, 2025

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Mar 7, 2025
@atoulme atoulme removed the Stale label Mar 8, 2025
@atoulme
Copy link
Contributor

atoulme commented Mar 8, 2025

@portertech please review

@atoulme
Copy link
Contributor

atoulme commented Mar 17, 2025

Please add a changelog.

@atoulme atoulme marked this pull request as draft March 17, 2025 22:30
@shivanthzen shivanthzen marked this pull request as ready for review March 21, 2025 16:36
@shivanthzen
Copy link
Contributor Author

@atoulme Done

@atoulme
Copy link
Contributor

atoulme commented Mar 21, 2025

@portertech and @Frapschen please review.

renovate bot and others added 2 commits April 8, 2025 17:53
…emetry#37196)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google.golang.org/grpc](https://redirect.github.com/grpc/grpc-go) |
`v1.69.2` -> `v1.69.4` |
[![age](https://developer.mend.io/api/mc/badges/age/go/google.golang.org%2fgrpc/v1.69.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/google.golang.org%2fgrpc/v1.69.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/google.golang.org%2fgrpc/v1.69.2/v1.69.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/google.golang.org%2fgrpc/v1.69.2/v1.69.4?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>grpc/grpc-go (google.golang.org/grpc)</summary>

###
[`v1.69.4`](https://redirect.github.com/grpc/grpc-go/releases/tag/v1.69.4):
Release 1.69.4

[Compare
Source](https://redirect.github.com/grpc/grpc-go/compare/v1.69.2...v1.69.4)

### Bug Fixes

- rbac: fix support for :path header matchers, which would previously
never successfully match
([#&open-telemetry#8203;7965](https://redirect.github.com/grpc/grpc-go/issues/7965)).

### Documentation

- examples/features/csm_observability: update example client and server
to use the helloworld service instead of echo service
([#&open-telemetry#8203;7945](https://redirect.github.com/grpc/grpc-go/issues/7945)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45Mi4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTA3LjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyIsInJlbm92YXRlYm90Il19-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
@shivanthzen
Copy link
Contributor Author

@atoulme Does this require further approvals?

@djaglowski djaglowski merged commit b8362a5 into open-telemetry:main Apr 13, 2025
171 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 13, 2025
akshays-19 pushed a commit to akshays-19/opentelemetry-collector-contrib that referenced this pull request Apr 23, 2025
…ry#36718)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Currently, metric start timestamps are associated with the parent span
(resource level). This means that all child spans, even those that occur
asynchronously or infrequently, inherit the same start timestamp. This
can lead to inaccurate data.

This merge request proposes moving the start timestamp (and last seen
timestamp) from the parent span level to the individual child span
(metric) level. This will ensure that each metric has its own accurate
start and last seen timestamps, regardless of its relationship to other
spans.


<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#35994

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Murphy Chen <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
Fiery-Fenix pushed a commit to Fiery-Fenix/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
…ry#36718)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Currently, metric start timestamps are associated with the parent span
(resource level). This means that all child spans, even those that occur
asynchronously or infrequently, inherit the same start timestamp. This
can lead to inaccurate data.

This merge request proposes moving the start timestamp (and last seen
timestamp) from the parent span level to the individual child span
(metric) level. This will ensure that each metric has its own accurate
start and last seen timestamps, regardless of its relationship to other
spans.


<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes
open-telemetry#35994

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Murphy Chen <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Yang Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[connector/spanmetrics] Incorrect starttimestamps for subspans.
6 participants