@@ -149,27 +149,27 @@ public MetricFamilySamples filter(Predicate<String> sampleNameFilter) {
149
149
* {@code # HELP}), and as this name <a href="https://github.com/prometheus/common/issues/319">must be unique</a>
150
150
* we include the name without suffix here as well.
151
151
*/
152
- public String [] getNames () {
152
+ public List < String > getNames () {
153
153
List <String > names = new ArrayList <String >();
154
154
switch (type ) {
155
155
case COUNTER :
156
156
names .add (name + "_total" );
157
- if (getUseCreated () ) {
157
+ if (USE_CREATED ) {
158
158
names .add (name + "_created" );
159
159
}
160
160
break ;
161
161
case SUMMARY :
162
162
names .add (name + "_count" );
163
163
names .add (name + "_sum" );
164
- if (getUseCreated () ) {
164
+ if (USE_CREATED ) {
165
165
names .add (name + "_created" );
166
166
}
167
167
break ;
168
168
case HISTOGRAM :
169
169
names .add (name + "_count" );
170
170
names .add (name + "_sum" );
171
171
names .add (name + "_bucket" );
172
- if (getUseCreated () ) {
172
+ if (USE_CREATED ) {
173
173
names .add (name + "_created" );
174
174
}
175
175
break ;
@@ -185,7 +185,7 @@ public String[] getNames() {
185
185
// NOP - `name` is added to all
186
186
}
187
187
names .add (name );
188
- return names . toArray ( new String [ 0 ]) ;
188
+ return names ;
189
189
}
190
190
191
191
@@ -398,6 +398,8 @@ public static String doubleToGoString(double d) {
398
398
protected static final String DISABLE_CREATED_SERIES = "PROMETHEUS_DISABLE_CREATED_SERIES" ;
399
399
private static final List <String > TRUTHS = Arrays .asList ("true" , "1" , "t" );
400
400
401
+ protected static boolean USE_CREATED = getUseCreated ();
402
+
401
403
protected static boolean getUseCreated () {
402
404
String disable_series = System .getenv (DISABLE_CREATED_SERIES );
403
405
if (disable_series != null ) {
0 commit comments