-
Notifications
You must be signed in to change notification settings - Fork 207
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
MAINT: add OTelTraceGroupProcessor from trace ingestion migration branch #1224
MAINT: add OTelTraceGroupProcessor from trace ingestion migration branch #1224
Conversation
Signed-off-by: Qi Chen <[email protected]>
Signed-off-by: Qi Chen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1224 +/- ##
=========================================
Coverage 93.79% 93.79%
Complexity 1104 1104
=========================================
Files 153 153
Lines 3064 3064
Branches 257 257
=========================================
Hits 2874 2874
Misses 138 138
Partials 52 52 Continue to review full report at Codecov.
|
Signed-off-by: Qi Chen <[email protected]>
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.
Thanks for migrating to the processor interface. I have a comment for updating the documentation.
@@ -0,0 +1,67 @@ | |||
# OTel Trace Group Processor | |||
|
|||
This is a processor that fills in the missing trace group related fields in the collection of [Span](../../data-prepper-api/src/main/java/com/amazon/dataprepper/model/trace/Span.java) records output by [otel-trace-raw-processor](../otel-trace-raw-processor) and then convert them back into a new collection of string records. |
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.
... and then convert them back into a new collection of string records.
<- This is no longer accurate and we should be able to remove it.
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.
Great catch!
try (MockedStatic<ConnectionConfiguration> connectionConfigurationMockedStatic = Mockito.mockStatic(ConnectionConfiguration.class)) { | ||
connectionConfigurationMockedStatic.when(() -> ConnectionConfiguration.readConnectionConfiguration(any(PluginSetting.class))) | ||
.thenReturn(connectionConfigurationMock); | ||
PluginSetting testPluginSetting = new PluginSetting("otel_trace_group_prepper", new HashMap<>()); |
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.
Please update this to new PluginSetting("otel_trace_group_processor",, new HashMap<>());
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.
Great catch!
|
||
@Test | ||
public void testTraceGroupFillFailDueToFailedRequest() throws IOException { | ||
// Arrange |
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.
I like how you've separated the functionality within each test case!
Signed-off-by: Qi Chen <[email protected]>
pipeline: | ||
... | ||
processor: | ||
- otel-trace-group-processor: |
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.
This should be using underscores, right?
pipeline: | ||
... | ||
processor: | ||
- otel-trace-group: |
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.
This should be using underscores, right?
pipeline: | ||
... | ||
processor: | ||
- otel-trace-group-processor: |
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.
Also, there is no _processor
suffix, right?
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.
Thanks for the catch.
@@ -0,0 +1,67 @@ | |||
# OTel Trace Group Processor | |||
|
|||
This is a processor that fills in the missing trace group related fields in the collection of [Span](../../data-prepper-api/src/main/java/com/amazon/dataprepper/model/trace/Span.java) records output by [otel-trace-raw-processor](../otel-trace-raw-processor). |
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 name here also should use underscores.
final String traceId = traceIdDocField.getValue(); | ||
final String traceGroupName = traceGroupNameDocField.getValue(); | ||
// Restore trailing zeros for thousand, e.g. 2020-08-20T05:40:46.0895568Z -> 2020-08-20T05:40:46.089556800Z | ||
final String traceGroupEndTime = Instant.parse(traceGroupEndTimeDocField.getValue()).toString(); |
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.
Rather than add an inline comment (which is prone to being lost over time), I suggest you make this a function.
Perhaps:
/**
* Restores trailing zeros for thousand, e.g. 2020-08-20T05:40:46.0895568Z -> 2020-08-20T05:40:46.089556800Z
*/
private String normalizeDateTime(String dateTimeString) {
return Instant.parse(dateTimeString).toString();
}
Signed-off-by: Qi Chen <[email protected]>
Signed-off-by: Qi Chen <[email protected]>
Signed-off-by: Qi Chen [email protected]
Description
This PR adds in otel-trace-group-processor which is otel-trace-group-prepper in https://github.com/opensearch-project/data-prepper/tree/maint/546-migrate-trace-analytics-to-event-model.
Beside renaming plugins, some cleanups are essential:
Issues Resolved
Contributes to #1158
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.