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

Support filtering commands on MicrometerCommandLatencyRecorder #2407

Closed
wants to merge 1 commit into from

Conversation

andre237
Copy link
Contributor

Discussion about this proposal: #2406

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

* @param commands list of Redis commands that are enabled for latency recording
* @return this {@link Builder}.
*/
public Builder enabledCommands(CommandType... commands) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about having a Predicate<RedisCommand> instead of protocol keywords? We could provide derived methods that can build a predicate to filter unwanted commands from being recorded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems nice to me, but I don't see how to implement it (without changes to other classes), since the CommandLatencyRecorder#recordCommandLatency does not include a RedisCommand as a parameter. Any sugestion on how to do it? At first glance, I would just add a Predicate<CommandType> to the MicrometerOptions, so we remove the responsability of filtering from the MicrometerCommandLatencyRecorder class.

@mp911de mp911de changed the title Support filtering commands on MicrometerCommandLatencyRecorder Support filtering commands on MicrometerCommandLatencyRecorder Aug 15, 2023
@mp911de mp911de added the type: feature A new feature label Aug 15, 2023
@mp911de mp911de added this to the 6.3 milestone Aug 15, 2023
mp911de pushed a commit that referenced this pull request Aug 15, 2023
We can now filter particular commands from being recorded to Micrometer.

Original pull request: #2407
mp911de added a commit that referenced this pull request Aug 15, 2023
Refactor enabledCommands to use a Predicate for metrics recording.

Original pull request: #2407
@mp911de mp911de linked an issue Aug 15, 2023 that may be closed by this pull request
@mp911de
Copy link
Collaborator

mp911de commented Aug 15, 2023

Thank you for your contribution. That's merged and polished now.

@mp911de mp911de closed this Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Command filter to MicrometerCommandLatencyRecorder
2 participants