Skip to content

Commit a325a8f

Browse files
authored
update semconv to 1.22.0 (#1126)
* update semver to 1.22.0 Since 1.19.0, the source has been split out of opentelemetry-specifiction into semantic-conventions. Update the build script accordingly. Update to latest generator. Add 2 new deprecations for semconvs which were renamed since 1.19 * update telemetry semconv
1 parent 842aa41 commit a325a8f

File tree

5 files changed

+1552
-776
lines changed

5 files changed

+1552
-776
lines changed

script/semantic-conventions/semconv.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1010
ROOT_DIR="${SCRIPT_DIR}/../../"
11-
SPEC_DIR="${ROOT_DIR}/var/opentelemetry-specification"
11+
SPEC_DIR="${ROOT_DIR}/var/semantic-conventions"
1212
CODE_DIR="${ROOT_DIR}/src/SemConv"
1313

1414
# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
15-
SEMCONV_VERSION=${SEMCONV_VERSION:=1.19.0}
15+
SEMCONV_VERSION=${SEMCONV_VERSION:=1.22.0}
1616
SPEC_VERSION=v$SEMCONV_VERSION
1717
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
18-
GENERATOR_VERSION=0.18.0
18+
GENERATOR_VERSION=0.22.0
1919

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

@@ -24,7 +24,7 @@ mkdir "${SPEC_DIR}"
2424
cd "${SPEC_DIR}" || exit
2525

2626
git init -b main
27-
git remote add origin https://github.com/open-telemetry/opentelemetry-specification.git
27+
git remote add origin https://github.com/open-telemetry/semantic-conventions.git
2828
git fetch origin "$SPEC_VERSION"
2929
git reset --hard FETCH_HEAD
3030

@@ -35,13 +35,14 @@ find "${CODE_DIR}" -name "*.php" -exec rm -f {} \;
3535

3636
# Trace
3737
docker run --rm \
38-
-v "${SPEC_DIR}/semantic_conventions:/source" \
38+
-v "${SPEC_DIR}/model:/source" \
3939
-v "${SCRIPT_DIR}/templates:/templates" \
4040
-v "${CODE_DIR}:/output" \
4141
-u "${UID}" \
4242
otel/semconvgen:$GENERATOR_VERSION \
4343
--only span,event,attribute_group,scope \
44-
-f /source code \
44+
--yaml-root /source \
45+
code \
4546
--template /templates/Attributes.php.j2 \
4647
--output "/output/TraceAttributes.php" \
4748
-Dnamespace="OpenTelemetry\\SemConv" \
@@ -50,13 +51,14 @@ docker run --rm \
5051

5152
# Resource
5253
docker run --rm \
53-
-v "${SPEC_DIR}/semantic_conventions:/source" \
54+
-v "${SPEC_DIR}/model:/source" \
5455
-v "${SCRIPT_DIR}/templates:/templates" \
5556
-v "${CODE_DIR}:/output" \
5657
-u "${UID}" \
5758
otel/semconvgen:$GENERATOR_VERSION \
5859
--only resource \
59-
-f /source code \
60+
--yaml-root /source \
61+
code \
6062
--template /templates/Attributes.php.j2 \
6163
--output "/output/ResourceAttributes.php" \
6264
-Dnamespace="OpenTelemetry\\SemConv" \
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
/**
2-
* @deprecated
2+
* @deprecated Use USER_AGENT_ORIGINAL
33
*/
44
public const BROWSER_USER_AGENT = 'browser.user_agent';
55

66
/**
7-
* @deprecated
7+
* @deprecated Use CLOUD_RESOURCE_ID
88
*/
99
public const FAAS_ID = 'faas.id';
10+
11+
/**
12+
* @deprecated Use TELEMETRY_DISTRO_VERSION
13+
*/
14+
public const TELEMETRY_AUTO_VERSION = 'telemetry.auto.version';
15+
16+
/**
17+
* @deprecated Use CONTAINER_IMAGE_TAGS
18+
*/
19+
public const CONTAINER_IMAGE_TAG = 'container.image.tag';

src/SDK/Resource/Detectors/Sdk.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function getResource(): ResourceInfo
4444
}
4545

4646
if (extension_loaded('opentelemetry')) {
47-
$attributes[ResourceAttributes::TELEMETRY_AUTO_VERSION] = phpversion('opentelemetry');
47+
$attributes[ResourceAttributes::TELEMETRY_DISTRO_NAME] = 'opentelemetry-php-instrumentation';
48+
$attributes[ResourceAttributes::TELEMETRY_DISTRO_VERSION] = phpversion('opentelemetry');
4849
}
4950

5051
return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);

0 commit comments

Comments
 (0)