Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Migration to weaver #3105

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions api/include/opentelemetry/semconv/client_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace client
{

/**
* Client address - domain name if available without reverse DNS lookup; otherwise, IP address or
* Unix domain socket name. <p> When observed from the server side, and when communicating through
* an intermediary, @code client.address @endcode SHOULD represent the client address behind any
* intermediaries, for example proxies, if it's available.
*/
static constexpr const char *kClientAddress = "client.address";

/**
* Client port number.
* <p>
* When observed from the server side, and when communicating through an intermediary, @code
* client.port @endcode SHOULD represent the client port behind any intermediaries, for example
* proxies, if it's available.
*/
static constexpr const char *kClientPort = "client.port";

} // namespace client
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
57 changes: 57 additions & 0 deletions api/include/opentelemetry/semconv/error_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace error
{

/**
* Describes a class of error the operation ended with.
* <p>
* The @code error.type @endcode SHOULD be predictable, and SHOULD have low cardinality.
* <p>
* When @code error.type @endcode is set to a type (e.g., an exception type), its
* canonical class name identifying the type within the artifact SHOULD be used.
* <p>
* Instrumentations SHOULD document the list of errors they report.
* <p>
* The cardinality of @code error.type @endcode within one instrumentation library SHOULD be low.
* Telemetry consumers that aggregate data from multiple instrumentation libraries and applications
* should be prepared for @code error.type @endcode to have high cardinality at query time when no
* additional filters are applied.
* <p>
* If the operation has completed successfully, instrumentations SHOULD NOT set @code error.type
* @endcode. <p> If a specific domain defines its own set of error identifiers (such as HTTP or gRPC
* status codes), it's RECOMMENDED to: <p> <ul> <li>Use a domain-specific attribute</li> <li>Set
* @code error.type @endcode to capture all errors, regardless of whether they are defined within
* the domain-specific set or not.</li>
* </ul>
*/
static constexpr const char *kErrorType = "error.type";

namespace ErrorTypeValues
{
/**
* A fallback error value to be used when the instrumentation doesn't define a custom value.
*/
static constexpr const char *kOther = "_OTHER";

} // namespace ErrorTypeValues

} // namespace error
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
59 changes: 59 additions & 0 deletions api/include/opentelemetry/semconv/exception_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace exception
{

/**
* 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> 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__ @endcode 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 @endcode 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.
*/
static constexpr const char *kExceptionEscaped = "exception.escaped";

/**
* The exception message.
*/
static constexpr const char *kExceptionMessage = "exception.message";

/**
* A stacktrace as a string in the natural representation for the language runtime. The
* representation is to be determined and documented by each language SIG.
*/
static constexpr const char *kExceptionStacktrace = "exception.stacktrace";

/**
* The type of the exception (its fully-qualified class name, if applicable). The dynamic type of
* the exception should be preferred over the static type in languages that support it.
*/
static constexpr const char *kExceptionType = "exception.type";

} // namespace exception
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
153 changes: 153 additions & 0 deletions api/include/opentelemetry/semconv/http_attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace http
{

/**
* HTTP request headers, @code <key> @endcode being the normalized HTTP Header name (lowercase), the
* value being the header values. <p> Instrumentations SHOULD require an explicit configuration of
* which headers are to be captured. Including all request headers can be a security risk - explicit
* configuration helps avoid leaking sensitive information. The @code User-Agent @endcode header is
* already captured in the @code user_agent.original @endcode attribute. Users MAY explicitly
* configure instrumentations to capture them even though it is not recommended. The attribute value
* MUST consist of either multiple header values as an array of strings or a single-item array
* containing a possibly comma-concatenated string, depending on the way the HTTP library provides
* access to headers.
*/
static constexpr const char *kHttpRequestHeader = "http.request.header";

/**
* HTTP request method.
* <p>
* HTTP request method value SHOULD be "known" to the instrumentation.
* By default, this convention defines "known" methods as the ones listed in <a
* href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110</a> and the PATCH method
* defined in <a href="https://www.rfc-editor.org/rfc/rfc5789.html">RFC5789</a>. <p> If the HTTP
* request method is not known to instrumentation, it MUST set the @code http.request.method
* @endcode attribute to @code _OTHER @endcode. <p> If the HTTP instrumentation could end up
* converting valid HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to
* override the list of known HTTP methods. If this override is done via environment variable, then
* the environment variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a
* comma-separated list of case-sensitive known HTTP methods (this list MUST be a full override of
* the default known method, it is not a list of known methods in addition to the defaults). <p>
* HTTP method names are case-sensitive and @code http.request.method @endcode attribute value MUST
* match a known HTTP method name exactly. Instrumentations for specific web frameworks that
* consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. Tracing
* instrumentations that do so, MUST also set @code http.request.method_original @endcode to the
* original value.
*/
static constexpr const char *kHttpRequestMethod = "http.request.method";

/**
* Original HTTP method sent by the client in the request line.
*/
static constexpr const char *kHttpRequestMethodOriginal = "http.request.method_original";

/**
* The ordinal number of request resending attempt (for any reason, including redirects).
* <p>
* The resend count SHOULD be updated each time an HTTP request gets resent by the client,
* regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503
* Server Unavailable, network issues, or any other).
*/
static constexpr const char *kHttpRequestResendCount = "http.request.resend_count";

/**
* HTTP response headers, @code <key> @endcode being the normalized HTTP Header name (lowercase),
* the value being the header values. <p> Instrumentations SHOULD require an explicit configuration
* of which headers are to be captured. Including all response headers can be a security risk -
* explicit configuration helps avoid leaking sensitive information. Users MAY explicitly configure
* instrumentations to capture them even though it is not recommended. The attribute value MUST
* consist of either multiple header values as an array of strings or a single-item array containing
* a possibly comma-concatenated string, depending on the way the HTTP library provides access to
* headers.
*/
static constexpr const char *kHttpResponseHeader = "http.response.header";

/**
* <a href="https://tools.ietf.org/html/rfc7231#section-6">HTTP response status code</a>.
*/
static constexpr const char *kHttpResponseStatusCode = "http.response.status_code";

/**
* The matched route, that is, the path template in the format used by the respective server
* framework. <p> 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. SHOULD
* include the <a href="/docs/http/http-spans.md#http-server-definitions">application root</a> if
* there is one.
*/
static constexpr const char *kHttpRoute = "http.route";

namespace HttpRequestMethodValues
{
/**
* CONNECT method.
*/
static constexpr const char *kConnect = "CONNECT";

/**
* DELETE method.
*/
static constexpr const char *kDelete = "DELETE";

/**
* GET method.
*/
static constexpr const char *kGet = "GET";

/**
* HEAD method.
*/
static constexpr const char *kHead = "HEAD";

/**
* OPTIONS method.
*/
static constexpr const char *kOptions = "OPTIONS";

/**
* PATCH method.
*/
static constexpr const char *kPatch = "PATCH";

/**
* POST method.
*/
static constexpr const char *kPost = "POST";

/**
* PUT method.
*/
static constexpr const char *kPut = "PUT";

/**
* TRACE method.
*/
static constexpr const char *kTrace = "TRACE";

/**
* Any HTTP method that the instrumentation has no prior knowledge of.
*/
static constexpr const char *kOther = "_OTHER";

} // namespace HttpRequestMethodValues

} // namespace http
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
78 changes: 78 additions & 0 deletions api/include/opentelemetry/semconv/http_metrics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

