From 70de66c8faaf4eabcbf4c53338ca505d6d7c6a3b Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Fri, 15 Nov 2024 17:04:43 -0700 Subject: [PATCH] group functions --- .../opentelemetry/api/trace/SpanBuilder.java | 25 +++++++++---------- .../current_vs_latest/opentelemetry-api.txt | 4 ++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/api/all/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java b/api/all/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java index 63914771497..d063968dddc 100644 --- a/api/all/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java +++ b/api/all/src/main/java/io/opentelemetry/api/trace/SpanBuilder.java @@ -213,6 +213,18 @@ public interface SpanBuilder { */ SpanBuilder setAttribute(String key, double value); + /** + * Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for + * the key, the old value is replaced by the specified value. + * + * @param key the key for this attribute. + * @param value the value for this attribute. + * @return this. + */ + default SpanBuilder setAttribute(AttributeKey key, int value) { + return setAttribute(key, (long) value); + } + /** * Sets an attribute to the newly created {@code Span}. If {@code SpanBuilder} previously * contained a mapping for the key, the old value is replaced by the specified value. @@ -339,17 +351,4 @@ default SpanBuilder setStartTimestamp(Instant startTimestamp) { * @return the newly created {@code Span}. */ Span startSpan(); - - - /** - * Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for - * the key, the old value is replaced by the specified value. - * - * @param key the key for this attribute. - * @param value the value for this attribute. - * @return this. - */ - default SpanBuilder setAttribute(AttributeKey key, int value) { - return setAttribute(key, (long) value); - } } diff --git a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt index 351726df140..4bc9a878f22 100644 --- a/docs/apidiffs/current_vs_latest/opentelemetry-api.txt +++ b/docs/apidiffs/current_vs_latest/opentelemetry-api.txt @@ -1,2 +1,4 @@ Comparing source compatibility of opentelemetry-api-1.45.0-SNAPSHOT.jar against opentelemetry-api-1.44.1.jar -No changes. \ No newline at end of file +*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.api.trace.SpanBuilder (not serializable) + === CLASS FILE FORMAT VERSION: 52.0 <- 52.0 + +++ NEW METHOD: PUBLIC(+) io.opentelemetry.api.trace.SpanBuilder setAttribute(io.opentelemetry.api.common.AttributeKey, int)