-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add indexing pressure tracking to OTLP endpoints #144009
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
91249bc
Add indexing pressure tracking to OTLP endpoints
felixbarny d55c00f
Update docs/changelog/144009.yaml
felixbarny 1201746
Merge branch 'main' into otlp-indexing-pressure
felixbarny 01598fa
Merge branch 'main' into otlp-indexing-pressure
felixbarny 0110254
Resolve merge conflict with main for BodyPostProcessor
felixbarny 3d7897d
Add rest tests for 413 and 429 scenarios
felixbarny d19d2f6
Merge remote-tracking branch 'origin/main' into otlp-indexing-pressure
felixbarny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| area: TSDB | ||
| issues: [] | ||
| pr: 144009 | ||
| summary: Add indexing pressure tracking to OTLP endpoints | ||
| type: enhancement | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...c/javaRestTest/java/org/elasticsearch/xpack/oteldata/otlp/OTLPIndexingPressureRestIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| package org.elasticsearch.xpack.oteldata.otlp; | ||
|
|
||
| import org.apache.http.HttpHost; | ||
| import org.apache.http.entity.ByteArrayEntity; | ||
| import org.apache.http.entity.ContentType; | ||
| import org.elasticsearch.client.Request; | ||
| import org.elasticsearch.client.ResponseException; | ||
| import org.elasticsearch.client.RestClient; | ||
| import org.elasticsearch.common.settings.SecureString; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.common.util.concurrent.ThreadContext; | ||
| import org.elasticsearch.test.cluster.ElasticsearchCluster; | ||
| import org.elasticsearch.test.cluster.local.distribution.DistributionType; | ||
| import org.elasticsearch.test.rest.ESRestTestCase; | ||
| import org.junit.ClassRule; | ||
|
|
||
| import static org.hamcrest.Matchers.equalTo; | ||
|
|
||
| /** | ||
| * Standalone IT for the 429 indexing-pressure rejection. Uses a single cluster whose | ||
| * coordinating limit (4MiB) is below the OTLP handler's upfront reservation of | ||
| * {@code http.max_protobuf_content_length} (8MiB), so every OTLP request is rejected | ||
| * with 429 before a single byte of the body is read. | ||
| * | ||
| * This class intentionally does NOT extend {@link AbstractOTLPIndexingRestIT} so that | ||
| * signal-specific ITs (e.g. {@link OTLPMetricsIndexingRestIT}) never pay the cost of | ||
| * starting this pressure cluster. | ||
| */ | ||
| public class OTLPIndexingPressureRestIT extends ESRestTestCase { | ||
|
|
||
| private static final String USER = "test_admin"; | ||
| private static final String PASS = "x-pack-test-password"; | ||
|
|
||
| @ClassRule | ||
| public static ElasticsearchCluster cluster = ElasticsearchCluster.local() | ||
| .distribution(DistributionType.DEFAULT) | ||
| .user(USER, PASS, "superuser", false) | ||
| .setting("xpack.security.enabled", "true") | ||
| .setting("xpack.security.autoconfiguration.enabled", "false") | ||
| .setting("xpack.license.self_generated.type", "trial") | ||
| .setting("xpack.ml.enabled", "false") | ||
| .setting("xpack.watcher.enabled", "false") | ||
| .setting("indexing_pressure.memory.coordinating.limit", "4mb") | ||
| .build(); | ||
|
|
||
| @Override | ||
| protected String getTestRestCluster() { | ||
| return cluster.getHttpAddresses(); | ||
| } | ||
|
|
||
| @Override | ||
| protected Settings restClientSettings() { | ||
| String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray())); | ||
| return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", token).build(); | ||
| } | ||
|
|
||
| /** | ||
| * Any OTLP request is rejected with 429 because the handler's upfront reservation of | ||
| * {@code http.max_protobuf_content_length} (8MiB) exceeds the 4MiB coordinating limit. | ||
| * The body size is irrelevant — the 429 fires before any bytes are read. | ||
| */ | ||
| public void testIndexingPressureLimitReturns429() throws Exception { | ||
| byte[] body = new byte[1024]; | ||
| Request request = new Request("POST", "/_otlp/v1/metrics"); | ||
| request.setEntity(new ByteArrayEntity(body, ContentType.create("application/x-protobuf"))); | ||
| HttpHost[] hosts = parseClusterHosts(cluster.getHttpAddresses()).toArray(HttpHost[]::new); | ||
| try (RestClient pressureClient = buildClient(restClientSettings(), hosts)) { | ||
| ResponseException e = expectThrows(ResponseException.class, () -> pressureClient.performRequest(request)); | ||
| assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(429)); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.