/*
* DO NOT EDIT, this is an Auto-generated file from:
* buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2
*/

#pragma once

#include "opentelemetry/common/macros.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace semconv
{
namespace http
{

/**
* Duration of HTTP client requests.
* <p>
* histogram
*/
static constexpr const char *kMetricHttpClientRequestDuration =
"metric.http.client.request.duration";
static constexpr const char *descrMetricHttpClientRequestDuration =
"Duration of HTTP client requests.";
static constexpr const char *unitMetricHttpClientRequestDuration = "s";

static nostd::unique_ptr<metrics::Histogram<uint64_t>> CreateSyncMetricHttpClientRequestDuration(
metrics::Meter *meter)
{
return meter->CreateUInt64Histogram(kMetricHttpClientRequestDuration,
descrMetricHttpClientRequestDuration,
unitMetricHttpClientRequestDuration);
}

static nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncMetricHttpClientRequestDuration(
metrics::Meter *meter)
{
return meter->CreateInt64ObservableHistogram(kMetricHttpClientRequestDuration,
descrMetricHttpClientRequestDuration,
unitMetricHttpClientRequestDuration);
}

/**
* Duration of HTTP server requests.
* <p>
* histogram
*/
static constexpr const char *kMetricHttpServerRequestDuration =
"metric.http.server.request.duration";
static constexpr const char *descrMetricHttpServerRequestDuration =
"Duration of HTTP server requests.";
static constexpr const char *unitMetricHttpServerRequestDuration = "s";

static nostd::unique_ptr<metrics::Histogram<uint64_t>> CreateSyncMetricHttpServerRequestDuration(
metrics::Meter *meter)
{
return meter->CreateUInt64Histogram(kMetricHttpServerRequestDuration,
descrMetricHttpServerRequestDuration,
unitMetricHttpServerRequestDuration);
}

static nostd::shared_ptr<metrics::ObservableInstrument> CreateAsyncMetricHttpServerRequestDuration(
metrics::Meter *meter)
{
return meter->CreateInt64ObservableHistogram(kMetricHttpServerRequestDuration,
descrMetricHttpServerRequestDuration,
unitMetricHttpServerRequestDuration);
}

} // namespace http
} // namespace semconv
OPENTELEMETRY_END_NAMESPACE
Loading