|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: OTLP source |
| 4 | +parent: Sources |
| 5 | +grand_parent: Pipelines |
| 6 | +nav_order: 85 |
| 7 | +--- |
| 8 | + |
| 9 | +# OTLP source |
| 10 | + |
| 11 | +The `otlp` source is a unified OpenTelemetry source that follows the [OpenTelemetry Protocol (OTLP) specification](https://opentelemetry.io/docs/specs/otlp/) and can receive logs, metrics, and traces through a single endpoint. This source consolidates the functionality of the individual `otel_logs_source`, `otel_metrics_source`, and `otel_trace_source` sources, providing a streamlined approach to ingesting all OpenTelemetry telemetry signals. |
| 12 | + |
| 13 | +The `otlp` source supports both the `OTLP/gRPC` and `OTLP/HTTP` protocols. For `OTLP/HTTP`, only Protobuf encoding is supported. This makes it compatible with a wide range of OpenTelemetry collectors and instrumentation libraries. |
| 14 | +{: .note} |
| 15 | + |
| 16 | +## Configuration |
| 17 | + |
| 18 | +You can configure the `otlp` source with the following options. |
| 19 | + |
| 20 | +| Option | Type | Description | |
| 21 | +| :--- | :--- | :--- | |
| 22 | +| `port` | Integer | The port on which the `otlp` source listens. Default is `21893`. | |
| 23 | +| `logs_path` | String | The path for sending unframed HTTP requests for logs. Must start with `/` and have a minimum length of 1. Default is `/opentelemetry.proto.collector.logs.v1.LogsService/Export`. | |
| 24 | +| `metrics_path` | String | The path for sending unframed HTTP requests for metrics. Must start with `/` and have a minimum length of 1. Default is `/opentelemetry.proto.collector.metrics.v1.MetricsService/Export`. | |
| 25 | +| `traces_path` | String | The path for sending unframed HTTP requests for traces. Must start with `/` and have a minimum length of 1. Default is `/opentelemetry.proto.collector.trace.v1.TraceService/Export`. | |
| 26 | +| `request_timeout` | Duration | The request timeout duration. Default is `10s`. | |
| 27 | +| `retry_info` | Object | Configures retry behavior. Supports `min_delay` (default `100ms`) and `max_delay` (default `2s`) parameters to control exponential backoff. See [Retry information](#retry-information).| |
| 28 | +| `health_check_service` | Boolean | Enables a gRPC health check service under `grpc.health.v1.Health/Check`. When `unframed_requests` is `true`, enables HTTP health check at `/health`. Default is `false`. | |
| 29 | +| `proto_reflection_service` | Boolean | Enables a reflection service for Protobuf services (see [ProtoReflectionService](https://grpc.github.io/grpc-java/javadoc/io/grpc/protobuf/services/ProtoReflectionService.html) and [gRPC reflection](https://github.com/grpc/grpc-java/blob/master/documentation/server-reflection-tutorial.md)). Default is `false`. | |
| 30 | +| `unframed_requests` | Boolean | Enables requests not framed using the gRPC wire protocol. Default is `false`. | |
| 31 | +| `thread_count` | Integer | The number of threads to keep in the scheduled thread pool. Default is `200`. | |
| 32 | +| `max_connection_count` | Integer | The maximum allowed number of open connections. Default is `500`. | |
| 33 | +| `max_request_length` | String | The maximum number of bytes allowed in the payload of a single gRPC or HTTP request. Default is `10mb`. | |
| 34 | +| `compression` | String | The compression type applied to the client request payload. Valid values are `none` (no compression) or `gzip` (apply `gzip` decompression). Default is `none`. | |
| 35 | +| `output_format` | String | Specifies the decoded output format for all signals (logs, metrics, and traces) if individual output format options are not set. Valid values are `otel` (OpenTelemetry format) and `opensearch` (OpenSearch format). Default is `otel`. | |
| 36 | +| `logs_output_format` | String | Specifies the decoded output format specifically for logs. Takes precedence over `output_format` for logs. Valid values are `otel` and `opensearch`. Default is `otel`. | |
| 37 | +| `metrics_output_format` | String | Specifies the decoded output format specifically for metrics. Takes precedence over `output_format` for metrics. Valid values are `otel` and `opensearch`. Default is `otel`. | |
| 38 | +| `traces_output_format` | String | Specifies the decoded output format specifically for traces. Takes precedence over `output_format` for traces. Valid values are `otel` and `opensearch`. Default is `otel`. | |
| 39 | + |
| 40 | +If an individual output format (for example, `logs_output_format`) is set, it takes precedence over the generic `output_format` for that signal type. If neither is set, the default is `otel`. |
| 41 | +{: .note} |
| 42 | + |
| 43 | +### SSL/TLS configuration |
| 44 | + |
| 45 | +You can configure SSL/TLS in the `otlp` source with the following options. |
| 46 | + |
| 47 | +| Option | Type | Description | |
| 48 | +| :--- | :--- | :--- | |
| 49 | +| `ssl` | Boolean | Enables SSL/TLS. Default is `true`. | |
| 50 | +| `ssl_certificate_file` | String | The SSL certificate chain file path or Amazon Simple Storage Service (Amazon S3) path (for example, `s3://<bucketName>/<path>`). Required if `ssl` is set to `true`. | |
| 51 | +| `ssl_key_file` | String | The SSL key file path or Amazon S3 path (for example, `s3://<bucketName>/<path>`). Required if `ssl` is set to `true`. | |
| 52 | +| `use_acm_cert_for_ssl` | Boolean | Enables SSL/TLS using a certificate and private key from AWS Certificate Manager (ACM). Default is `false`. | |
| 53 | +| `acm_certificate_arn` | String | The ACM certificate Amazon Resource Name (ARN). ACM certificates take precedence over Amazon S3 or local file system certificates. Required if `use_acm_cert_for_ssl` is set to `true`. | |
| 54 | +| `acm_private_key_password` | String | The ACM private key password that decrypts the private key. If not provided, OpenSearch Data Prepper uses the private key unencrypted. | |
| 55 | +| `aws_region` | String | The AWS Region used by ACM or Amazon S3. Required if `use_acm_cert_for_ssl` is set to `true` or if `ssl_certificate_file` and `ssl_key_file` are Amazon S3 paths. | |
| 56 | + |
| 57 | +### Authentication configuration |
| 58 | + |
| 59 | +By default, the `otlp` source runs without authentication. You can configure authentication using the following options. |
| 60 | + |
| 61 | +To explicitly disable authentication, specify the following settings: |
| 62 | + |
| 63 | +```yaml |
| 64 | +source: |
| 65 | + otlp: |
| 66 | + authentication: |
| 67 | + unauthenticated: |
| 68 | +``` |
| 69 | +{% include copy.html %} |
| 70 | +
|
| 71 | +To enable HTTP Basic authentication, specify the following settings: |
| 72 | +
|
| 73 | +```yaml |
| 74 | +source: |
| 75 | + otlp: |
| 76 | + authentication: |
| 77 | + http_basic: |
| 78 | + username: my-user |
| 79 | + password: my_s3cr3t |
| 80 | +``` |
| 81 | +{% include copy.html %} |
| 82 | +
|
| 83 | +This plugin uses pluggable authentication for gRPC servers. To provide custom authentication, create a plugin that implements [`GrpcAuthenticationProvider`](https://github.com/opensearch-project/data-prepper/blob/main/data-prepper-plugins/armeria-common/src/main/java/org/opensearch/dataprepper/armeria/authentication/GrpcAuthenticationProvider.java). |
| 84 | + |
| 85 | +### Retry information |
| 86 | + |
| 87 | +You can set retry behavior using the `retry_info` setting, specifying how long to wait for the next request when backpressure occurs. The retry mechanism applies exponential backoff with a configurable maximum delay: |
| 88 | + |
| 89 | +```yaml |
| 90 | +source: |
| 91 | + otlp: |
| 92 | + retry_info: |
| 93 | + min_delay: 100ms # defaults to 100ms |
| 94 | + max_delay: 2s # defaults to 2s |
| 95 | +``` |
| 96 | +{% include copy.html %} |
| 97 | + |
| 98 | +## Usage |
| 99 | + |
| 100 | +The following examples demonstrate how to configure and use the `otlp` source in various scenarios. |
| 101 | + |
| 102 | +### Basic configuration |
| 103 | + |
| 104 | +To get started with the `otlp` source, create a `pipeline.yaml` file with the following minimal configuration: |
| 105 | + |
| 106 | +```yaml |
| 107 | +pipeline: |
| 108 | + source: |
| 109 | + otlp: |
| 110 | + ssl: false |
| 111 | + sink: |
| 112 | + - stdout: |
| 113 | +``` |
| 114 | +{% include copy.html %} |
| 115 | + |
| 116 | +### Routing telemetry signals |
| 117 | + |
| 118 | +One of the key features of the `otlp` source is its ability to route different telemetry signals (logs, metrics, and traces) to different processors or sinks based on your specific needs. Routing is determined by metadata using the `getEventType()` function: |
| 119 | + |
| 120 | +```yaml |
| 121 | +version: "2" |
| 122 | +otel-telemetry: |
| 123 | + source: |
| 124 | + otlp: |
| 125 | + ssl: false |
| 126 | + route: |
| 127 | + - traces: 'getEventType() == "TRACE"' |
| 128 | + - logs: 'getEventType() == "LOG"' |
| 129 | + - metrics: 'getEventType() == "METRIC"' |
| 130 | + sink: |
| 131 | + - opensearch: |
| 132 | + routes: |
| 133 | + - logs |
| 134 | + hosts: [ "https://opensearch:9200" ] |
| 135 | + index: logs-%{yyyy.MM.dd} |
| 136 | + username: admin |
| 137 | + password: yourStrongPassword123! |
| 138 | + insecure: true |
| 139 | + - pipeline: |
| 140 | + name: traces-raw |
| 141 | + routes: |
| 142 | + - traces |
| 143 | + - pipeline: |
| 144 | + name: otel-metrics |
| 145 | + routes: |
| 146 | + - metrics |
| 147 | +
|
| 148 | +traces-raw: |
| 149 | + source: |
| 150 | + pipeline: |
| 151 | + name: otel-telemetry |
| 152 | + processor: |
| 153 | + - otel_trace_raw: |
| 154 | + sink: |
| 155 | + - opensearch: |
| 156 | + hosts: [ "https://opensearch:9200" ] |
| 157 | + index_type: trace-analytics-raw |
| 158 | + username: admin |
| 159 | + password: yourStrongPassword123! |
| 160 | + insecure: true |
| 161 | +
|
| 162 | +otel-metrics: |
| 163 | + source: |
| 164 | + pipeline: |
| 165 | + name: otel-telemetry |
| 166 | + processor: |
| 167 | + - otel_metrics: |
| 168 | + calculate_histogram_buckets: true |
| 169 | + calculate_exponential_histogram_buckets: true |
| 170 | + exponential_histogram_max_allowed_scale: 10 |
| 171 | + flatten_attributes: false |
| 172 | + sink: |
| 173 | + - opensearch: |
| 174 | + hosts: [ "https://opensearch:9200" ] |
| 175 | + index: metrics-otel-%{yyyy.MM.dd} |
| 176 | + username: admin |
| 177 | + password: yourStrongPassword123! |
| 178 | + insecure: true |
| 179 | +``` |
| 180 | +{% include copy.html %} |
| 181 | + |
| 182 | +### Using OpenSearch output format |
| 183 | + |
| 184 | +To generate data in the OpenSearch format for all telemetry signals, specify the following settings: |
| 185 | + |
| 186 | +```yaml |
| 187 | +source: |
| 188 | + otlp: |
| 189 | + output_format: opensearch |
| 190 | +``` |
| 191 | +{% include copy.html %} |
| 192 | + |
| 193 | +To use different output formats for different signal types, specify the following settings: |
| 194 | + |
| 195 | +```yaml |
| 196 | +source: |
| 197 | + otlp: |
| 198 | + logs_output_format: opensearch |
| 199 | + metrics_output_format: otel |
| 200 | + traces_output_format: opensearch |
| 201 | +``` |
| 202 | +{% include copy.html %} |
| 203 | + |
| 204 | +### Configuring with SSL/TLS |
| 205 | + |
| 206 | +To enable SSL/TLS with local certificates, specify the following settings: |
| 207 | + |
| 208 | +```yaml |
| 209 | +source: |
| 210 | + otlp: |
| 211 | + ssl: true |
| 212 | + ssl_certificate_file: "/path/to/certificate.crt" |
| 213 | + ssl_key_file: "/path/to/private-key.key" |
| 214 | +``` |
| 215 | +{% include copy.html %} |
| 216 | + |
| 217 | +To use the ACM, specify the following settings: |
| 218 | + |
| 219 | +```yaml |
| 220 | +source: |
| 221 | + otlp: |
| 222 | + ssl: true |
| 223 | + use_acm_cert_for_ssl: true |
| 224 | + acm_certificate_arn: "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012" |
| 225 | + aws_region: "us-east-1" |
| 226 | +``` |
| 227 | +{% include copy.html %} |
| 228 | + |
| 229 | +## Metrics |
| 230 | + |
| 231 | +The `otlp` source includes the following metrics for monitoring its performance and health. |
| 232 | + |
| 233 | +### Counters |
| 234 | + |
| 235 | +The following counters track request activity and errors in the `otlp` source. |
| 236 | + |
| 237 | +| Metric | Description | |
| 238 | +| :--- | :--- | |
| 239 | +| `requestTimeouts` | The total number of requests that timed out. | |
| 240 | +| `requestsReceived` | The total number of requests received by the `otlp` source. | |
| 241 | +| `successRequests` | The total number of requests successfully processed by the `otlp` source. | |
| 242 | +| `badRequests` | The total number of requests with an invalid format processed by the `otlp` source. | |
| 243 | +| `requestsTooLarge` | The total number of requests that exceed the maximum allowed size. | |
| 244 | +| `internalServerError` | The total number of requests processed by the `otlp` source with custom exception types. | |
| 245 | + |
| 246 | +### Timers |
| 247 | + |
| 248 | +The following timers track request activity and errors in the `otlp` source. |
| 249 | + |
| 250 | +| Metric | Description | |
| 251 | +| :--- | :--- | |
| 252 | +| `requestProcessDuration` | The latency of requests processed by the `otlp` source, in seconds. | |
| 253 | + |
| 254 | +### Distribution summaries |
| 255 | + |
| 256 | +The following distribution summaries track request activity and errors in the `otlp` source. |
| 257 | + |
| 258 | +| Metric | Description | |
| 259 | +| :--- | :--- | |
| 260 | +| `payloadSize` | The distribution of incoming request payload sizes, in bytes. | |
| 261 | + |
| 262 | +## Migrating from individual OpenTelemetry sources |
| 263 | + |
| 264 | +If you're using separate `otel_logs_source`, `otel_metrics_source`, or `otel_trace_source` sources, you can migrate to the unified `otlp` source by following these steps: |
| 265 | + |
| 266 | +1. Replace all three sources with a single `otlp` source. |
| 267 | +2. Use [routing configuration](#routing-telemetry-signals) to direct different signal types to their appropriate pipelines. |
| 268 | +3. Change the port numbers if needed (the `otlp` source uses port `21893` by default). |
| 269 | + |
| 270 | +### Migration example |
| 271 | + |
| 272 | +The following example demonstrates how to consolidate separate OpenTelemetry log, metric, and trace sources into a single `otlp` source. |
| 273 | + |
| 274 | +Consider a setup where logs, metrics, and traces are configured separately: |
| 275 | + |
| 276 | +```yaml |
| 277 | +logs-pipeline: |
| 278 | + source: |
| 279 | + otel_logs_source: |
| 280 | + port: 21892 |
| 281 | + sink: |
| 282 | + - opensearch: |
| 283 | + index: logs |
| 284 | +``` |
| 285 | +```yaml |
| 286 | +metrics-pipeline: |
| 287 | + source: |
| 288 | + otel_metrics_source: |
| 289 | + port: 21891 |
| 290 | + sink: |
| 291 | + - opensearch: |
| 292 | + index: metrics |
| 293 | +``` |
| 294 | +```yaml |
| 295 | +traces-pipeline: |
| 296 | + source: |
| 297 | + otel_trace_source: |
| 298 | + port: 21890 |
| 299 | + sink: |
| 300 | + - opensearch: |
| 301 | + index: traces |
| 302 | +``` |
| 303 | + |
| 304 | +You can consolidate logs, metrics, and traces into a single `otlp` source as follows: |
| 305 | + |
| 306 | +```yaml |
| 307 | +otlp-pipeline: |
| 308 | + source: |
| 309 | + otlp: |
| 310 | + port: 21893 |
| 311 | + route: |
| 312 | + - logs: 'getEventType() == "LOG"' |
| 313 | + - metrics: 'getEventType() == "METRIC"' |
| 314 | + - traces: 'getEventType() == "TRACE"' |
| 315 | + sink: |
| 316 | + - opensearch: |
| 317 | + routes: |
| 318 | + - logs |
| 319 | + index: logs |
| 320 | + - opensearch: |
| 321 | + routes: |
| 322 | + - metrics |
| 323 | + index: metrics |
| 324 | + - opensearch: |
| 325 | + routes: |
| 326 | + - traces |
| 327 | + index: traces |
| 328 | +``` |
| 329 | +{% include copy.html %} |
| 330 | + |
| 331 | +## Related pages |
| 332 | + |
| 333 | +- [OTel logs source]({{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/sources/otel-logs-source/) |
| 334 | +- [OTel metrics source]({{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/sources/otel-metrics-source/) |
| 335 | +- [OTel trace source]({{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/sources/otel-trace-source/) |
| 336 | +- [getEventType()]({{site.url}}{{site.baseurl}}/data-prepper/pipelines/get-eventtype/) |
0 commit comments