-
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
base: main
Are you sure you want to change the base?
Conversation
API change check API changes are not detected in this pull request. |
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.
It seems that the Validator
class has 2 different responsabilities:
- Validate incoming data
- Track errors, example:
Line 137 in 0c5aae9
validator.constructAndTrackCollectionConfigurationError(
Classes with one responsability are easier to understand and maintain.
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); |
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.
private static ClientLogger logger = new ClientLogger(CustomDimensions.class); | |
private static final ClientLogger logger = new ClientLogger(CustomDimensions.class); |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
"The value for the custom dimension could not be converted to a numeric value for a derived metric projection"); | |
value + " for the custom dimension could not be converted to a numeric value for a derived metric projection"); |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
private static ClientLogger logger = new ClientLogger(DependencyDataColumns.class); | |
private static final ClientLogger logger = new ClientLogger(DependencyDataColumns.class); |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
logger.verbose("The provided result code could not be converted to a numeric value: {}", | |
logger.verbose(rdData.getResultCode() + " result code could not be converted to a numeric value: {}", |
|
||
long durationMicroSec = FormattedDuration.getDurationFromTelemetryItemDurationString(requestData.getDuration()); | ||
if (durationMicroSec == -1) { | ||
logger.verbose("The provided timestamp could not be converted to microseconds: {}", |
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.
logger.verbose("The provided timestamp could not be converted to microseconds: {}", | |
logger.verbose(requestData.getDuration() + " provided timestamp could not be converted to microseconds: {}", |
mapping.put(KnownRequestColumns.NAME, requestData.getName()); | ||
int responseCode; | ||
try { | ||
responseCode = Integer.parseInt(requestData.getResponseCode()); | ||
} catch (NumberFormatException e) { | ||
responseCode = -1; | ||
logger.verbose("The provided response code could not be converted to a numeric value: {}", |
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.
logger.verbose("The provided response code could not be converted to a numeric value: {}", | |
logger.verbose(requestData.getResponseCode() + " provided response code could not be converted to a numeric value: {}", |
Description
When parsing a new filtering configuration, this PR will also track configuration errors. Configuration errors are logged to applicationinsights.log at every config change. In addition, configuration errors are sent as a part of the post request body for as long as the faulty configuration is being used.
There is also some verbose level logging added for debug purposes.
Manual testing was done in addition to some modifications to existing tests.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines