diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 5061d12e042..ee0a0ef4cf7 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -4,10 +4,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.12.0 +SEMCONV_VERSION=1.13.0 SPEC_VERSION=v$SEMCONV_VERSION SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION -GENERATOR_VERSION=0.8.0 +GENERATOR_VERSION=0.14.0 cd ${SCRIPT_DIR} diff --git a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 index afc53564759..5051cd3d742 100644 --- a/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 +++ b/buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 @@ -91,6 +91,16 @@ public final class {{class}} { /** {% filter escape %}{{member.brief | to_doc_brief}}.{% endfilter %} */ public static final {{ type }} {{ member.member_id | to_const_name }} = {{ print_value(type, member.value) }}; {%- endfor %} + + {%- if class_name == "NetTransportValues" %} + /** @deprecated This item has been removed as of 1.13.0 of the semantic conventions. */ + @Deprecated + public static final String IP = "ip"; + /** @deprecated This item has been removed as of 1.13.0 of the semantic conventions. */ + @Deprecated + public static final String UNIX = "unix"; + {%- endif %} + private {{ class_name }}() {} } @@ -124,6 +134,49 @@ public final class {{class}} { @Deprecated public static final AttributeKey DB_HBASE_NAMESPACE = stringKey("db.hbase.namespace"); + /** + * The size of the uncompressed request payload body after transport decoding. Not set if + * transport encoding not used. + * + * @deprecated this item has been removed as of 1.13.0 of the semantic conventions. Please use {@link SemanticAttributes#HTTP_REQUEST_CONTENT_LENGTH} instead. + */ + @Deprecated + public static final AttributeKey HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = + longKey("http.request_content_length_uncompressed"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use {@link SemanticAttributes#HTTP_RESPONSE_CONTENT_LENGTH} instead. + */ + @Deprecated + public static final AttributeKey HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = + longKey("http.response_content_length_uncompressed"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#NET_HOST_NAME} instead. + */ + @Deprecated + public static final AttributeKey HTTP_SERVER_NAME = stringKey("http.server_name"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#NET_HOST_NAME} instead. + */ + @Deprecated + public static final AttributeKey HTTP_HOST = stringKey("http.host"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey NET_PEER_IP = stringKey("net.peer.ip"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated + public static final AttributeKey NET_HOST_IP = stringKey("net.host.ip"); + {% endif %} private {{class}}() {} diff --git a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java index 9ef7b9af02d..03c5d2263f0 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/resource/attributes/ResourceAttributes.java @@ -16,7 +16,7 @@ // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 public final class ResourceAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.13.0"; /** * Array of brand name and version separated by a space @@ -493,6 +493,9 @@ public final class ResourceAttributes { /** Process identifier (PID). */ public static final AttributeKey PROCESS_PID = longKey("process.pid"); + /** Parent Process identifier (PID). */ + public static final AttributeKey PROCESS_PARENT_PID = longKey("process.parent_pid"); + /** * The name of the process executable. On Linux based systems, can be set to the {@code Name} in * {@code proc/[pid]/status}. On Windows, can be set to the base name of {@code diff --git a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java index 7c2cdae565b..8bc72516772 100644 --- a/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java +++ b/semconv/src/main/java/io/opentelemetry/semconv/trace/attributes/SemanticAttributes.java @@ -18,7 +18,7 @@ // buildscripts/semantic-convention/templates/SemanticAttributes.java.j2 public final class SemanticAttributes { /** The URL of the OpenTelemetry schema for these keys and values. */ - public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0"; + public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.13.0"; /** * The full invoked ARN as provided on the {@code Context} passed to the function ({@code @@ -374,17 +374,45 @@ public final class SemanticAttributes { /** Transport protocol used. See note below. */ public static final AttributeKey NET_TRANSPORT = stringKey("net.transport"); + /** Application layer protocol used. The value SHOULD be normalized to lowercase. */ + public static final AttributeKey NET_APP_PROTOCOL_NAME = + stringKey("net.app.protocol.name"); + /** - * Remote address of the peer (dotted decimal for IPv4 or RFC5952 for IPv6) + * Version of the application layer protocol used. See note below. + * + *

Notes: + * + *

    + *
  • {@code net.app.protocol.version} refers to the version of the protocol used and might be + * different from the protocol client's version. If the HTTP client used has a version of + * {@code 0.27.2}, but sends HTTP version {@code 1.1}, this attribute should be set to + * {@code 1.1}. + *
*/ - public static final AttributeKey NET_PEER_IP = stringKey("net.peer.ip"); + public static final AttributeKey NET_APP_PROTOCOL_VERSION = + stringKey("net.app.protocol.version"); - /** Remote port number. */ - public static final AttributeKey NET_PEER_PORT = longKey("net.peer.port"); + /** Remote socket peer name. */ + public static final AttributeKey NET_SOCK_PEER_NAME = stringKey("net.sock.peer.name"); + + /** + * Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, + * etc. + */ + public static final AttributeKey NET_SOCK_PEER_ADDR = stringKey("net.sock.peer.addr"); + + /** Remote socket peer port. */ + public static final AttributeKey NET_SOCK_PEER_PORT = longKey("net.sock.peer.port"); + + /** + * Protocol address + * family which is used for communication. + */ + public static final AttributeKey NET_SOCK_FAMILY = stringKey("net.sock.family"); /** - * Remote hostname or similar, see note below. + * Logical remote hostname, see note below. * *

Notes: * @@ -395,14 +423,20 @@ public final class SemanticAttributes { */ public static final AttributeKey NET_PEER_NAME = stringKey("net.peer.name"); - /** Like {@code net.peer.ip} but for the host IP. Useful in case of a multi-IP host. */ - public static final AttributeKey NET_HOST_IP = stringKey("net.host.ip"); + /** Logical remote port number */ + public static final AttributeKey NET_PEER_PORT = longKey("net.peer.port"); + + /** Logical local hostname or similar, see note below. */ + public static final AttributeKey NET_HOST_NAME = stringKey("net.host.name"); - /** Like {@code net.peer.port} but for the host port. */ + /** Logical local port number, preferably the one that the peer used to connect */ public static final AttributeKey NET_HOST_PORT = longKey("net.host.port"); - /** Local hostname or similar, see note below. */ - public static final AttributeKey NET_HOST_NAME = stringKey("net.host.name"); + /** Local socket address. Useful in case of a multi-IP host. */ + public static final AttributeKey NET_SOCK_HOST_ADDR = stringKey("net.sock.host.addr"); + + /** Local socket port number. */ + public static final AttributeKey NET_SOCK_HOST_PORT = longKey("net.sock.host.port"); /** The internet connection type currently being used by the host. */ public static final AttributeKey NET_HOST_CONNECTION_TYPE = @@ -491,42 +525,6 @@ public final class SemanticAttributes { /** HTTP request method. */ public static final AttributeKey HTTP_METHOD = stringKey("http.method"); - /** - * Full HTTP request URL in the form {@code scheme://host[:port]/path?query[#fragment]}. Usually - * the fragment is not transmitted over HTTP, but if it is known, it should be included - * nevertheless. - * - *

Notes: - * - *

    - *
  • {@code http.url} MUST NOT contain credentials passed via URL in form of {@code - * https://username:password@www.example.com/}. In such case the attribute's value should be - * {@code https://www.example.com/}. - *
- */ - public static final AttributeKey HTTP_URL = stringKey("http.url"); - - /** The full request target as passed in a HTTP request line or equivalent. */ - public static final AttributeKey HTTP_TARGET = stringKey("http.target"); - - /** - * The value of the HTTP host - * header. An empty Host header should also be reported, see note. - * - *

Notes: - * - *

    - *
  • When the header is present but empty the attribute SHOULD be set to the empty string. - * Note that this is a valid situation that is expected in certain cases, according the - * aforementioned section of RFC - * 7230. When the header is not set the attribute MUST NOT be set. - *
- */ - public static final AttributeKey HTTP_HOST = stringKey("http.host"); - - /** The URI scheme identifying the used protocol. */ - public static final AttributeKey HTTP_SCHEME = stringKey("http.scheme"); - /** HTTP response status code. */ public static final AttributeKey HTTP_STATUS_CODE = longKey("http.status_code"); @@ -543,63 +541,65 @@ public final class SemanticAttributes { public static final AttributeKey HTTP_FLAVOR = stringKey("http.flavor"); /** - * Value of the HTTP User-Agent - * header sent by the client. + * Value of the HTTP + * User-Agent header sent by the client. */ public static final AttributeKey HTTP_USER_AGENT = stringKey("http.user_agent"); /** * The size of the request payload body in bytes. This is the number of bytes transferred * excluding headers and is often, but not always, present as the Content-Length header. For - * requests using transport encoding, this should be the compressed size. + * href="https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length">Content-Length + * header. For requests using transport encoding, this should be the compressed size. */ public static final AttributeKey HTTP_REQUEST_CONTENT_LENGTH = longKey("http.request_content_length"); - /** - * The size of the uncompressed request payload body after transport decoding. Not set if - * transport encoding not used. - */ - public static final AttributeKey HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = - longKey("http.request_content_length_uncompressed"); - /** * The size of the response payload body in bytes. This is the number of bytes transferred * excluding headers and is often, but not always, present as the Content-Length header. For - * requests using transport encoding, this should be the compressed size. + * href="https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length">Content-Length + * header. For requests using transport encoding, this should be the compressed size. */ public static final AttributeKey HTTP_RESPONSE_CONTENT_LENGTH = longKey("http.response_content_length"); /** - * The size of the uncompressed response payload body after transport decoding. Not set if - * transport encoding not used. + * Full HTTP request URL in the form {@code scheme://host[:port]/path?query[#fragment]}. Usually + * the fragment is not transmitted over HTTP, but if it is known, it should be included + * nevertheless. + * + *

Notes: + * + *

    + *
  • {@code http.url} MUST NOT contain credentials passed via URL in form of {@code + * https://username:password@www.example.com/}. In such case the attribute's value should be + * {@code https://www.example.com/}. + *
*/ - public static final AttributeKey HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = - longKey("http.response_content_length_uncompressed"); + public static final AttributeKey HTTP_URL = stringKey("http.url"); /** The ordinal number of request re-sending attempt. */ public static final AttributeKey HTTP_RETRY_COUNT = longKey("http.retry_count"); + /** The URI scheme identifying the used protocol. */ + public static final AttributeKey HTTP_SCHEME = stringKey("http.scheme"); + + /** The full request target as passed in a HTTP request line or equivalent. */ + public static final AttributeKey HTTP_TARGET = stringKey("http.target"); + /** - * The primary server name of the matched virtual host. This should be obtained via configuration. - * If no such configuration can be obtained, this attribute MUST NOT be set ( {@code - * net.host.name} should be used instead). + * The matched route (path template in the format used by the respective server framework). See + * note below * *

Notes: * *

    - *
  • {@code http.url} is usually not readily available on the server side but would have to be - * assembled in a cumbersome and sometimes lossy process from other information (see e.g. - * open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw - * data that is available. + *
  • 'http.route' MUST NOT be populated when this is not supported by the HTTP server + * framework as the route attribute should have low-cardinality and the URI path can NOT + * substitute it. *
*/ - public static final AttributeKey HTTP_SERVER_NAME = stringKey("http.server_name"); - - /** The matched route (path template). */ public static final AttributeKey HTTP_ROUTE = stringKey("http.route"); /** @@ -609,14 +609,15 @@ public final class SemanticAttributes { *

Notes: * *

    - *
  • This is not necessarily the same as {@code net.peer.ip}, which would identify the + *
  • This is not necessarily the same as {@code net.sock.peer.addr}, which would identify the * network-level peer, which may be a proxy. *
  • This attribute should be set when a source of information different from the one used for - * {@code net.peer.ip}, is available even if that other source just confirms the same value - * as {@code net.peer.ip}. Rationale: For {@code net.peer.ip}, one typically does not know - * if it comes from a proxy, reverse proxy, or the actual client. Setting {@code - * http.client_ip} when it's the same as {@code net.peer.ip} means that one is at least - * somewhat confident that the address is not that of the closest proxy. + * {@code net.sock.peer.addr}, is available even if that other source just confirms the same + * value as {@code net.sock.peer.addr}. Rationale: For {@code net.sock.peer.addr}, one + * typically does not know if it comes from a proxy, reverse proxy, or the actual client. + * Setting {@code http.client_ip} when it's the same as {@code net.sock.peer.addr} means + * that one is at least somewhat confident that the address is not that of the closest + * proxy. *
*/ public static final AttributeKey HTTP_CLIENT_IP = stringKey("http.client_ip"); @@ -708,6 +709,25 @@ public final class SemanticAttributes { public static final AttributeKey> AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = stringArrayKey("aws.dynamodb.global_secondary_index_updates"); + /** The name of the operation being executed. */ + public static final AttributeKey GRAPHQL_OPERATION_NAME = + stringKey("graphql.operation.name"); + + /** The type of the operation being executed. */ + public static final AttributeKey GRAPHQL_OPERATION_TYPE = + stringKey("graphql.operation.type"); + + /** + * The GraphQL document being executed. + * + *

Notes: + * + *

    + *
  • The value may be sanitized to exclude sensitive information. + *
+ */ + public static final AttributeKey GRAPHQL_DOCUMENT = stringKey("graphql.document"); + /** A string identifying the messaging system. */ public static final AttributeKey MESSAGING_SYSTEM = stringKey("messaging.system"); @@ -1034,6 +1054,8 @@ public static final class DbSystemValues { public static final String MEMCACHED = "memcached"; /** CockroachDB. */ public static final String COCKROACHDB = "cockroachdb"; + /** OpenSearch. */ + public static final String OPENSEARCH = "opensearch"; private DbSystemValues() {} } @@ -1111,20 +1133,35 @@ public static final class NetTransportValues { public static final String IP_TCP = "ip_tcp"; /** ip_udp. */ public static final String IP_UDP = "ip_udp"; - /** Another IP-based protocol. */ - public static final String IP = "ip"; - /** Unix Domain socket. See below. */ - public static final String UNIX = "unix"; /** Named or anonymous pipe. See note below. */ public static final String PIPE = "pipe"; /** In-process communication. */ public static final String INPROC = "inproc"; /** Something else (non IP-based). */ public static final String OTHER = "other"; + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated public static final String IP = "ip"; + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated public static final String UNIX = "unix"; private NetTransportValues() {} } + public static final class NetSockFamilyValues { + /** IPv4 address. */ + public static final String INET = "inet"; + /** IPv6 address. */ + public static final String INET6 = "inet6"; + /** Unix domain socket path. */ + public static final String UNIX = "unix"; + + private NetSockFamilyValues() {} + } + public static final class NetHostConnectionTypeValues { /** wifi. */ public static final String WIFI = "wifi"; @@ -1204,6 +1241,17 @@ public static final class HttpFlavorValues { private HttpFlavorValues() {} } + public static final class GraphqlOperationTypeValues { + /** GraphQL query. */ + public static final String QUERY = "query"; + /** GraphQL mutation. */ + public static final String MUTATION = "mutation"; + /** GraphQL subscription. */ + public static final String SUBSCRIPTION = "subscription"; + + private GraphqlOperationTypeValues() {} + } + public static final class MessagingDestinationKindValues { /** A message sent to a queue. */ public static final String QUEUE = "queue"; @@ -1333,5 +1381,47 @@ private MessageTypeValues() {} @Deprecated public static final AttributeKey DB_HBASE_NAMESPACE = stringKey("db.hbase.namespace"); + /** + * The size of the uncompressed request payload body after transport decoding. Not set if + * transport encoding not used. + * + * @deprecated this item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#HTTP_REQUEST_CONTENT_LENGTH} instead. + */ + @Deprecated + public static final AttributeKey HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = + longKey("http.request_content_length_uncompressed"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#HTTP_RESPONSE_CONTENT_LENGTH} instead. + */ + @Deprecated + public static final AttributeKey HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = + longKey("http.response_content_length_uncompressed"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#NET_HOST_NAME} instead. + */ + @Deprecated + public static final AttributeKey HTTP_SERVER_NAME = stringKey("http.server_name"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. Please use + * {@link SemanticAttributes#NET_HOST_NAME} instead. + */ + @Deprecated public static final AttributeKey HTTP_HOST = stringKey("http.host"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated public static final AttributeKey NET_PEER_IP = stringKey("net.peer.ip"); + + /** + * @deprecated This item has been removed as of 1.13.0 of the semantic conventions. + */ + @Deprecated public static final AttributeKey NET_HOST_IP = stringKey("net.host.ip"); + private SemanticAttributes() {} }