opentelemetry-collector-contrib icon indicating copy to clipboard operation
opentelemetry-collector-contrib copied to clipboard

[connector/spanmetrics] Add feature to expire metrics

Open matej-g opened this issue 1 year ago • 2 comments

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.

matej-g avatar Feb 07 '24 11:02 matej-g

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

portertech avatar Feb 12 '24 20:02 portertech

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

matej-g avatar Feb 13 '24 08:02 matej-g

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

matej-g avatar Feb 14 '24 11:02 matej-g

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

matej-g avatar Feb 21 '24 15:02 matej-g

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

matej-g avatar Feb 27 '24 13:02 matej-g

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

tqi-raurora avatar Mar 04 '24 18:03 tqi-raurora

@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 :bow:

portertech avatar Mar 08 '24 17:03 portertech