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 semconv to 1.22.0 #1126

Merged
merged 2 commits into from
Oct 18, 2023
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
18 changes: 10 additions & 8 deletions script/semantic-conventions/semconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

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

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

cd "${SCRIPT_DIR}" || exit

Expand All @@ -24,7 +24,7 @@ mkdir "${SPEC_DIR}"
cd "${SPEC_DIR}" || exit

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

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

# Trace
docker run --rm \
-v "${SPEC_DIR}/semantic_conventions:/source" \
-v "${SPEC_DIR}/model:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
--only span,event,attribute_group,scope \
-f /source code \
--yaml-root /source \
code \
--template /templates/Attributes.php.j2 \
--output "/output/TraceAttributes.php" \
-Dnamespace="OpenTelemetry\\SemConv" \
Expand All @@ -50,13 +51,14 @@ docker run --rm \

# Resource
docker run --rm \
-v "${SPEC_DIR}/semantic_conventions:/source" \
-v "${SPEC_DIR}/model:/source" \
-v "${SCRIPT_DIR}/templates:/templates" \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
--only resource \
-f /source code \
--yaml-root /source \
code \
--template /templates/Attributes.php.j2 \
--output "/output/ResourceAttributes.php" \
-Dnamespace="OpenTelemetry\\SemConv" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
/**
* @deprecated
* @deprecated Use USER_AGENT_ORIGINAL
*/
public const BROWSER_USER_AGENT = 'browser.user_agent';

/**
* @deprecated
* @deprecated Use CLOUD_RESOURCE_ID
*/
public const FAAS_ID = 'faas.id';

/**
* @deprecated Use TELEMETRY_DISTRO_VERSION
*/
public const TELEMETRY_AUTO_VERSION = 'telemetry.auto.version';

/**
* @deprecated Use CONTAINER_IMAGE_TAGS
*/
public const CONTAINER_IMAGE_TAG = 'container.image.tag';
3 changes: 2 additions & 1 deletion src/SDK/Resource/Detectors/Sdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public function getResource(): ResourceInfo
}

if (extension_loaded('opentelemetry')) {
$attributes[ResourceAttributes::TELEMETRY_AUTO_VERSION] = phpversion('opentelemetry');
$attributes[ResourceAttributes::TELEMETRY_DISTRO_NAME] = 'opentelemetry-php-instrumentation';
$attributes[ResourceAttributes::TELEMETRY_DISTRO_VERSION] = phpversion('opentelemetry');
}

return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);
Expand Down
Loading