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

Update Semantic Conventions to version 1.12.0 #725

Merged
merged 2 commits into from
Jun 23, 2022
Merged
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
55 changes: 30 additions & 25 deletions script/semantic-conventions/semconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,38 @@

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="${SCRIPT_DIR}/../../"
SPEC_DIR="${ROOT_DIR}/var/opentelemetry-specification"
CODE_DIR="${ROOT_DIR}/src/SemConv"

# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
SEMCONV_VERSION=${SEMCONV_VERSION:=1.9.0}
SEMCONV_VERSION=${SEMCONV_VERSION:=1.12.0}
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
GENERATOR_VERSION=0.8.0
GENERATOR_VERSION=0.11.0

cd ${SCRIPT_DIR}
cd "${SCRIPT_DIR}" || exit

rm -rf opentelemetry-specification || true
mkdir opentelemetry-specification
cd opentelemetry-specification
rm -rf "${SPEC_DIR}" || true
mkdir "${SPEC_DIR}"
cd "${SPEC_DIR}" || exit

git init
git remote add origin https://github.com/open-telemetry/opentelemetry-specification.git
git fetch origin "$SPEC_VERSION"
git reset --hard FETCH_HEAD

cd ${SCRIPT_DIR}
cd "${SCRIPT_DIR}" || exit

rm -rf ${ROOT_DIR}/src/SemConv || true
mkdir -p ${ROOT_DIR}/src/SemConv
rm -rf "${CODE_DIR}" || true
mkdir -p "${CODE_DIR}"
git checkout HEAD "${CODE_DIR}/composer.json"

# Trace
docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/src/SemConv:/output \
-u ${UID} \
-v "${SPEC_DIR}/semantic_conventions/trace:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
-f /source code \
--template /templates/Attributes.php.j2 \
Expand All @@ -46,10 +49,10 @@ docker run --rm \
-DschemaUrl=$SCHEMA_URL

docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/src/SemConv:/output \
-u ${UID} \
-v "${SPEC_DIR}/semantic_conventions/trace:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/"output \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
-f /source code \
--template /templates/AttributeValues.php.j2 \
Expand All @@ -61,10 +64,10 @@ docker run --rm \

# Resource
docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/src/SemConv:/output \
-u ${UID} \
-v "${SPEC_DIR}/semantic_conventions/resource:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
-f /source code \
--template /templates/Attributes.php.j2 \
Expand All @@ -74,14 +77,16 @@ docker run --rm \
-DschemaUrl=$SCHEMA_URL

docker run --rm \
-v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/src/SemConv:/output \
-u ${UID} \
-v "${SPEC_DIR}/semantic_conventions/resource:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
-f /source code \
--template /templates/AttributeValues.php.j2 \
--output "/output/ResourceAttributeValues.php" \
-Dnamespace="OpenTelemetry\\SemConv" \
-Dclass="Resource" \
-DschemaUrl=$SCHEMA_URL

rm -rf "${SPEC_DIR}" || true
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare(strict_types=1);

namespace {{ namespace }};

