-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add new OTEL Metrics source that creates events #4183
Conversation
Signed-off-by: Krishna Kondaka <[email protected]>
…ew events are created in the source Signed-off-by: Krishna Kondaka <[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.
Some minor comments. Can fix later if needed
final int bufferWriteTimeoutInMillis = | ||
(int) (oTelMetricsSourceConfig.getRequestTimeoutInMillis() * 0.8); |
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.
Doesn't look like this is used anywhere
Collection<Record<? extends Metric>> metrics; | ||
AtomicInteger droppedCounter = new AtomicInteger(0); | ||
|
||
OTelProtoCodec.OTelProtoDecoder oTelProtoDecoder = new OTelProtoCodec.OTelProtoDecoder(); |
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 looks like the decoder is passed through the constructor in the other sources. We could do the same in this class to avoid instantiating a new one for each request: https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/otel-trace-source/src/main/java/org/opensearch/dataprepper/plugins/source/oteltrace/OTelTraceGrpcService.java#L57
@@ -81,7 +78,12 @@ private void processRequest(final ExportMetricsServiceRequest request, final Str | |||
if (buffer.isByteBuffer()) { | |||
buffer.writeBytes(request.toByteArray(), null, bufferWriteTimeoutInMillis); | |||
} else { | |||
buffer.write(new Record<>(request), bufferWriteTimeoutInMillis); | |||
Collection<Record<? extends Metric>> metrics; | |||
AtomicInteger droppedCounter = new AtomicInteger(0); |
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.
Should we be emitting a metric for this or does the decoder already handle that?
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.
Added metrics.
@@ -935,12 +942,13 @@ void gRPC_with_auth_request_writes_to_buffer_with_successful_response() throws E | |||
final ExportMetricsServiceResponse exportResponse = client.export(createExportMetricsRequest()); | |||
assertThat(exportResponse, notNullValue()); | |||
|
|||
final ArgumentCaptor<Record<ExportMetricsServiceRequest>> bufferWriteArgumentCaptor = ArgumentCaptor.forClass(Record.class); | |||
verify(buffer).write(bufferWriteArgumentCaptor.capture(), anyInt()); | |||
//final ArgumentCaptor<Record<ExportMetricsServiceRequest>> bufferWriteArgumentCaptor = ArgumentCaptor.forClass(Record.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.
Extra comment here
@@ -40,7 +46,7 @@ public class OTelMetricsGrpcService extends MetricsServiceGrpc.MetricsServiceImp | |||
|
|||
|
|||
public OTelMetricsGrpcService(int bufferWriteTimeoutInMillis, | |||
Buffer<Record<ExportMetricsServiceRequest>> buffer, |
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 be sure to verify that the original source that uses ExportMetricsServiceRequest
is not affected by this change
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.
Original source is not there any more. We are replacing original source with this new behavior.
Signed-off-by: Krishna Kondaka <[email protected]>
Signed-off-by: Krishna Kondaka <[email protected]>
Description
Add new OTEL Metrics source that creates events
Added a new OTEL source that creates DataPrepper Events before putting them into buffer.
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
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.