From b254761c5ec8114de9d0b85c2b9b37b057702ccd Mon Sep 17 00:00:00 2001 From: Jon Schneider Date: Thu, 25 Jan 2018 13:34:02 -0600 Subject: [PATCH] Support micrometer Graphite tagsAsPrefix property Fixes gh-11797 --- .../export/graphite/GraphiteProperties.java | 16 +++++++++++++++- .../GraphitePropertiesConfigAdapter.java | 8 +++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteProperties.java index 0ce03a5d05..f528bcbca4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,12 @@ public class GraphiteProperties { */ private GraphiteProtocol protocol; + /** + * For the default naming convention, turn the specified tag keys into part of the + * metric prefix. + */ + private String[] tagsAsPrefix; + public Boolean getEnabled() { return this.enabled; } @@ -123,4 +129,12 @@ public class GraphiteProperties { this.protocol = protocol; } + public String[] getTagsAsPrefix() { + return this.tagsAsPrefix; + } + + public void setTagsAsPrefix(String[] tagsAsPrefix) { + this.tagsAsPrefix = tagsAsPrefix; + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphitePropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphitePropertiesConfigAdapter.java index fcf5853896..af1b88599f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphitePropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphitePropertiesConfigAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,4 +78,10 @@ class GraphitePropertiesConfigAdapter extends PropertiesConfigAdapter