Skip to content

Commit

Permalink
Add ID to filter 'configure'
Browse files Browse the repository at this point in the history
  • Loading branch information
Clint Checketts authored and jkschneider committed Nov 3, 2017
1 parent 67240da commit fc53c0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ default Meter.Id map(Meter.Id id) {
* This is only called when filtering new timers and distribution summaries (i.e. those meter types
* that use {@link HistogramConfig}).
*
*
* @param id Id with {@link MeterFilter#map} transformations applied.
* @param config A histogram configuration guaranteed to be non-null.
* @return Overrides to any part of the histogram config, when applicable.
*/
default HistogramConfig configure(HistogramConfig config) {
default HistogramConfig configure(Meter.Id id, HistogramConfig config) {
return config;
}

Expand Down Expand Up @@ -142,4 +144,4 @@ public MeterFilterReply accept(Meter.Id id) {
static MeterFilter denyNameStartsWith(String prefix) {
return deny(id -> id.getName().startsWith(prefix));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ private <M extends Meter> M registerMeterIfNecessary(Class<M> meterClass, Meter.
HistogramConfig mappedConfig = config;
if (mappedConfig != null) {
for (MeterFilter filter : filters) {
mappedConfig = filter.configure(mappedConfig);
mappedConfig = filter.configure(mappedId, mappedConfig);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected Timer newTimer(Meter.Id id, HistogramConfig histogramConfig) {

registry.config().meterFilter(new MeterFilter() {
@Override
public HistogramConfig configure(HistogramConfig config) {
public HistogramConfig configure(Meter.Id mappedId, HistogramConfig config) {
return HistogramConfig.builder()
.percentilesHistogram(true)
.build()
Expand All @@ -69,4 +69,4 @@ public HistogramConfig configure(HistogramConfig config) {

registry.timer("my.timer");
}
}
}

0 comments on commit fc53c0c

Please sign in to comment.