Skip to content

Conversation

felixbarny
Copy link
Member

@felixbarny felixbarny commented Aug 18, 2025

Adds an OTLP endpoint for metric ingestion into TSDB.

This simplifies getting data into TSDB as configuration of mappings and dimensions isn't required. It also improves ingestion performance. Partly due to the binary encoding but also because it can re-use partial TsidBuilders for common resource attributes.

My aim was to retain exactly the same semantics and behavior as the OTel collector's Elasticsearch exporter, including data stream routing and mapping hints.

Depends on

To review, select from the 3rd commit (9cea250) onwards
Note that I might force-push to the branch once the PRs this depends on get merged.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine elasticsearchmachine added the external-contributor Pull request authored by a developer outside the Elasticsearch team label Aug 18, 2025
@ruflin
Copy link
Contributor

ruflin commented Aug 18, 2025

Did a quick test, and so far seems to be working as expected. For everyone that needs a config to do a quick test run with the otel collector:

receivers:
  hostmetrics:
    collection_interval: 10s
    scrapers:
      cpu:
      disk:
      load:
      filesystem:
      memory:
      network:
      #process:
      paging:

processors:
  batch:


exporters:
  otlphttp/elasticsearch:
    compression: gzip
    encoding: proto
    endpoint: http://localhost:9200/_otlp
    sending_queue:
      enabled: true
      block_on_overflow: true
      queue_size: 10
      num_consumers: 10

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      processors: [batch]
      exporters: [otlphttp/elasticsearch] # only use with batch processor

Copy link
Contributor

@JonasKunz JonasKunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a look at the histogram stuff only

@felixbarny
Copy link
Member Author

Functionality-wise, everything has been merged. There are some outstanding performance improvements as part of #132566 but these are fully decoupled from the functionality.

Currently, the endpoint is behind a feature flag, meaning that it's enabled by default on snapshot builds.

@felixbarny felixbarny closed this Sep 9, 2025
@ezimuel
Copy link
Contributor

ezimuel commented Sep 10, 2025

@felixbarny the _otlp endpoint will be private or public?

@felixbarny
Copy link
Member Author

The idea is that on serverless, we hide the endpoint in ES so that the only OTLP endpoint is the one based on the managed OTel collector. For on-prem deployments, this endpoint is publicly available.

At this instant, the endpoint is behind a feature flag. This means it's only available in snapshot builds. The plan is to release this as tech preview in 9.2.

@ezimuel
Copy link
Contributor

ezimuel commented Sep 10, 2025

@felixbarny thanks, I was wondering if this endpoint will be added to the elasticsearch-specification. In that case, I suggest to mark it as "visibility": "private" since, if I understood right, the _otlp endpoint is more for (internal) optimization rather than an alternative of the EDOT collector.

@felixbarny
Copy link
Member Author

What does visibility: private exactly do?

I was planning to add this to elasticsearch-specification but only as a means to document the endpoint, not for language client code generation.

I think it makes sense to document the endpoint and mention in the docs that in serverless, the managed OTLP endpoint should be used.

if I understood right, the _otlp endpoint is more for (internal) optimization rather than an alternative of the EDOT collector.

Completely agree. This is not an alternative to EDOT or an OTel collector. But OTel collectors can use this endpoint with the otlphttp receiver.

@ezimuel
Copy link
Contributor

ezimuel commented Sep 12, 2025

The private visibility means the endpoint will not be available in the clients.

@felixbarny
Copy link
Member Author

Does this have any impact on the documentation? IIUC, the API docs also get generated from the es spec. Would setting this to private omit the endpoint from the docs?

@ezimuel
Copy link
Contributor

ezimuel commented Sep 12, 2025

The endpoints marked as private will not been considered for the docs.

@felixbarny
Copy link
Member Author

Then this is probably not the right flag for us to use. We want to have this endpoint documented.

@felixbarny felixbarny deleted the otlp-tsdb-2 branch September 25, 2025 08:27
@mlunadia
Copy link

@felixbarny what would be the effect of someone sending a considerable amount of metrics to this endpoint on a considerably large ECH cluster?

@felixbarny
Copy link
Member Author

The effect would be similar to sending the same metrics to the _bulk endpoint. In both cases we prefer larger batches rather than many small ones.

felixbarny added a commit to elastic/docs-content that referenced this pull request Oct 8, 2025
Adds docs for the new OTLP endpoint added via
elastic/elasticsearch#133057

Closes #3363

---------

Co-authored-by: Fabrizio Ferri-Benedetti <fabri.ferribenedetti@elastic.co>
Co-authored-by: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team :StorageEngine/TSDB You know, for Metrics Team:StorageEngine v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants