-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update SystemMetrics according to spec update #1705
Conversation
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
looks like |
.build() | ||
.setCallback( | ||
new Callback<LongResult>() { | ||
@Override | ||
public void update(LongResult r) { | ||
GlobalMemory mem = hal.getMemory(); | ||
r.observe(mem.getTotal() - mem.getAvailable(), Labels.of(TYPE_LABEL_KEY, "used")); | ||
r.observe(mem.getAvailable(), Labels.of(TYPE_LABEL_KEY, "free")); | ||
r.observe(mem.getTotal() - mem.getAvailable(), Labels.of("state", "used")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we create constants for all the labels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated for label keys
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
test updated |
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
@@ -19,7 +19,9 @@ | |||
|
|||
/** System Metrics Utility. */ | |||
public class SystemMetrics { | |||
private static final String TYPE_LABEL_KEY = "type"; | |||
private static final String DEVICE_LABEL_KEY = "device"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we do something like private static final Labels STATE_USED = Labels.of("state", "used")
? That way we don't have to create a labels object every time we record a value (at least I think that's what's happening right now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it will not work for Labels.of(DEVICE_LABEL_KEY, device, DIRECTION_LABEL_KEY, "transmit")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated for state labels
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Updated to spec changes: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/metrics/semantic_conventions/system-metrics.md