Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

java - Eliminate specific value from Jmx exporter through config Yaml

Here is the current Jmx exporter pattern:

pattern: 'metrics<name=resilience4jCircuitbreakerState.name.(.*).state.(.*), type=gauges><>Value'
name: 'x.y.z.resilience4j.circuitbreaker.state'
labels: {name: "$1", kind: "$2" }
type: GAUGE

Current Output:

x_y_z_resilience4j_circuitbreaker_state{kind="open",name="a",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="b",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="half_open",name="c",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="half_open",name="d",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="forced_open",name="e",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="disabled",name="f",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="disabled",name="g",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="forced_open",name="h",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="i",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="j",} 1.0

Which actually works fine. But to improve cardinality we decided not to expose 0.0 values modifying the Yml (if there is anyway).

The expected output for the above pieces of sample is,

x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="b",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="i",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="j",} 1.0

Please feel free to comment below.

question from:https://stackoverflow.com/questions/65623077/eliminate-specific-value-from-jmx-exporter-through-config-yaml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It looks like you have a 5 x_y_z__resilience4j_circuitbreaker_state metrics for every name, each with a different kind label, one with a value of 1.0 and the others with a value of 0.0.

In this case if you do not expose 0.0 and a circuitbreaker changes through all states all metrics will report 1.0.

To reduce cardinality, you should remove the kind label and set the value to a state.

Instead of this:

x_y_z__resilience4j_circuitbreaker_state{kind="disabled",name="a",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="a",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="open",name="a",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="half_open",name="a",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="forced_open",name="a",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="disabled",name="b",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="b",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="open",name="b",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="half_open",name="b",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="forced_open",name="b",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="disabled",name="c",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="closed",name="c",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="open",name="c",} 0.0
x_y_z__resilience4j_circuitbreaker_state{kind="half_open",name="c",} 1.0
x_y_z__resilience4j_circuitbreaker_state{kind="forced_open",name="c",} 0.0

You should report something like this:

x_y_z__resilience4j_circuitbreaker_state{name="a"} 1.0 # 1 represents "closed"
x_y_z__resilience4j_circuitbreaker_state{name="b"} 2.0 # 2 represents "open"
x_y_z__resilience4j_circuitbreaker_state{name="c"} 3.0 # 3 represents "half_open"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...