feat(otlp-sink): Add OTLP sink plugin for exporting spans to AWS X-Ray#5664
feat(otlp-sink): Add OTLP sink plugin for exporting spans to AWS X-Ray#5664dlvenable merged 24 commits intoopensearch-project:mainfrom
Conversation
* feat(xray-otlp-sink): Add X-Ray OTLP Sink plugin skeleton - Added test resources and support for Span records - Added sample pipeline config and OTLP test span JSON under `src/test/resources` - Verified local pipeline ingest and logging using `grpcurl` - Added README with developer instructions for running and testing locally These changes establish the foundation for local testing and future X-Ray e2e testing. Signed-off-by: huy pham <huyp@amazon.com>
Signed-off-by: huy pham <huyp@amazon.com>
KarstenSchnitter
left a comment
There was a problem hiding this comment.
Let's have a discussion in the minimal feature set. I am missing mTLS and gRPC support. I will do a more thorough review of this PR next week.
dlvenable
left a comment
There was a problem hiding this comment.
Thank you @huypham612 for this contribution!
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Outdated
Show resolved
Hide resolved
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I support @dlvenable suggestion to use another http client. I also suggest to be more distinctive on the error metrics, so we can distinguish message drops because of processing errors from those rejected by the target. Please also have a look at the retry-after header as described here: https://opentelemetry.io/docs/specs/otlp/#otlphttp-throttling
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Outdated
Show resolved
Hide resolved
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Show resolved
Hide resolved
...otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/ThreadSleeper.java
Outdated
Show resolved
Hide resolved
...sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/metrics/OtlpSinkMetrics.java
Show resolved
Hide resolved
|
Thank you for your feedback @dlvenable and @KarstenSchnitter, I will go through them and revise the code accordingly. |
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Outdated
Show resolved
Hide resolved
...java/org/opensearch/dataprepper/plugins/sink/otlp/configuration/AwsAuthenticationConfig.java
Outdated
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Outdated
Show resolved
Hide resolved
Thank you, I will address this comment and update the code to handle this header. Good catch. |
|
Hi @dlvenable, @KarstenSchnitter, and @kkondaka, I've pushed the updated changes based on the feedback. Here’s a summary of the key updates:
Note: I evaluated using the Retry-After header for dynamic backoff, but decided against it due to the following trade-offs:
Please take another look when you have time — thank you! |
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Show resolved
Hide resolved
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Outdated
Show resolved
Hide resolved
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Show resolved
Hide resolved
...src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/configuration/OtlpSinkConfig.java
Show resolved
Hide resolved
...s/otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/SigV4Signer.java
Show resolved
Hide resolved
...s/otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/SigV4Signer.java
Outdated
Show resolved
Hide resolved
...s/otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/SigV4Signer.java
Show resolved
Hide resolved
...tlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/http/OtlpHttpSender.java
Show resolved
Hide resolved
...r-plugins/otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/OtlpSink.java
Show resolved
Hide resolved
...p-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/buffer/OtlpSinkBuffer.java
Show resolved
Hide resolved
...r-plugins/otlp-sink/src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/OtlpSink.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/opensearch/dataprepper/plugins/sink/otlp/configuration/OtlpSinkConfig.java
Outdated
Show resolved
Hide resolved
Signed-off-by: huy pham <huyp@amazon.com>
- Introduce `ThresholdConfig` with `max_events`, `max_batch_size`, and `flush_timeout` - Implement `OtlpSinkBuffer` using a bounded `LinkedBlockingQueue` driven by threshold settings - Enhance `OtlpSinkMetrics` to register queue gauges and cover new payload/latency metrics - Update README with configuration options and note on AWS region derivation - Add comprehensive unit tests for config, buffer, metrics, and HTTP sender - Removed unused integ test package and resources Signed-off-by: huy pham <huyp@amazon.com>
- Changed logic to get the aws region value from the provided endpoint. Signed-off-by: huy pham <huyp@amazon.com>
- Retries on 429, 502, 503, and 504 per OTEL spec. Logs other errors without retry. - See: https://opentelemetry.io/docs/specs/otlp/exporter/#retrying-on-failure Signed-off-by: huy pham <huyp@amazon.com>
- removed log.info statements - Add description to exception Signed-off-by: huy pham <huyp@amazon.com>
- Updated worker loop to retry on interrupt until queue is empty - Avoid logging error on expected shutdown interrupt - test: Added unit tests to verify final flush Signed-off-by: huy pham <huyp@amazon.com>
- Removed unused metrics Signed-off-by: huy pham <huyp@amazon.com>
Signed-off-by: huy pham <huyp@amazon.com>
…ments Signed-off-by: huy pham <huyp@amazon.com>
…ialsSupplier. Signed-off-by: huy pham <huyp@amazon.com>
- Updated README - Fixed init bug - Performed e2e and perf tests Signed-off-by: huy pham <huyp@amazon.com>
Signed-off-by: huy pham <huyp@amazon.com>
7a9bebc to
bb4ffb0
Compare
| } | ||
|
|
||
| // Defensive copy to avoid ConcurrentModificationException | ||
| final List<Pair<ResourceSpans, EventHandle>> immutableBatch = List.copyOf(batch); |
There was a problem hiding this comment.
Usually, we use synchronization (using locks) to avoid concurrent modification. Not sure if making a copy is the best way to handle this. What do you think @dlvenable ?
There was a problem hiding this comment.
I'm thinking because Armeria is async, the List.copyOf ensures immutability without locking overhead. Given the typical batch size is small (1MB, even up to 5MB), this is a practical tradeoff for correctness and performance in a trace sink.
There was a problem hiding this comment.
This is a shallow copy. So we are just copying the list. The underlying ResourceSpans and EventHandle objects are not copied.
Signed-off-by: huy pham <huyp@amazon.com>
Signed-off-by: huy pham <huyp@amazon.com>
…entials Signed-off-by: huy pham <huyp@amazon.com>
dlvenable
left a comment
There was a problem hiding this comment.
Thank you @huypham612 for this great new feature!
…ject#5664) Add OTLP sink plugin for exporting spans to AWS X-Ray (opensearch-project#5664) Feature/xray init feat(xray-otlp-sink): Add X-Ray OTLP Sink plugin skeleton - Added test resources and support for Span records - Added sample pipeline config and OTLP test span JSON under `src/test/resources` - Verified local pipeline ingest and logging using `grpcurl` - Added README with developer instructions for running and testing locally These changes establish the foundation for local testing and future X-Ray e2e testing. Signed-off-by: huy pham <huyp@amazon.com> Signed-off-by: Heli <desaiheli17@gmail.com> Co-authored-by: Heli <desaiheli17@gmail.com> Signed-off-by: Jeffrey Aaron Jeyasingh <jeffreyaaron06@gmail.com>
Description
This PR introduces a new otlp sink plugin for Data Prepper that supports exporting OpenTelemetry spans to AWS X-Ray over HTTP using OTLP.
Key features:
Issues Resolved
Resolves #5663
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.