Skip to content

Commit e4b9fe5

Browse files
committed
restore '*' as wildcard + clarify quoting
1 parent 2698be3 commit e4b9fe5

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

instrumentation/jmx-metrics/javaagent/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ rules:
239239
connector_state:
240240
ok: STARTED
241241
failed: [STOPPED,FAILED]
242-
degraded: _
242+
degraded: '*'
243243
```
244244

245245
For a given value of `port`, let's say `8080` This will capture the `tomcat.connector.state` metric of type `updowncounter` with value `0` or `1` and the `state` metric attribute will have a value in [`ok`,`failed`,`degraded`].
@@ -265,21 +265,21 @@ For other values of `stateName`, we have:
265265

266266
Each state key can be mapped to one or more values of the MBean attribute using:
267267
- a string literal or a string array
268-
- a `_` character to provide default option and avoid enumerating all values.
268+
- a `*` character to provide default option and avoid enumerating all values, this value must be quoted in YAML
269269

270-
Exactly one `_` value must be present in the mapping to ensure all possible values of the MBean attribute can be mapped to a state key.
270+
Exactly one `*` value must be present in the mapping to ensure all possible values of the MBean attribute can be mapped to a state key.
271271

272-
The default value indicated by `_` does not require a dedicated state key. For example, if we want to have `connector_state` metric attribute with values `on` or `off`, we can use:
272+
The default value indicated by `*` does not require a dedicated state key. For example, if we want to have `connector_state` metric attribute with values `on` or `off`, we can use:
273273
```yaml
274274
connector_state:
275275
on: STARTED
276-
off: [STOPPED,FAILED,_]
276+
off: [STOPPED,FAILED,'*']
277277
```
278278
In the particular case where only two values are defined, we can simplify further by explicitly defining one state and rely on default for the other.
279279
```yaml
280280
connector_state:
281281
on: STARTED
282-
off: _
282+
off: '*'
283283
```
284284

285285
### General Syntax

instrumentation/jmx-metrics/library/src/main/java/io/opentelemetry/instrumentation/jmx/yaml/MetricStructure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract class MetricStructure {
4444

4545
private Map<String, Object> metricAttribute;
4646
private StateMapping stateMapping = StateMapping.empty();
47-
private static final String STATE_MAPPING_DEFAULT = "_";
47+
private static final String STATE_MAPPING_DEFAULT = "*";
4848
private String unit;
4949

5050
private MetricInfo.Type metricType;

instrumentation/jmx-metrics/library/src/test/java/io/opentelemetry/instrumentation/jmx/engine/RuleParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void testConf8() throws Exception {
373373
+ " state_attribute: \n" // --> only one state attribute allowed
374374
+ " ok: STARTED\n" // as simple string
375375
+ " failed: [STOPPED,FAILED]\n" // as array of strings
376-
+ " degraded: _\n" // degraded value for default
376+
+ " degraded: '*'\n" // degraded value for default
377377
+ "";
378378

379379
@Test

0 commit comments

Comments
 (0)