opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

[opentelemetry-php-instrumentation] schema_url with fixed value

Open weslenteche opened this issue 1 year ago • 3 comments

Hello everyone, I currently identified that the auto-instrumentation packages (PSR-6 and Slim) incorporate the schema_url value with a fixed value, as shown in this code.

However, the packages install the latest version of open-telemetry/sem-conv, which can become a problem in these cases where the value is fixed.

I would like to suggest the following changes:

  • Use the TraceAttributes::SCHEMA_URL constant instead of a fixed value. Similar to what happens in the Guzzle packages, as shown in this code.
  • Add to all packages that do not yet use TraceAttributes::SCHEMA_URL in instrumentation.

weslenteche avatar May 17 '24 16:05 weslenteche

Previous discussions:

  • https://github.com/open-telemetry/opentelemetry-php-contrib/pull/259#discussion_r1586858959
  • https://github.com/open-telemetry/opentelemetry-php/pull/1149#issuecomment-1842639422

Tl;dr: fixed schema urls should be used instead of TraceAttributes::SCHEMA_URL.

Nevay avatar May 17 '24 17:05 Nevay

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/telemetry-stability.md#schema-file-driven-telemetry-producers - any of our instrumentations that are stable should have a fixed schema URL set, and it must not change (even if the semconv version does). There's some leniency in the spec to change the version in non-stable instrumentations (ie, any of our packages still on 0.x or beta).

So, I think that there's a task to go through our existing instrumentations to ensure that they do have a schema url set, and that it's fixed. Anything that's <= 1.0 could have its schema url updated to the latest semconv version.

brettmc avatar May 18 '24 06:05 brettmc

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/telemetry-stability.md#schema-file-driven-telemetry-producers - any of our instrumentations that are stable should have a fixed schema URL set, and it must not change (even if the semconv version does). There's some leniency in the spec to change the version in non-stable instrumentations (ie, any of our packages still on 0.x or beta).

So, I think that there's a task to go through our existing instrumentations to ensure that they do have a schema url set, and that it's fixed. Anything that's <= 1.0 could have its schema url updated to the latest semconv version.

I will perform an analysis on contrib packages lower than <= 1.0.0 and create pull requests by updating or inserting the url schemas.

weslenteche avatar Jun 13 '24 23:06 weslenteche