-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Live Metrics Filtering Part 6: Error Tracker #43744
Open
harsimar
wants to merge
30
commits into
main
Choose a base branch
from
harskaur/errorTracker2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
4aa78d3
adding projection functionality, rethink automic double
harsimar bf15276
atomic double and some other changes
harsimar 4ace19d
merge from master to get p3 changes
harsimar 75718c7
pr comments and some build stuff
harsimar 27d4979
changing guava version
harsimar 619bb47
spotbug fix
harsimar 915d579
starting to add tests
harsimar 9c8fa37
added unit tests for derived metric projection
harsimar e3377d7
fix conflict from main
harsimar c599211
reorganize tests
harsimar a6ab936
fixing inconsistency with main re okio
harsimar 494a1b9
pr comments & small refactorings
harsimar 1351d2b
remove logging, spotless
harsimar a77adfe
validator
harsimar 68b9c83
minor
harsimar d80053e
changes to concurrency handling
harsimar f83c116
moving synchronization to derivedMetricAggregation
harsimar d8b618f
moving derivedMetricAggregation to its own file
harsimar 77f176a
merge projection into here
harsimar 96e705f
validator round 1 - need to refactor for validator to store errors
harsimar 6e81b55
finish implementation and starting to add tests
harsimar 568f059
merge from main
harsimar de6bd93
spotless
harsimar f492237
remove unused classes
harsimar 191783d
pr comments
harsimar c3c3c49
fix ci errors
harsimar 0ee6032
initial implementation
harsimar 73f4cc7
merge conflicts and starting to add some logging
harsimar 0c5aae9
logging and testing
harsimar f1ba015
restructure of error tracking in validator
harsimar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...r/opentelemetry/autoconfigure/implementation/quickpulse/filtering/ConfigErrorTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.filtering; | ||
|
||
import com.azure.core.util.logging.ClientLogger; | ||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.swagger.models.CollectionConfigurationError; | ||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.swagger.models.CollectionConfigurationErrorType; | ||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.swagger.models.KeyValuePairString; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ConfigErrorTracker { | ||
private final List<CollectionConfigurationError> errors = new ArrayList<>(); | ||
|
||
private static final ClientLogger LOGGER = new ClientLogger(ConfigErrorTracker.class); | ||
|
||
public void constructAndTrackCollectionConfigurationError(String message, String eTag, String id, | ||
boolean isDerivedMetricId) { | ||
CollectionConfigurationError error = new CollectionConfigurationError(); | ||
error.setMessage(message); | ||
error.setCollectionConfigurationErrorType(setErrorType(message)); | ||
|
||
KeyValuePairString keyValuePair1 = new KeyValuePairString(); | ||
keyValuePair1.setKey("ETag"); | ||
keyValuePair1.setValue(eTag); | ||
|
||
KeyValuePairString keyValuePair2 = new KeyValuePairString(); | ||
keyValuePair2.setKey(isDerivedMetricId ? "DerivedMetricInfoId" : "DocumentStreamInfoId"); | ||
keyValuePair2.setValue(id); | ||
|
||
List<KeyValuePairString> data = new ArrayList<>(); | ||
data.add(keyValuePair1); | ||
data.add(keyValuePair2); | ||
|
||
error.setData(data); | ||
|
||
errors.add(error); | ||
// This message gets logged once for every error we see on config validation. Config validation | ||
// only happens once per config change. | ||
LOGGER.verbose("{}. Due to this misconfiguration the {} rule with id {} will be ignored by the SDK.", message, | ||
isDerivedMetricId ? "derived metric" : "document filter conjunction", id); | ||
} | ||
|
||
private CollectionConfigurationErrorType setErrorType(String message) { | ||
if (message.contains("telemetry type")) { | ||
return CollectionConfigurationErrorType.METRIC_TELEMETRY_TYPE_UNSUPPORTED; | ||
} else if (message.contains("duplicate metric id")) { | ||
return CollectionConfigurationErrorType.METRIC_DUPLICATE_IDS; | ||
} | ||
return CollectionConfigurationErrorType.FILTER_FAILURE_TO_CREATE_UNEXPECTED; | ||
} | ||
|
||
public List<CollectionConfigurationError> getErrors() { | ||
return new ArrayList<CollectionConfigurationError>(errors); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,13 +2,15 @@ | |||||
// Licensed under the MIT License. | ||||||
package com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.filtering; | ||||||
|
||||||
import com.azure.core.util.logging.ClientLogger; | ||||||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.swagger.models.FilterInfo; | ||||||
|
||||||
import java.util.HashMap; | ||||||
import java.util.Map; | ||||||
|
||||||
public class CustomDimensions { | ||||||
private final Map<String, String> customDimensions; | ||||||
private static ClientLogger logger = new ClientLogger(CustomDimensions.class); | ||||||
|
||||||
public CustomDimensions(Map<String, String> customDimensions, Map<String, Double> customMeasurements) { | ||||||
Map<String, String> resultMap = new HashMap<>(); | ||||||
|
@@ -47,9 +49,13 @@ public double getCustomDimValueForProjection(String key) { | |||||
try { | ||||||
return Double.parseDouble(value); | ||||||
} catch (NumberFormatException e) { | ||||||
|
||||||
logger.verbose( | ||||||
"The value for the custom dimension could not be converted to a numeric value for a derived metric projection"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
return Double.NaN; | ||||||
} | ||||||
logger.verbose( | ||||||
"The custom dimension could not be found in this telemetry item when calculating a derived metric."); | ||||||
return Double.NaN; | ||||||
} | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ | |||||
|
||||||
package com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.filtering; | ||||||
|
||||||
import com.azure.core.util.logging.ClientLogger; | ||||||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.models.RemoteDependencyData; | ||||||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.quickpulse.swagger.models.FilterInfo; | ||||||
import com.azure.monitor.opentelemetry.autoconfigure.implementation.utils.FormattedDuration; | ||||||
|
@@ -15,17 +16,26 @@ public class DependencyDataColumns implements TelemetryColumns { | |||||
private final CustomDimensions customDims; | ||||||
private final Map<String, Object> mapping = new HashMap<>(); | ||||||
|
||||||
private static ClientLogger logger = new ClientLogger(DependencyDataColumns.class); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
public DependencyDataColumns(RemoteDependencyData rdData) { | ||||||
customDims = new CustomDimensions(rdData.getProperties(), rdData.getMeasurements()); | ||||||
mapping.put(KnownDependencyColumns.TARGET, rdData.getTarget()); | ||||||
mapping.put(KnownDependencyColumns.DURATION, | ||||||
FormattedDuration.getDurationFromTelemetryItemDurationString(rdData.getDuration())); | ||||||
|
||||||
long durationMicroSec = FormattedDuration.getDurationFromTelemetryItemDurationString(rdData.getDuration()); | ||||||
if (durationMicroSec == -1) { | ||||||
logger.verbose("The provided timestamp could not be converted to microseconds: {}", rdData.getDuration()); | ||||||
} | ||||||
mapping.put(KnownDependencyColumns.DURATION, durationMicroSec); | ||||||
|
||||||
mapping.put(KnownDependencyColumns.SUCCESS, rdData.isSuccess()); | ||||||
mapping.put(KnownDependencyColumns.NAME, rdData.getName()); | ||||||
int resultCode; | ||||||
try { | ||||||
resultCode = Integer.parseInt(rdData.getResultCode()); | ||||||
} catch (NumberFormatException e) { | ||||||
logger.verbose("The provided result code could not be converted to a numeric value: {}", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
rdData.getResultCode()); | ||||||
resultCode = -1; | ||||||
} | ||||||
mapping.put(KnownDependencyColumns.RESULT_CODE, resultCode); | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.