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

[connector/spanmetrics] Add feature to expire metrics #31106

Merged

Conversation

matej-g
Copy link
Contributor

@matej-g matej-g commented Feb 7, 2024

Description:
Adds a new feature to expire metrics that are considered stale. If no new spans are received within given time frame, on the next export cycle, the metrics are considered expired and will no longer be exported by the spanmetricsconnector.

This intends to solve a situation where a service is no longer producing spans (e.g. because it was removed), but the metrics for such spans keep being produced indefinitely. See the linked issue for more details.

Feature can be configured by setting metrics_expiration option. The current behavior (metrics never expire) is kept as the default.

Link to tracking Issue: #30559

Testing: Added unit tests and tested manually as well.

Documentation: Updated in-code documentation and README.

Signed-off-by: Matej Gera <[email protected]>
Signed-off-by: Matej Gera <[email protected]>
Signed-off-by: Matej Gera <[email protected]>
Signed-off-by: Matej Gera <[email protected]>
@portertech
Copy link
Contributor

@matej-g wonderful, thank you 👍 Going to give this a try. My only issue is the ever growing test newConnectorImp args, but nobody wants to rework that one 😆

@matej-g
Copy link
Contributor Author

matej-g commented Feb 13, 2024

@portertech will I get extra imaginary points if I give it a try? 🙃

@matej-g
Copy link
Contributor Author

matej-g commented Feb 14, 2024

@portertech done, I simplified the method somewhat and removed couple of parameters, let me know what you think

@matej-g
Copy link
Contributor Author

matej-g commented Feb 21, 2024

All feedback should be addressed, I also added validation for the metrics flush interval.

@matej-g
Copy link
Contributor Author

matej-g commented Feb 27, 2024

Any chance this could be re-reviewed soon? Thanks folks, cc @portertech @TylerHelmuth

@tqi-raurora
Copy link

Hello folks!
Do we have any expectation on when this PR could be merged?

@portertech
Copy link
Contributor

@bogdandrutu any chance you are able to review this PR? I see Tyler is on vacation, it would be nice to get this staged for the next release 🙇

@TylerHelmuth TylerHelmuth added the ready to merge Code review completed; ready to merge by maintainers label Mar 12, 2024
@TylerHelmuth TylerHelmuth merged commit 3fecbcc into open-telemetry:main Mar 12, 2024
147 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 12, 2024
DougManton pushed a commit to DougManton/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
…#31106)

**Description:** 
Adds a new feature to expire metrics that are considered stale. If no
new spans are received within given time frame, on the next export
cycle, the metrics are considered expired and will no longer be exported
by the `spanmetricsconnector`.

This intends to solve a situation where a service is no longer producing
spans (e.g. because it was removed), but the metrics for such spans keep
being produced indefinitely. See the linked issue for more details.

Feature can be configured by setting `metrics_expiration` option. The
current behavior (metrics never expire) is kept as the default.

**Link to tracking Issue:** open-telemetry#30559

**Testing:** Added unit tests and tested manually as well.

**Documentation:** Updated in-code documentation and README.

---------

Signed-off-by: Matej Gera <[email protected]>
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this pull request Mar 13, 2024
…#31106)

**Description:** 
Adds a new feature to expire metrics that are considered stale. If no
new spans are received within given time frame, on the next export
cycle, the metrics are considered expired and will no longer be exported
by the `spanmetricsconnector`.

This intends to solve a situation where a service is no longer producing
spans (e.g. because it was removed), but the metrics for such spans keep
being produced indefinitely. See the linked issue for more details.

Feature can be configured by setting `metrics_expiration` option. The
current behavior (metrics never expire) is kept as the default.

**Link to tracking Issue:** open-telemetry#30559

**Testing:** Added unit tests and tested manually as well.

**Documentation:** Updated in-code documentation and README.

---------

Signed-off-by: Matej Gera <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/spanmetrics ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants