MetricsView created with SdkMeterProviderUtil.appendFilteredBaggageAttributes adds high-cardinality attributes from http-server-metrics-state
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java
- Lĩnh vực
- observability-sre
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/view/AttributesProcessor.java quanh dòng 200 và theo dõi cách các thuộc tính http-server-metrics-state của Context đi tới view. Tái hiện với các phiên bản agent được liệt kê và xác minh rằng view đã lọc chỉ giữ lại thuộc tính baggage khớp, không có các thuộc tính HTTP có cardinality cao đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I'm creating an OTel Agent extension, and I want to include a low-cardinality Baggage Entry into some metrics (http.server.request.duration and others).
I followed this example https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions/7704#discussioncomment-4949461
In my agent extension, I have autoconfiguration code like:
private SdkMeterProviderBuilder configureSdkMeterProvider(SdkMeterProviderBuilder meterProviderBuilder, ConfigProperties config) {
ViewBuilder tenancyAttrBuilder = View.builder();
SdkMeterProviderUtil.appendFilteredBaggageAttributes(
tenancyAttrBuilder,
name -> name.equals("my-tenancy-attribute");
View tenancyAttrView = tenancyAttrBuilder.build();
for (String metricName: ImmutableList.of("http.server.request.duration", "http.server.active_requests") {
meterProviderBuilder.registerView(
InstrumentSelector.builder().setName(metricName).build(),
tenancyAttrView
);
}
return meterProviderBuilder;
}
What did you expect to see?
I expected the only new attribute that'd be added to the metrics would be "my-tenancy-attribute" from Baggage.
What did you see instead?
The attribute from baggage is added, but also added are a handful of high-cardinality attributes.
None of which match the predicate supplied to the View.
Stepping through the code, it seems like they get added on this line: https://github.com/open-telemetry/opentelemetry-java/blob/37969926d13f7f62cf4fa9b2f46794c01d0cfb3a/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/internal/view/AttributesProcessor.java#L200
Incoming is a collection of the attributes from Context's http-server-metrics-state
With either jetty or undertow autoinstrumentation, this results in a cardinality explosion due to entries being added for the following attributes:
- url.query
- url.path
- user_agent.original
- network.peer.port
- network.peer.address
- client.address
Messages are logged from the otel agent like:
[otel.javaagent 2025-02-21 03:53:44:316 +0000] [XNIO-1 task-18] WARN io.opentelemetry.sdk.metrics.internal.state.DefaultSynchronousMetricStorage - Instrument http.server.request.duration has exceeded the maximum allowed cardinality (1999).
What version and what artifacts are you using?
Artifacts: opentelemetry-java, opentelemetry-java-instrumentation. otel agent + my extension. otlp exporters.
Version: 1.47.0 of otel java, 2.13.1 of otel-java-instrumentation
How did you reference these artifacts?
root pom
<properties>
<opentelemetry-instrumentation-bom.version>2.13.1</opentelemetry-instrumentation-bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-bom-alpha</artifactId>
<version>${opentelemetry-instrumentation-bom.version}-alpha</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
agent extension pom:
<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.semconv</groupId>
<artifactId>opentelemetry-semconv-incubating</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-extension-autoconfigure-spi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent-extension-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent-tooling</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
Environment
Compiler: (e.g., "Temurin 17.0.7")
OS: (e.g., "Ubuntu 20.04")
Runtime (if different from JDK above): (e.g., "Oracle JRE 8u251")
OS (if different from OS compiled on): (e.g., "Windows Server 2019")
❯ java -version
openjdk version "1.8.0_372"
OpenJDK Runtime Environment (Zulu 8.70.0.23-CA-macos-aarch64) (build 1.8.0_372-b07)
OpenJDK 64-Bit Server VM (Zulu 8.70.0.23-CA-macos-aarch64) (build 25.372-b07, mixed mode)
Additional context
Add any other context about the problem here.
- Ngôn ngữ chính
- Java
- Star
- 2.5k
- Fork
- 1.1k
- Merge trung bình
- 5 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 41
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của open-telemetry/opentelemetry-java
-
`B3PropagatorExtractorMultipleHeaders` allocates when headers are missingCó thể đã có người làm @Eliot5566 đã nhận hôm nay. Đang mởBug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
open-telemetry/opentelemetry-java#9065 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[incubator] ComposableProbabilitySampler does not validate ratio rangeCó thể đã có người làm @eminfikret đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-telemetry/opentelemetry-java#9046 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
-
PrometheusComponentProvider promotes all resource attributes when resource_constant_labels is empty ({})Có thể đã có người làm @rooks-ns đã nhận 19 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
open-telemetry/opentelemetry-java#9014 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Fix `otel.sdk.log.created` counting semanticsCó thể đã có người làm @anuraaga đã nhận 112 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-telemetry/opentelemetry-java#8688 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
SdkSpanBuilder drops invalid parent TraceState when IdGenerator.generatesRandomTraceIds() is trueCó thể đã có người làm @Eliot5566 đã nhận hôm nay. Đang mởBug SDK
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
open-telemetry/opentelemetry-java#9062 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của open-telemetry/opentelemetry-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability untriaged
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
opensearch-project/cross-cluster-replication#1805 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature request needs triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
TeamNewPipe/NewPipe#14083 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NeoForge 安装任务的子任务描述有误Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
PCL-Community/PCL-CE#3907 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 2 ngày