-
Notifications
You must be signed in to change notification settings - Fork 36
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 Mp Metrics 5.1 MP Config properties for Histogram and Timer metrics #636
Support Mp Metrics 5.1 MP Config properties for Histogram and Timer metrics #636
Conversation
implementation/src/main/java/io/smallrye/metrics/legacyapi/HistogramAdapter.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/PropertyBooleanConfiguration.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/legacyapi/HistogramAdapter.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/legacyapi/HistogramAdapter.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/legacyapi/TimerAdapter.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketConfiguration.java
Outdated
Show resolved
Hide resolved
// .filter(s -> s.matches("[0-9]+[.]*[0-9]*")) | ||
// .map(Double::parseDouble) | ||
.map(s -> { | ||
if (s.matches("[0-9]+[.]*[0-9]*")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you intend to match a decimal point? Should the dot be escaped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the [ ]
character set allows for matching explicitly the characters within it.
...entation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMaxConfiguration.java
Outdated
Show resolved
Hide resolved
|
||
// metricGroup=<blank> == invalid | ||
if (keyValueSplit.length == 2) { | ||
if (keyValueSplit[1].matches(("[0-9]+[.]*[0-9]*"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the dot need escape?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the [ ]
character set allows for matching explicitly the characters within it.
...entation/src/main/java/io/smallrye/metrics/setup/config/HistogramBucketMinConfiguration.java
Outdated
Show resolved
Hide resolved
|
||
// metricGroup=<blank> == invalid | ||
if (keyValueSplit.length == 2) { | ||
if (keyValueSplit[1].matches(("[0-9]+[.]*[0-9]*"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the dot need escape?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the [ ]
character set allows for matching explicitly the characters within it.
// Parse values of percentile - ensure value is 0 <= x <= 1.0 | ||
Double[] percentileValues = Arrays.asList(keyValueSplit[1].split(",")).stream().map(s -> { | ||
|
||
if (s.matches("[0][.][0-9]+")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the dot need escape?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the [ ]
character set allows for matching explicitly the characters within it.
...ementation/src/main/java/io/smallrye/metrics/setup/config/MetricPercentileConfiguration.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Show resolved
Hide resolved
implementation/src/main/java/io/smallrye/metrics/setup/config/MetricsConfigurationManager.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see code comments.
3760eb1
to
607670c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixe #665
Context the new MP Config properties for metrics v5.1 follow the following syntax:
^^ That is to say property is a semi-colon separated values that define the configuration for a specific metric name.
MericsConfigurationManger
hasgetxxx()
which returns an respective sub-class ofPropertyConfiguration
.For example
getPercentilesConfiguration(...)
returnsMetricPercentileConfiguration
.This is called as appropriate from the
HistogramAdapter
orTimerAdapter
during registration as it needs this info to customize the metric.During the
getxxx()
, it checks ifMericsConfigurationManger
contains an existing collection of configuration objects for the app name that is passed in in its respectiveMap<String, Collection<T extends PropertyConfiguration>>
. The collection represents the configuration of the whole property (i.e. all metric names and its associative values). The *appname that is passed in is used to parse this collection for the specific metric name and value. This is done by calling a static methodmatches(Collection<T extends PropertyConfiguration> collection, String metricName)
which accepts a metric name and the collection to go through.If not, it will retrieve the MP Config property from the ConfigProvider and add to the respective
Map<String, Collection<T extends PropertyConfiguration>>
.