Add MicrometerCommandLatencyRecorder to Redis clusters

This commit is contained in:
Chris Eager
2022-07-27 14:58:12 -05:00
committed by Chris Eager
parent a6f9409a39
commit aa36dc95ef
2 changed files with 41 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
/*
* Copyright 2022 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.metrics;
import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.config.MeterFilter;
public class LettuceMetricsMeterFilter implements MeterFilter {
private static final String METRIC_NAME_PREFIX = "lettuce.command";
private static final String REMOTE_TAG = "remote";
// the `remote` tag is very high-cardinality, so we ignore it.
// In the future, it would be nice to map a remote (address:port) to a logical cluster name
private static final MeterFilter IGNORE_TAGS_FILTER = MeterFilter.ignoreTags(REMOTE_TAG);
@Override
public Meter.Id map(final Meter.Id id) {
if (id.getName().startsWith(METRIC_NAME_PREFIX)) {
return IGNORE_TAGS_FILTER.map(id);
}
return id;
}
}