|
6 | 6 | import io.opentelemetry.api.metrics.LongCounterBuilder; |
7 | 7 | import io.opentelemetry.api.metrics.LongUpDownCounterBuilder; |
8 | 8 | import io.opentelemetry.api.metrics.Meter; |
9 | | -import io.opentelemetry.api.metrics.MeterProvider; |
10 | 9 | import io.opentelemetry.api.metrics.ObservableMeasurement; |
11 | 10 | import org.slf4j.Logger; |
12 | 11 | import org.slf4j.LoggerFactory; |
13 | 12 |
|
14 | 13 | // https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api/1.47.0/io/opentelemetry/api/metrics/Meter.html |
15 | 14 | public class OtelMeter implements Meter { |
16 | 15 | private static final Logger LOGGER = LoggerFactory.getLogger(OtelMeter.class); |
17 | | - private static final Meter NOOP_METER = MeterProvider.noop().get("noop"); |
18 | | - private static final String NOOP_INSTRUMENT_NAME = "noop"; |
19 | 16 |
|
20 | 17 | private final String instrumentationScopeName; |
21 | 18 | private final String schemaUrl; |
@@ -67,28 +64,4 @@ public BatchCallback batchCallback( |
67 | 64 | LOGGER.info("batchCallback is not yet supported"); |
68 | 65 | return Meter.super.batchCallback(callback, observableMeasurement, additionalMeasurements); |
69 | 66 | } |
70 | | - |
71 | | - private static boolean isInstrumentNameInvalid(String instrumentName) { |
72 | | - if ((null == instrumentName) |
73 | | - || instrumentName.isEmpty() |
74 | | - || instrumentName.length() > 255 |
75 | | - || !Character.isLetter(instrumentName.charAt(0)) |
76 | | - || HasAnyInvalidCharacter(instrumentName)) { |
77 | | - LOGGER.warn( |
78 | | - "Invalid instrument name {}. Instrument names must be ASCII, start with letter, contain only alphanumeric characters, '_', '.', '/', '-' and be max 255 characters.", |
79 | | - instrumentName); |
80 | | - return true; |
81 | | - } |
82 | | - return false; |
83 | | - } |
84 | | - |
85 | | - private static boolean HasAnyInvalidCharacter(String instrumentName) { |
86 | | - for (int i = 1; i < instrumentName.length(); i++) { |
87 | | - char c = instrumentName.charAt(i); |
88 | | - if (!Character.isLetterOrDigit(c) && c != '_' && c != '.' && c != '/' && c != '-') { |
89 | | - return true; |
90 | | - } |
91 | | - } |
92 | | - return false; |
93 | | - } |
94 | 67 | } |
0 commit comments