-
Notifications
You must be signed in to change notification settings - Fork 277
Otel logs source http service #6250
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
base: main
Are you sure you want to change the base?
Otel logs source http service #6250
Conversation
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
Signed-off-by: Tomas Longo <[email protected]>
KarstenSchnitter
left a comment
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.
Just a start of a review. Can you check the tests for unused imports. This is failing the CI builds. I need more time for the review. Please expect more comments to come.
| // no path provided. Will be set by config. | ||
| @Post("") | ||
| @Consumes(value = "application/json") | ||
| public ExportTraceServiceResponse exportLog(ExportLogsServiceRequest 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.
Why is this returning ExportTraceServiceResponse? Shouldn't this return a ExportLogServiceResponse?
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.
Right. I copied the Http-Service from the Trace-Source. This is the remnant from it. Fix is pushed.
Signed-off-by: Tomas Longo <[email protected]>
3cf2c0f to
1dd14dd
Compare
Signed-off-by: Tomas Longo <[email protected]>
1dd14dd to
965b93d
Compare
KarstenSchnitter
left a comment
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 already have some comments. I still need to review the tests.
| try { | ||
| logs = oTelProtoDecoder.parseExportLogsServiceRequest(request, Instant.now()); | ||
| } catch (Exception e) { | ||
| LOG.error("Failed to parse the request {} due to:", request, e); |
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 use warning level and sensitive request marker.
| LOG.error("Failed to parse the request {} due to:", request, e); | |
| LOG.warn(DataPrepperMarkers.SENSITIVE, "Failed to parse request with error '{}'. Request body: {}.", e.getMessage(), 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.
done.
Is this a general rule? Use WARN-level with SENSITIVE-Marker for errors?
Is there any documentation on how to logging should be done in DataPrepper? Could not find any in the README
| throw new BadRequestException(e.getMessage(), e); | ||
| } | ||
|
|
||
| final List<Record<Object>> records = logs.stream().map(log -> new Record<Object>(log)).collect(Collectors.toList()); |
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.
These records are only required in the else block of the following condition. Please move this operation to this block.
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.
done
...-source/src/main/java/org/opensearch/dataprepper/plugins/source/otellogs/OTelLogsSource.java
Show resolved
Hide resolved
|
|
||
| if (oTelLogsSourceConfig.hasHealthCheck()) { | ||
| LOG.info("HTTP source health check is enabled"); | ||
| serverBuilder.service("/health", HealthCheckService.builder().longPolling(0).build()); |
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 extract the String to a constant.
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.
done
| serverBuilder.maxRequestLength(oTelLogsSourceConfig.getMaxRequestLength().getBytes()); | ||
| } | ||
| final int threadCount = oTelLogsSourceConfig.getThreadCount(); | ||
| serverBuilder.blockingTaskExecutor(new ScheduledThreadPoolExecutor(threadCount), true); |
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 use the same logic as in CreateServer to configure the task executor.
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.
done.
Signed-off-by: Tomas Longo <[email protected]>
e05da93 to
656475c
Compare
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 looks good so far. I would like to see an end-to-end test with OTLP/HTTP if possible. Can you add it? Please promote this PR to ready for review.
@TomasLongo please also fix the unused imports in the tests that lead to the failing Gradle builds.
|
Yes. I'll add an E2E Test. |
Signed-off-by: Tomas Longo <[email protected]>
f6c5b40 to
5f2aeb3
Compare
Description
This PR adds an HTTP-Service to the OtelLogsSource, which runs alongside the gRPC-Service under a separate endpoint.
Both Services share the same underlying Armeria-Server, running under the same port.
Breakdown
The PR is kind of heavy. The OtelLogsSource had to be restructured resulting in the refactoring of the present tests.
A quick breakdown of the changes will certainly help with the review
One Server, two services
OtelLogsSourceis now inhabitetd by two services running under different paths behind the same port.The path of the services can be configured by the two fields
pathandhttp_pathpathis the already present field for configuring path of the grpc service and keeps its purposehttp_pathwill set the path for the new http serviceUnframed Requests
Since unframed requests served the purpose of sending plain
httprequests to the grpc server, this functionality has been dropped. However, for backwardscompatibilty of the config, it is still present in the config data structure.CreateServer
The class
CreateServerdeals with creating both, http and gRPC servers. However, in its current form, the intended use is to create a server with a single service. Two quick attempts to rewrite the Class for the purpose if this PR yielded no results.So the final version of the server creation loosely resembles the functionality found in
CreateServer.Refactoring of tests
Many tests were making sure that the former gRPC server, with unframed requests enabled, would handle http requests correctly. I have dropped this tests completely, replacing them with a separate test class that handles tests regarding the http functionality. I added a few improvements along the way like
Decisions made and additional considerations
Getting completely rid of unframed requests
enable_unframed_requestshas no effect any more, since its purpose has been replaced with the new http serviceConfiguration
A new field,
http_pathhas been added to specify the path of the http service. However, one could extend the config toCreateServer
I think that the intention of
CreateServer, to provide a unified mechanism to bootstrap armeria servers, is absolutely the right thing todo. However, in its current form, it only supports creating servers with a single service.It's worth thinking about how to refactor
CreateServerto streamline server creation for future plugins. The challenge I encountered was how to best model the fact, that different services might need different server capabilities/configurations.Figuring this out, would have gone well beyond the scope of this PR.
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.