Skip to content

Filter metrics by regular expression#80

Merged
Aki-7 merged 1 commit intojenkinsci:mainfrom
Aki-7:filter-metrics
Aug 9, 2021
Merged

Filter metrics by regular expression#80
Aki-7 merged 1 commit intojenkinsci:mainfrom
Aki-7:filter-metrics

Conversation

@Aki-7
Copy link
Copy Markdown
Member

@Aki-7 Aki-7 commented Aug 6, 2021

What metrics to collect is different from user to user, and this enables users to filter metrics to collect by regular expression.
The regular expression will be specified by REMOTING_OTEL_METRIC_FILTER environment variables.
The metrics whose name match the specified regex will be collected.

close #73

Checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • All follow-ups are documented as issues and-or TODO comments
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue
  • Please update user documentation if needed
  • Please update developer documentation if needed

@Aki-7 Aki-7 requested a review from a team as a code owner August 6, 2021 14:27
@Aki-7 Aki-7 requested review from darshank15 and removed request for a team August 6, 2021 14:27
@Aki-7 Aki-7 added the enhancement New feature or request label Aug 6, 2021
Copy link
Copy Markdown
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

No objections w.r.t the pattern


String metricsFilterPatternString = System.getenv("REMOTING_OTEL_METRIC_FILTER");
Pattern metricsFilterPattern;
if (metricsFilterPatternString == null) metricsFilterPatternString = ".*";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be more efficient to pass the null pattern and to handle it as separate case

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I see, but it does the pattern evaluation only once for each metric at the registration phase, and I couldn't come up with a better way to achieve this without redundant code. So I will merge this PR as it is and I'll fix this later if the efficiency seems to be a problem. Thank you for your review!

@Aki-7 Aki-7 merged commit cf406f7 into jenkinsci:main Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable to configure what kind of metrics to collect

2 participants