Skip to content

High Resolution Metrics Support #129

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

Merged
merged 21 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public void putMetric(String key, double value, Unit unit, StorageResolution sto
throws InvalidMetricException {
Validator.validateMetric(key, value, unit, storageResolution, metricNameAndResolutionMap);
metricDirective.putMetric(key, value, unit, storageResolution);
if (!metricNameAndResolutionMap.containsKey(key)) {
metricNameAndResolutionMap.put(key, storageResolution);
}
}
/**
* Add a metric measurement to the context with a storage resolution but without a unit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,12 @@ public static void validateMetric(
throw new InvalidMetricException("Metric resolution is invalid");
}

if (metricNameAndResolutionMap.containsKey(name)) {
if (!metricNameAndResolutionMap.get(name).equals(storageResolution)) {
throw new InvalidMetricException(
"Resolution for metric "
+ name
+ " is already set. A single log event cannot have a metric with two different resolutions.");
}
} else {
metricNameAndResolutionMap.put(name, storageResolution);
if ((metricNameAndResolutionMap.containsKey(name))
&& (!metricNameAndResolutionMap.get(name).equals(storageResolution))) {
throw new InvalidMetricException(
"Resolution for metric "
+ name
+ " is already set. A single log event cannot have a metric with two different resolutions.");
}
}

Expand Down