Skip to content

Commit

Permalink
[Semantic Conventions] Align on the specification 1.13.0 (open-teleme…
Browse files Browse the repository at this point in the history
…try#1625)

* Fix open-telemetry#1624

* Added changelog
  • Loading branch information
marcalff authored and yxue committed Dec 5, 2022
1 parent 9f1dfb1 commit 073b723
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ update the semantic convention in instrumentation library is needed.
[#1606](https://github.com/open-telemetry/opentelemetry-cpp/pull/1606)
* [METRICS EXPORTER] Add `OtlpGrpcClient` [#1606](https://github.com/open-telemetry/opentelemetry-cpp/pull/1606)
* [BUILD] Fix header only api singletons [#1604](https://github.com/open-telemetry/opentelemetry-cpp/pull/1604)
* [SEMANTIC CONVENTIONS] Upgrade to version 1.13.0 [#1624](https://github.com/open-telemetry/opentelemetry-cpp/pull/1624)

## [1.6.0] 2022-08-15
>>>>>>> 39d6a225 (Upgrade opentelemetry-proto to v0.19.0 (#1579))
Expand Down
187 changes: 141 additions & 46 deletions api/include/opentelemetry/trace/semantic_conventions.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace SemanticConventions
* The URL of the OpenTelemetry schema for these keys and values.
*/
<<<<<<< HEAD
<<<<<<< HEAD
static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.15.0";

/**
Expand Down Expand Up @@ -74,6 +75,9 @@ static constexpr const char *kEventDomain = "event.domain";
=======
static constexpr const char *SCHEMA_URL = "https://opentelemetry.io/schemas/1.12.0";
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
=======
static constexpr const char *SCHEMA_URL = "https://opentelemetry.io/schemas/1.13.0";
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))

/**
* The full invoked ARN as provided on the {@code Context} passed to the function ({@code
Expand Down Expand Up @@ -598,19 +602,50 @@ static constexpr const char *kNetSockFamily = "net.sock.family";
static constexpr const char *NET_TRANSPORT = "net.transport";
/**
* Remote address of the peer (dotted decimal for IPv4 or <a
* href="https://tools.ietf.org/html/rfc5952">RFC5952</a> for IPv6)
* Application layer protocol used. The value SHOULD be normalized to lowercase.
*/
static constexpr const char *NET_PEER_IP = "net.peer.ip";
static constexpr const char *NET_APP_PROTOCOL_NAME = "net.app.protocol.name";

/**
* Remote port number.
* Version of the application layer protocol used. See note below.
*
* <p>Notes:
<ul> <li>{@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}.</li>
</ul>
*/
static constexpr const char *NET_PEER_PORT = "net.peer.port";
static constexpr const char *NET_APP_PROTOCOL_VERSION = "net.app.protocol.version";

/**
<<<<<<< HEAD
* Remote hostname or similar, see note below.
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
=======
* Remote socket peer name.
*/
static constexpr const char *NET_SOCK_PEER_NAME = "net.sock.peer.name";

/**
* Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, <a
* href="https://man7.org/linux/man-pages/man7/address_families.7.html">etc</a>.
*/
static constexpr const char *NET_SOCK_PEER_ADDR = "net.sock.peer.addr";

/**
* Remote socket peer port.
*/
static constexpr const char *NET_SOCK_PEER_PORT = "net.sock.peer.port";

/**
* Protocol <a href="https://man7.org/linux/man-pages/man7/address_families.7.html">address
* family</a> which is used for communication.
*/
static constexpr const char *NET_SOCK_FAMILY = "net.sock.family";

/**
* Logical remote hostname, see note below.
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))
*
* <p>Notes:
<ul> <li>{@code net.peer.name} SHOULD NOT be set if capturing it would require an extra DNS
Expand Down Expand Up @@ -647,20 +682,34 @@ static constexpr const char *kNetSockHostPort = "net.sock.host.port";
static constexpr const char *NET_PEER_NAME = "net.peer.name";

/**
* Like {@code net.peer.ip} but for the host IP. Useful in case of a multi-IP host.
* Logical remote port number
*/
static constexpr const char *NET_PEER_PORT = "net.peer.port";

/**
* Logical local hostname or similar, see note below.
*/
static constexpr const char *NET_HOST_IP = "net.host.ip";
static constexpr const char *NET_HOST_NAME = "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
*/
static constexpr const char *NET_HOST_PORT = "net.host.port";

/**
* Local hostname or similar, see note below.
* Local socket address. Useful in case of a multi-IP host.
*/
<<<<<<< HEAD
static constexpr const char *NET_HOST_NAME = "net.host.name";
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
=======
static constexpr const char *NET_SOCK_HOST_ADDR = "net.sock.host.addr";

/**
* Local socket port number.
*/
static constexpr const char *NET_SOCK_HOST_PORT = "net.sock.host.port";
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))

/**
* The internet connection type currently being used by the host.
Expand Down Expand Up @@ -867,6 +916,7 @@ static constexpr const char *HTTP_METHOD = "http.method";
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))

/**
<<<<<<< HEAD
* 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.
*
Expand Down Expand Up @@ -933,6 +983,8 @@ static constexpr const char *HTTP_HOST = "http.host";
static constexpr const char *HTTP_SCHEME = "http.scheme";

/**
=======
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))
* <a href="https://tools.ietf.org/html/rfc7231#section-6">HTTP response status code</a>.
*/
static constexpr const char *HTTP_STATUS_CODE = "http.status_code";
Expand All @@ -947,61 +999,61 @@ static constexpr const char *HTTP_STATUS_CODE = "http.status_code";
static constexpr const char *HTTP_FLAVOR = "http.flavor";

/**
* Value of the <a href="https://tools.ietf.org/html/rfc7231#section-5.5.3">HTTP User-Agent</a>
* header sent by the client.
* Value of the <a href="https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent">HTTP
* User-Agent</a> header sent by the client.
*/
static constexpr const char *HTTP_USER_AGENT = "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 <a
* href="https://tools.ietf.org/html/rfc7230#section-3.3.2">Content-Length</a> 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</a>
* header. For requests using transport encoding, this should be the compressed size.
*/
static constexpr const char *HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length";

/**
* The size of the uncompressed request payload body after transport decoding. Not set if transport
* encoding not used.
*/
static constexpr const char *HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED =
"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 <a
* href="https://tools.ietf.org/html/rfc7230#section-3.3.2">Content-Length</a> 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</a>
* header. For requests using transport encoding, this should be the compressed size.
*/
static constexpr const char *HTTP_RESPONSE_CONTENT_LENGTH = "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.
*
* <p>Notes:
<ul> <li>{@code http.url} MUST NOT contain credentials passed via URL in form of {@code
https://username:[email protected]/}. In such case the attribute's value should be {@code
https://www.example.com/}.</li> </ul>
*/
static constexpr const char *HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED =
"http.response_content_length_uncompressed";
static constexpr const char *HTTP_URL = "http.url";

/**
* The ordinal number of request re-sending attempt.
*/
static constexpr const char *HTTP_RETRY_COUNT = "http.retry_count";

/**
* 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).
*
* <p>Notes:
<ul> <li>{@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.</li> </ul>
* The URI scheme identifying the used protocol.
*/
static constexpr const char *HTTP_SERVER_NAME = "http.server_name";
static constexpr const char *HTTP_SCHEME = "http.scheme";

/**
* The matched route (path template).
* The full request target as passed in a HTTP request line or equivalent.
*/
static constexpr const char *HTTP_TARGET = "http.target";

/**
* The matched route (path template in the format used by the respective server framework). See note
below
*
* <p>Notes:
<ul> <li>'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.</li> </ul>
*/
static constexpr const char *HTTP_ROUTE = "http.route";
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
Expand All @@ -1011,6 +1063,7 @@ static constexpr const char *HTTP_ROUTE = "http.route";
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For">X-Forwarded-For</a>).
*
* <p>Notes:
<<<<<<< HEAD
<<<<<<< HEAD
<ul> <li>This is not necessarily the same as {@code net.sock.peer.addr}, which would
identify the network-level peer, which may be a proxy.</li><li>This attribute should be set when a
Expand All @@ -1025,12 +1078,15 @@ the closest proxy.</li> </ul>
static constexpr const char *kHttpClientIp = "http.client_ip";
=======
<ul> <li>This is not necessarily the same as {@code net.peer.ip}, which would
=======
<ul> <li>This is not necessarily the same as {@code net.sock.peer.addr}, which would
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))
identify the network-level peer, which may be a proxy.</li><li>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
source of information different from the one used for {@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.</li> </ul>
*/
Expand Down Expand Up @@ -1267,6 +1323,24 @@ static constexpr const char *kMessagingSystem = "messaging.system";
static constexpr const char *AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES =
"aws.dynamodb.global_secondary_index_updates";
/**
* The name of the operation being executed.
*/
static constexpr const char *GRAPHQL_OPERATION_NAME = "graphql.operation.name";
/**
* The type of the operation being executed.
*/
static constexpr const char *GRAPHQL_OPERATION_TYPE = "graphql.operation.type";
/**
* The GraphQL document being executed.
*
* <p>Notes:
<ul> <li>The value may be sanitized to exclude sensitive information.</li> </ul>
*/
static constexpr const char *GRAPHQL_DOCUMENT = "graphql.document";
/**
* A string identifying the messaging system.
*/
Expand Down Expand Up @@ -1871,7 +1945,12 @@ static constexpr const char *ELASTICSEARCH = "elasticsearch";
static constexpr const char *MEMCACHED = "memcached";
/** CockroachDB. */
static constexpr const char *COCKROACHDB = "cockroachdb";
<<<<<<< HEAD
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
=======
/** OpenSearch. */
static constexpr const char *OPENSEARCH = "opensearch";
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))
} // namespace DbSystemValues
namespace DbCassandraConsistencyLevelValues
Expand Down Expand Up @@ -2046,10 +2125,6 @@ static constexpr const char *kUnknown = "unknown";
static constexpr const char *IP_TCP = "ip_tcp";
/** ip_udp. */
static constexpr const char *IP_UDP = "ip_udp";
/** Another IP-based protocol. */
static constexpr const char *IP = "ip";
/** Unix Domain socket. See below. */
static constexpr const char *UNIX = "unix";
/** Named or anonymous pipe. See note below. */
static constexpr const char *PIPE = "pipe";
/** In-process communication. */
Expand All @@ -2058,6 +2133,16 @@ static constexpr const char *INPROC = "inproc";
static constexpr const char *OTHER = "other";
} // namespace NetTransportValues
namespace NetSockFamilyValues
{
/** IPv4 address. */
static constexpr const char *INET = "inet";
/** IPv6 address. */
static constexpr const char *INET6 = "inet6";
/** Unix domain socket path. */
static constexpr const char *UNIX = "unix";
} // namespace NetSockFamilyValues
namespace NetHostConnectionTypeValues
{
/** wifi. */
Expand Down Expand Up @@ -2210,6 +2295,16 @@ static constexpr const char *SPDY = "SPDY";
static constexpr const char *QUIC = "QUIC";
} // namespace HttpFlavorValues
namespace GraphqlOperationTypeValues
{
/** GraphQL query. */
static constexpr const char *QUERY = "query";
/** GraphQL mutation. */
static constexpr const char *MUTATION = "mutation";
/** GraphQL subscription. */
static constexpr const char *SUBSCRIPTION = "subscription";
} // namespace GraphqlOperationTypeValues
namespace MessagingDestinationKindValues
{
/** A message sent to a queue. */
Expand Down
7 changes: 7 additions & 0 deletions buildscripts/semantic-convention/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ROOT_DIR="${SCRIPT_DIR}/../../"

# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
<<<<<<< HEAD
<<<<<<< HEAD
SEMCONV_VERSION=1.15.0
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
Expand All @@ -21,6 +22,12 @@ SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
GENERATOR_VERSION=0.7.0
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
=======
SEMCONV_VERSION=1.13.0
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
GENERATOR_VERSION=0.14.0
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))

