Skip to content
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

Merged
merged 5 commits into from
Nov 20, 2020

Conversation

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@trask
Copy link
Member

trask commented Nov 20, 2020

looks like SystemMetricsTest needs to be updated

.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"));
Copy link
Contributor

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?

Copy link
Contributor Author

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>
@malafeev
Copy link
Contributor Author

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";
Copy link
Contributor

@anuraaga anuraaga Nov 20, 2020

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)

Copy link
Contributor Author

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")

Copy link
Contributor Author

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>
@trask trask merged commit f0feefc into open-telemetry:master Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants