opentelemetry-collector-contrib
opentelemetry-collector-contrib copied to clipboard
[connector/spanmetrics] Add feature to expire metrics
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 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 will I get extra imaginary points if I give it a try? 🙃
@portertech done, I simplified the method somewhat and removed couple of parameters, let me know what you think
All feedback should be addressed, I also added validation for the metrics flush interval.
Any chance this could be re-reviewed soon? Thanks folks, cc @portertech @TylerHelmuth
Hello folks! Do we have any expectation on when this PR could be merged?
@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: