Skip to content

Commit

Permalink
Allowing any numeric metric in Kafka / Connect
Browse files Browse the repository at this point in the history
  • Loading branch information
meiao committed Jun 22, 2023
1 parent 93a77be commit 17c9ce2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -54,8 +54,8 @@ public void run() {
Map<String, Object> eventData = new HashMap<>();
for (final Map.Entry<String, KafkaMetric> metric : metrics.entrySet()) {
Object metricValue = metric.getValue().metricValue();
if (metricValue instanceof Double) {
final float value = ((Double) metricValue).floatValue();
if (metricValue instanceof Number) {
final float value = ((Number) metricValue).floatValue();
if (kafkaMetricsDebug) {
AgentBridge.getAgent().getLogger().log(Level.FINEST, "getMetric: {0} = {1}", metric.getKey(), value);
}
Expand Down
Expand Up @@ -63,8 +63,8 @@ public void run() {
Map<String, Object> eventData = new HashMap<>();
for (final Map.Entry<String, KafkaMetric> metric : nrMetricsReporter.getMetrics().entrySet()) {
Object metricValue = metric.getValue().metricValue();
if (metricValue instanceof Double) {
final float value = ((Double) metricValue).floatValue();
if (metricValue instanceof Number) {
final float value = ((Number) metricValue).floatValue();
if (KAFKA_METRICS_DEBUG) {
AgentBridge.getAgent().getLogger().log(Level.FINEST, "getMetric: {0} = {1}", metric.getKey(), value);
}
Expand Down
Expand Up @@ -75,8 +75,8 @@ void harvest() {
Map<String, Object> eventData = METRICS_AS_EVENTS ? new HashMap<>() : Collections.emptyMap();
for (final Map.Entry<String, KafkaMetric> metric : metrics.entrySet()) {
Object metricValue = metric.getValue().metricValue();
if (metricValue instanceof Double) {
final float value = ((Double) metricValue).floatValue();
if (metricValue instanceof Number) {
final float value = ((Number) metricValue).floatValue();
if (KAFKA_METRICS_DEBUG) {
NewRelic.getAgent().getLogger().log(Level.FINEST, "getMetric: {0} = {1}", metric.getKey(), value);
}
Expand Down

0 comments on commit 17c9ce2

Please sign in to comment.