Live Metrics Filtering: Part 1 of 5 - port filtering functionality#43040
Live Metrics Filtering: Part 1 of 5 - port filtering functionality#43040
Conversation
* move * markdown * check
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Show resolved
Hide resolved
...r/opentelemetry/autoconfigure/implementation/quickpulse/filtering/DependencyDataColumns.java
Outdated
Show resolved
Hide resolved
...r/opentelemetry/autoconfigure/implementation/quickpulse/filtering/DependencyDataColumns.java
Outdated
Show resolved
Hide resolved
|
API change check API changes are not detected in this pull request. |
...re/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/package-info.java
Show resolved
Hide resolved
...onitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/TelemetryColumns.java
Outdated
Show resolved
Hide resolved
.../opentelemetry/autoconfigure/implementation/quickpulse/filtering/KnownDependencyColumns.java
Show resolved
Hide resolved
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Outdated
Show resolved
Hide resolved
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Outdated
Show resolved
Hide resolved
jeanbisutti
left a comment
There was a problem hiding this comment.
Several classes seem to define a mapping between a column name and a colum value, and provide a way to retrieve the mapping value.
The code could be written in this way:
public class RequestDataColumns {
private static final Map<String, Object> mapping = new HashMap<>();
public RequestDataColumns(RequestData requestData) {
mapping.put(KnownRequestColumns.URL, requestData.getUrl());
...
}
public <T> T getValue(String fieldName, Class<T> type) {
return type.cast(mapping.get(fieldName)) ;
}
}To use this code:
String urlValue = requestDataColumns.getValue(KnownRequestColumns.URL, String.class);This code is less boilerplate (less else if branches). The disavantage is that it that it induces boxing in the constructor with primitive column types. How often objects such as RequestDataColumns would be created?
If KnownRequestColumns would be an enum and not a list of String constants, getValue would become:
public <T> T getValue(KnownRequestColumns fieldName, Class<T> type) {
return type.cast(mapping.get(fieldName)) ;
}So, you could not use getValue with any String / column type. The code would be less prone to programmatic mistakes.
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Outdated
Show resolved
Hide resolved
jeanbisutti
left a comment
There was a problem hiding this comment.
I have approved with some comments.
It would be great if you could address them in this PR or a follow up one.
As discussed, we may revisit this code later after other PRs are merged.
...onitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/CustomDimensions.java
Show resolved
Hide resolved
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Show resolved
Hide resolved
...om/azure/monitor/opentelemetry/autoconfigure/implementation/quickpulse/filtering/Filter.java
Show resolved
Hide resolved
I will merge for now and address comments in following PR - we can always go back and reflect on content from this PR when we need to. |
Description
This PR includes:
None of this new code is actually used in the QuickPulseDataCollector yet - that's for a future PR.
Spec: https://github.com/aep-health-and-standards/Telemetry-Collection-Spec/blob/main/ApplicationInsights/live-metrics-filtering.md
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines