From 4fc170002d3d7d123ec1a1e73243c50b53eaf6d1 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Wed, 28 Aug 2024 19:20:31 +1000 Subject: [PATCH] re-adding removed trace attribute values (#1368) the MESSAGING_OPERATION_* attribute values were removed in semconv 1.26.0, so update our generation to put them back, marking as deprecated --- script/semantic-conventions/README.md | 2 ++ .../templates/AttributeValues.php.j2 | 2 ++ .../trace_values_deprecations.php.partial | 24 ++++++++++++++++++ src/SemConv/ResourceAttributeValues.php | 1 + src/SemConv/TraceAttributeValues.php | 25 +++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 script/semantic-conventions/templates/trace_values_deprecations.php.partial diff --git a/script/semantic-conventions/README.md b/script/semantic-conventions/README.md index 55be92c61..6b091e396 100644 --- a/script/semantic-conventions/README.md +++ b/script/semantic-conventions/README.md @@ -35,6 +35,8 @@ Use this output as a basis for updating the relevant deprecations file and gener Note that some previously-removed semconv entries have been added back in recent versions, so may need to be removed from the deprecations partials. +NB should also check `TraceAttributeValues` and `ResourceAttributeValues`, since those can also change. + ## Add to SemConv/Version Add an entry to `src/SemConv/Version.php` for the new version. diff --git a/script/semantic-conventions/templates/AttributeValues.php.j2 b/script/semantic-conventions/templates/AttributeValues.php.j2 index c7a836fd7..4b102be82 100644 --- a/script/semantic-conventions/templates/AttributeValues.php.j2 +++ b/script/semantic-conventions/templates/AttributeValues.php.j2 @@ -36,5 +36,7 @@ interface {{ class }}AttributeValues {%- endif -%} {% if not loop.last %}{# blank line #}{% endif %} {%- endfor -%} +{# add our own deprecations for moved/removed values, so we don't break things #} +{% include class|lower + "_values_deprecations.php.partial" ignore missing without context %} } {# blank line #} diff --git a/script/semantic-conventions/templates/trace_values_deprecations.php.partial b/script/semantic-conventions/templates/trace_values_deprecations.php.partial new file mode 100644 index 000000000..4d2500093 --- /dev/null +++ b/script/semantic-conventions/templates/trace_values_deprecations.php.partial @@ -0,0 +1,24 @@ + /** + * @deprecated Use `messaging.operation.type.publish` + */ + public const MESSAGING_OPERATION_PUBLISH = 'publish'; + + /** + * @deprecated Use `messaging.operation.type.create` + */ + public const MESSAGING_OPERATION_CREATE = 'create'; + + /** + * @deprecated Use `messaging.operation.type.receive` + */ + public const MESSAGING_OPERATION_RECEIVE = 'receive'; + + /** + * @deprecated Use `messaging.operation.type.deliver` + */ + public const MESSAGING_OPERATION_DELIVER = 'process'; + + /** + * @deprecated Use `messaging.operation.type.settle` + */ + public const MESSAGING_OPERATION_SETTLE = 'settle'; diff --git a/src/SemConv/ResourceAttributeValues.php b/src/SemConv/ResourceAttributeValues.php index 6be5fbb90..11880b165 100644 --- a/src/SemConv/ResourceAttributeValues.php +++ b/src/SemConv/ResourceAttributeValues.php @@ -487,4 +487,5 @@ interface ResourceAttributeValues * @see ResourceAttributes::TELEMETRY_SDK_LANGUAGE */ public const TELEMETRY_SDK_LANGUAGE_WEBJS = 'webjs'; + } diff --git a/src/SemConv/TraceAttributeValues.php b/src/SemConv/TraceAttributeValues.php index 65151d3ad..d832a0338 100644 --- a/src/SemConv/TraceAttributeValues.php +++ b/src/SemConv/TraceAttributeValues.php @@ -3144,4 +3144,29 @@ interface TraceAttributeValues * @see TraceAttributes::VCS_REPOSITORY_REF_TYPE */ public const VCS_REPOSITORY_REF_TYPE_TAG = 'tag'; + + /** + * @deprecated Use `messaging.operation.type.publish` + */ + public const MESSAGING_OPERATION_PUBLISH = 'publish'; + + /** + * @deprecated Use `messaging.operation.type.create` + */ + public const MESSAGING_OPERATION_CREATE = 'create'; + + /** + * @deprecated Use `messaging.operation.type.receive` + */ + public const MESSAGING_OPERATION_RECEIVE = 'receive'; + + /** + * @deprecated Use `messaging.operation.type.deliver` + */ + public const MESSAGING_OPERATION_DELIVER = 'process'; + + /** + * @deprecated Use `messaging.operation.type.settle` + */ + public const MESSAGING_OPERATION_SETTLE = 'settle'; }