class {{ class }}AttributeValues
interface {{ class }}AttributeValues
{
/**
* The URL of the OpenTelemetry schema for these keys and values.
Expand Down
2 changes: 1 addition & 1 deletion script/semantic-conventions/templates/Attributes.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare(strict_types=1);

namespace {{ namespace }};

class {{ class }}Attributes
interface {{ class }}Attributes
{
/**
* The URL of the OpenTelemetry schema for these keys and values.
Expand Down
6 changes: 3 additions & 3 deletions src/SemConv/ResourceAttributeValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace OpenTelemetry\SemConv;

class ResourceAttributeValues
interface ResourceAttributeValues
{
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.9.0';
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.12.0';
/**
* @see ResourceAttributes::CLOUD_PROVIDER Alibaba Cloud
*/
Expand Down Expand Up @@ -238,7 +238,7 @@ class ResourceAttributeValues
public const OS_TYPE_AIX = 'aix';

/**
* @see ResourceAttributes::OS_TYPE Oracle Solaris
* @see ResourceAttributes::OS_TYPE SunOS, Oracle Solaris
*/
public const OS_TYPE_SOLARIS = 'solaris';

Expand Down
74 changes: 60 additions & 14 deletions src/SemConv/ResourceAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,44 @@

namespace OpenTelemetry\SemConv;

class ResourceAttributes
interface ResourceAttributes
{
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.9.0';
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.12.0';

/**
* Array of brand name and version separated by a space.
*
* This value is intended to be taken from the UA client hints API (navigator.userAgentData.brands).
*
* @example Not A;Brand 99
* @example Chromium 99
* @example Chrome 99
*/
public const BROWSER_BRANDS = 'browser.brands';

/**
* The platform on which the browser is running.
*
* This value is intended to be taken from the UA client hints API (navigator.userAgentData.platform). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent.
* The list of possible values is defined in the W3C User-Agent Client Hints specification. Note that some (but not all) of these values can overlap with values in the os.type and os.name attributes. However, for consistency, the values in the `browser.platform` attribute should capture the exact value that the user agent provides.
*
* @example Windows
* @example macOS
* @example Android
*/
public const BROWSER_PLATFORM = 'browser.platform';

/**
* Full user-agent string provided by the browser.
*
* The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used.
*
* @example Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
*/
public const BROWSER_USER_AGENT = 'browser.user_agent';

/**
* Name of the cloud provider.
Expand Down Expand Up @@ -222,29 +254,43 @@ class ResourceAttributes
/**
* The name of the single function that this runtime instance executes.
*
* This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the `code.namespace`/`code.function` span attributes).
* This is the name of the function as configured/deployed on the FaaS
* platform and is usually different from the name of the callback
* function (which may be stored in the
* `code.namespace`/`code.function`
* span attributes).For some cloud providers, the above definition is ambiguous. The following
* definition of function name MUST be used for this attribute
* (and consequently the span name) for the listed cloud providers/products:<ul>
* <li><strong>Azure:</strong> The full name `<FUNCAPP>/<FUNC>`, i.e., function app name
* followed by a forward slash followed by the function name (this form
* can also be seen in the resource JSON for the function).
* This means that a span attribute MUST be used, as an Azure function
* app can host multiple functions that would usually share
* a TracerProvider (see also the `faas.id` attribute).</li>
* </ul>
*
* @example my-function
* @example myazurefunctionapp/some-function-name
*/
public const FAAS_NAME = 'faas.name';

/**
* The unique ID of the single function that this runtime instance executes.
*
* Depending on the cloud provider, use:<ul>
* <li><strong>AWS Lambda:</strong> The function ARN.</li>
* </ul>
* On some cloud providers, it may not be possible to determine the full ID at startup,
* so consider setting `faas.id` as a span attribute instead.The exact value to use for `faas.id` depends on the cloud provider:<ul>
* <li><strong>AWS Lambda:</strong> The function ARN.
* Take care not to use the &quot;invoked ARN&quot; directly but replace any
* alias suffix with the resolved function version, as the same runtime instance may be invokable with multiple
* different aliases.<ul>
* alias suffix
* with the resolved function version, as the same runtime instance may be invokable with
* multiple different aliases.</li>
* <li><strong>GCP:</strong> The URI of the resource</li>
* <li><strong>Azure:</strong> The Fully Qualified Resource ID.</li>
* <li><strong>Azure:</strong> The Fully Qualified Resource ID of the invoked function,
* <em>not</em> the function app, having the form
* `/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
* This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
* a TracerProvider.</li>
* </ul>
* On some providers, it may not be possible to determine the full ID at startup,
* which is why this field cannot be made required. For example, on AWS the account ID
* part of the ARN is not available without calling another AWS API
* which may be deemed too slow for a short-running lambda function.
* As an alternative, consider setting `faas.id` as a span attribute instead.
*
* @example arn:aws:lambda:us-west-2:123456789012:function:my-function
*/
Expand Down
35 changes: 30 additions & 5 deletions src/SemConv/TraceAttributeValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace OpenTelemetry\SemConv;

class TraceAttributeValues
interface TraceAttributeValues
{
/**
* The URL of the OpenTelemetry schema for these keys and values.
*/
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.9.0';
public const SCHEMA_URL = 'https://opentelemetry.io/schemas/1.12.0';
/**
* @see TraceAttributes::OPENTRACING_REF_TYPE The parent Span depends on the child Span in some capacity
*/
Expand Down Expand Up @@ -390,20 +390,25 @@ class TraceAttributeValues
public const FAAS_DOCUMENT_OPERATION_DELETE = 'delete';

/**
* @see TraceAttributes::HTTP_FLAVOR HTTP 1.0
* @see TraceAttributes::HTTP_FLAVOR HTTP/1.0
*/
public const HTTP_FLAVOR_HTTP_1_0 = '1.0';

/**
* @see TraceAttributes::HTTP_FLAVOR HTTP 1.1
* @see TraceAttributes::HTTP_FLAVOR HTTP/1.1
*/
public const HTTP_FLAVOR_HTTP_1_1 = '1.1';

/**
* @see TraceAttributes::HTTP_FLAVOR HTTP 2
* @see TraceAttributes::HTTP_FLAVOR HTTP/2
*/
public const HTTP_FLAVOR_HTTP_2_0 = '2.0';

/**
* @see TraceAttributes::HTTP_FLAVOR HTTP/3
*/
public const HTTP_FLAVOR_HTTP_3_0 = '3.0';

/**
* @see TraceAttributes::HTTP_FLAVOR SPDY protocol
*/
Expand Down Expand Up @@ -579,6 +584,26 @@ class TraceAttributeValues
*/
public const FAAS_INVOKED_PROVIDER_TENCENT_CLOUD = 'tencent_cloud';

/**
* @see TraceAttributes::RPC_SYSTEM gRPC
*/
public const RPC_SYSTEM_GRPC = 'grpc';

/**
* @see TraceAttributes::RPC_SYSTEM Java RMI
*/
public const RPC_SYSTEM_JAVA_RMI = 'java_rmi';

/**
* @see TraceAttributes::RPC_SYSTEM .NET WCF
*/
public const RPC_SYSTEM_DOTNET_WCF = 'dotnet_wcf';

/**
* @see TraceAttributes::RPC_SYSTEM Apache Dubbo
*/
public const RPC_SYSTEM_APACHE_DUBBO = 'apache_dubbo';

/**
* @see TraceAttributes::MESSAGING_OPERATION receive
*/
Expand Down
Loading