Skip to content

Commit

Permalink
Exclude exception.escaped from (to-be-stable) artifact (#133)
Browse files Browse the repository at this point in the history
* Exclude exception.escaped from (to-be-stable) artifact

* incubating too
  • Loading branch information
trask authored Jan 10, 2025
1 parent 828296f commit 9514488
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 63 deletions.
7 changes: 3 additions & 4 deletions buildscripts/templates/registry/incubating_java/weaver.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
params:
excluded_namespaces: ["ios", "aspnetcore", "signalr"]
excluded_attributes: ["messaging.client_id"]
excluded_attributes: ["messaging.client_id", "exception.escaped"]
comment_formats:
javadoc:
format: html
Expand All @@ -19,12 +19,11 @@ templates:
filter: >
semconv_grouped_attributes({
"exclude_root_namespace": $excluded_namespaces,
"exclude_stability": [],
"exclude_deprecated": false
"exclude_stability": []
}) | map({
root_namespace: .root_namespace,
attributes: .attributes,
excluded_attributes: $excluded_attributes[]
excluded_attributes: $excluded_attributes
})
application_mode: each
file_name: "{{ctx.root_namespace | pascal_case}}IncubatingAttributes.java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import java.util.List;
// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/java/SemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class {{ my_class_name }} {
{% for attribute in ctx.attributes %}{% if attribute is stable %}
{% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) %}{% if attribute is stable %}
{%- if attribute is deprecated %}
{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated -%}
{%- endif -%}
Expand Down
13 changes: 9 additions & 4 deletions buildscripts/templates/registry/java/weaver.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
params:
excluded_namespaces: ["ios", "aspnetcore", "signalr"]
excluded_attributes: ["messaging.client_id"]
# excluding "exception.escaped" from stable attributes
# because we are anticipating it being deprecated soon
excluded_attributes: ["messaging.client_id", "exception.escaped"]
comment_formats:
javadoc:
format: html
Expand All @@ -16,11 +18,14 @@ comment_formats:
default_comment_format: javadoc
templates:
- pattern: SemanticAttributes.java.j2
filter: >
filter: >
semconv_grouped_attributes({
"exclude_root_namespace": $excluded_namespaces,
"exclude_stability": ["experimental", "deprecated"],
"exclude_deprecated": false
"exclude_stability": ["experimental", "deprecated"]
}) | map({
root_namespace: .root_namespace,
attributes: .attributes,
excluded_attributes: $excluded_attributes
})
application_mode: each
file_name: "{{ctx.root_namespace | pascal_case}}Attributes.java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.semconv.incubating;

import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;

import io.opentelemetry.api.common.AttributeKey;
Expand All @@ -14,34 +13,6 @@
// buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class ExceptionIncubatingAttributes {
/**
* SHOULD be set to true if the exception event is recorded at a point where it is known that the
* exception is escaping the scope of the span.
*
* <p>Notes:
*
* <p>An exception is considered to have escaped (or left) the scope of a span, if that span is
* ended while the exception is still logically "in flight". This may be actually "in flight" in
* some languages (e.g. if the exception is passed to a Context manager's {@code __exit__} method
* in Python) but will usually be caught at the point of recording the exception in most
* languages.
*
* <p>It is usually not possible to determine at the point where an exception is thrown whether it
* will escape the scope of a span. However, it is trivial to know that an exception will escape,
* if one checks for an active exception just before ending the span, as done in the <a
* href="https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception">example
* for recording span exceptions</a>.
*
* <p>It follows that an exception may still escape the scope of the span even if the {@code
* exception.escaped} attribute was not set or set to false, since the event might have been
* recorded at a time where it was not clear whether the exception will escape.
*
* @deprecated deprecated in favor of stable {@link
* io.opentelemetry.semconv.ExceptionAttributes#EXCEPTION_ESCAPED} attribute.
*/
@Deprecated
public static final AttributeKey<Boolean> EXCEPTION_ESCAPED = booleanKey("exception.escaped");

/**
* The exception message.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.semconv;

import static io.opentelemetry.api.common.AttributeKey.booleanKey;
import static io.opentelemetry.api.common.AttributeKey.stringKey;

import io.opentelemetry.api.common.AttributeKey;
Expand All @@ -14,30 +13,6 @@
// buildscripts/templates/registry/java/SemanticAttributes.java.j2
@SuppressWarnings("unused")
public final class ExceptionAttributes {
/**
* SHOULD be set to true if the exception event is recorded at a point where it is known that the
* exception is escaping the scope of the span.
*
* <p>Notes:
*
* <p>An exception is considered to have escaped (or left) the scope of a span, if that span is
* ended while the exception is still logically "in flight". This may be actually "in flight" in
* some languages (e.g. if the exception is passed to a Context manager's {@code __exit__} method
* in Python) but will usually be caught at the point of recording the exception in most
* languages.
*
* <p>It is usually not possible to determine at the point where an exception is thrown whether it
* will escape the scope of a span. However, it is trivial to know that an exception will escape,
* if one checks for an active exception just before ending the span, as done in the <a
* href="https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception">example
* for recording span exceptions</a>.
*
* <p>It follows that an exception may still escape the scope of the span even if the {@code
* exception.escaped} attribute was not set or set to false, since the event might have been
* recorded at a time where it was not clear whether the exception will escape.
*/
public static final AttributeKey<Boolean> EXCEPTION_ESCAPED = booleanKey("exception.escaped");

/** The exception message. */
public static final AttributeKey<String> EXCEPTION_MESSAGE = stringKey("exception.message");

Expand Down

0 comments on commit 9514488

Please sign in to comment.