Skip to content

Commit

Permalink
semconv 1.27.0 (#1356)
Browse files Browse the repository at this point in the history
* generate semconv 1.27.0

* improve attribute values brief and deprecation display

* remove duplicate trace attribute, ignore deprecated attributes

* fix tests
  • Loading branch information
brettmc authored Aug 6, 2024
1 parent d2ec5e6 commit 382331e
Show file tree
Hide file tree
Showing 11 changed files with 2,405 additions and 587 deletions.
8 changes: 4 additions & 4 deletions script/semantic-conventions/semconv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ 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.26.0}
SEMCONV_VERSION=${SEMCONV_VERSION:=1.27.0}
SPEC_VERSION=v$SEMCONV_VERSION
SCHEMA_URL=https://opentelemetry.io/schemas/$SEMCONV_VERSION
GENERATOR_VERSION=0.24.0
GENERATOR_VERSION=0.25.0

cd "${SCRIPT_DIR}"

Expand All @@ -45,7 +45,7 @@ docker run --rm \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
--only span,event,attribute_group,scope \
--only span,event,attribute_group \
--yaml-root /source \
code \
--template /templates/Attributes.php.j2 \
Expand Down Expand Up @@ -77,7 +77,7 @@ docker run --rm \
-v "${CODE_DIR}:/output" \
-u "${UID}" \
otel/semconvgen:$GENERATOR_VERSION \
--only span,event,attribute_group,scope \
--only span,event,attribute_group \
--yaml-root /source \
code \
--template /templates/AttributeValues.php.j2 \
Expand Down
7 changes: 6 additions & 1 deletion script/semantic-conventions/templates/AttributeValues.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ interface {{ class }}AttributeValues
{%- for member in attribute.attr_type.members %}
{%- if member.brief %}
/**
* @see {{ class }}Attributes::{{ attribute.fqn | to_const_name }} {% filter escape %}{{member.brief | to_doc_brief}}{% endfilter %}
* {% filter escape %}{{member.brief | to_doc_brief}}{% endfilter %}
*
* @see {{ class }}Attributes::{{ attribute.fqn | to_const_name }}
{%- if member.note %}
*
* {{ member.note | render_markdown(code="<code>{0}</code>", paragraph="{0}") | regex_replace(pattern="\n", replace="\n * ") }}
{%- endif %}
{%- if member | is_deprecated %}
* @deprecated {{ member.deprecated | to_doc_brief }}.
{%- endif %}
*/
{%- endif %}
public const {{ attribute.fqn | to_const_name }}_{{ member.member_id | to_const_name }} = '{{ member.value }}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
* @deprecated Use `otel.scope.version`
*/
public const OTEL_LIBRARY_VERSION = 'otel.library.version';

/**
* @deprecated Use `deployment.environment.name`
*/
public const DEPLOYMENT_ENVIRONMENT = 'deployment.environment';
6 changes: 3 additions & 3 deletions src/SDK/Trace/SpanLimitsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function retainGeneralIdentityAttributes(bool $retain = true): SpanLimits

/**
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#span-limits
* @phan-suppress PhanDeprecatedClassConstant
*/
public function build(): SpanLimits
{
Expand All @@ -131,9 +132,8 @@ public function build(): SpanLimits

if (!$this->retainGeneralIdentityAttributes) {
$spanAttributesFactory = new FilteredAttributesFactory($spanAttributesFactory, [
TraceAttributes::ENDUSER_ID,
TraceAttributes::ENDUSER_ROLE,
TraceAttributes::ENDUSER_SCOPE,
TraceAttributes::USER_ID,
TraceAttributes::USER_ROLES,
]);
}

Expand Down
Loading

0 comments on commit 382331e

Please sign in to comment.