cd ${SCRIPT_DIR}

Expand Down
2 changes: 1 addition & 1 deletion examples/grpc/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GreeterClient
{{SemanticConventions::RPC_SYSTEM, "grpc"},
{SemanticConventions::RPC_SERVICE, "grpc-example.GreetService"},
{SemanticConventions::RPC_METHOD, "Greet"},
{SemanticConventions::NET_PEER_IP, ip},
{SemanticConventions::NET_SOCK_PEER_ADDR, ip},
{SemanticConventions::NET_PEER_PORT, port}},
>>>>>>> d9ad0afb (Add automatically semantic conventions from the spec (#873) (#1497))
options);
Expand Down
4 changes: 4 additions & 0 deletions examples/http/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback
// start span with parent context extracted from http header
auto span = get_tracer("http-server")
->StartSpan(span_name,
<<<<<<< HEAD
<<<<<<< HEAD
{{SemanticConventions::kNetHostName, server_name},
{SemanticConventions::kNetHostPort, server_port},
Expand All @@ -50,6 +51,9 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback
{SemanticConventions::kHttpClientIp, request.client}},
=======
{{SemanticConventions::HTTP_SERVER_NAME, server_name},
=======
{{SemanticConventions::NET_HOST_NAME, server_name},
>>>>>>> 5c1e16b8 ([Semantic Conventions] Align on the specification 1.13.0 (#1625))
{SemanticConventions::NET_HOST_PORT, server_port},
{SemanticConventions::HTTP_METHOD, request.method},
{SemanticConventions::HTTP_SCHEME, "http"},
Expand Down
Loading

0 comments on commit 073b723

Please sign in to comment.