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

Document instrumentation semantic conventions #1778

Open
Tracked by #4572
dyladan opened this issue Nov 8, 2023 · 14 comments
Open
Tracked by #4572

Document instrumentation semantic conventions #1778

dyladan opened this issue Nov 8, 2023 · 14 comments
Labels
contribfest These small and isolated issues are suitable for Kubecon Contribfest

Comments

@dyladan
Copy link
Member

dyladan commented Nov 8, 2023

Many packages in OTel JS Contrib export telemetry with out of date semantic conventions. Unfortunately, we have not clearly documented the version of semantic conventions implemented or which attributes are exported for instrumentations. For each package, we need to document the telemetry exported and if possible update it to the latest semantic conventions following the following template:

This package implements the <xxxx> semantic convention version X.Y: <link to semantic convention>

Attributes collected:

| Attribute | Short Description | Notes |
| --------- | ----------------- | ----- |
|           |                   |       |

Please limit PRs to a single package in order to make them quickly and easily reviewable.
If you are working on one of the below packages, please comment so others know the issue is being worked on.

  • @opentelemetry/instrumentation-amqplib
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-cucumber
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-dataloader
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-fs
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-lru-memoizer
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-mongoose
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-socket.io
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-tedious
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-aws-lambda
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-aws-sdk
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-bunyan
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-cassandra-driver
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-connect
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-dns
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-express
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-fastify
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-generic-pool
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-graphql
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-hapi
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-ioredis
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-knex
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-koa
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-memcached
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-mongodb
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-mysql
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-mysql2
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-nestjs-core
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-net
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-pg
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-pino
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-redis-4
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-redis
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-restify
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-router
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-winston
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-document-load
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-long-task
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-user-interaction
    • Semantic conventions up to date
    • README documents exported telemetry
  • @opentelemetry/instrumentation-undici
    • Semantic conventions up to date
    • README documents exported telemetry
@dyladan dyladan added the contribfest These small and isolated issues are suitable for Kubecon Contribfest label Nov 8, 2023
@serverless-mom
Copy link

Going to take a look at instrumentation-fs

@pkanal
Copy link
Contributor

pkanal commented Nov 8, 2023

👋🏽 If you're taking a look at this issue for contribfest, please comment which package you're specifically working on!

@maig123
Copy link

maig123 commented Nov 8, 2023

will take a shot at instrumentation-amqlibs

@JamieDanielson
Copy link
Member

@dyladan I don't think we want the "latest" semantic conventions just yet, right, because of the breaking changes in HTTP attributes. I think we'd want to ensure we have the latest before the break (so v1.20), and then an issue/PR to add the OTEL_SEMCONV_STABILITY_OPT_IN environment variable to allow for opting into the new attributes and/or dual attributes?

@dyladan
Copy link
Member Author

dyladan commented Jan 18, 2024

Yes I think so

@JamieDanielson
Copy link
Member

Here is my understanding of the current state:

Each package uses either @opentelemetry/semantic-conventions, of which our latest version is 1.20 based on current stable otel-js release, or hard-codes attributes (haven't confirmed if this hard-coding exists or not, just speculating).

Our package @opentelemetry/semantic-conventions uses attributes generated from otel-js scripts/semconv, which currently uses spec version 1.7.0.

This means any packages using our @opentelemetry/semantic-conventions package are using semantic convention version 1.7, but we want to be on semantic convention version 1.20. As an example, here is http.user_agent in our package which does not match the newly named user_agent.original that was introduced in v1.19.0.

I guess that is what is referenced in open-telemetry/opentelemetry-js#4235, which I'm also now realizing has a somewhat recent update to it. These two things will be very much in line. One possible approach for the immediate term would be to simply document all of these packages in this issue to say they emit semantic convention version 1.7, and if any semantic convention attribute is hard-coded in a package it should be replaced with the constant. Then separately we address open-telemetry/opentelemetry-js#4235 to update semantic conventions. Eventually we will then want to upgrade to 1.23+ with the aforementioned variables to ease pain on end users, but it seems we have some steps to take first.

What do you think?

@JamieDanielson
Copy link
Member

I opened a PR for Express to help get this started and to have as a guide for the others. Can you take a look and confirm whether this is what we're trying to do, or if I'm missing more on this?

@pichlermarc
Copy link
Member

I opened a PR for Express to help get this started and to have as a guide for the others. Can you take a look and confirm whether this is what we're trying to do, or if I'm missing more on this?

I think it does exactly the right thing, thanks for taking care of that. 👍

@JamieDanielson
Copy link
Member

For others that come across this and want to update for another package, this is the structure added to the Express instrumentation package, which can be used as a guide for the other packages:

## Semantic Conventions

This package uses `@opentelemetry/semantic-conventions` version `1.0+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)

Attributes collected:

| Attribute    | Short Description                  | Notes             |
| ------------ | ---------------------------------- | ----------------- |
| `http.route` | The matched route (path template). | Key: `HTTP_ROUTE` |

@JamieDanielson JamieDanielson changed the title Update and document instrumentation semantic conventions Document instrumentation semantic conventions Mar 21, 2024
@JamieDanielson
Copy link
Member

Updating instrumentation-document-load package #2039 to document semantic conventions

@trentm
Copy link
Contributor

trentm commented Apr 5, 2024

@JamieDanielson (/cc @pichlermarc @maryliag @david-luna): About the Attributes collected: table.

Is there much value in the Notes column with the Key: SOME_VAR values?

I think these property names on the semconv package are internal implementation details that the user of these packages doesn't need to know about. When a user uses @opentelemetry/instrumentation-express, this table is helpful to know that they should expect the http.route attribute on spans. However, they have no need to know about:

import { SEMATTRS_HTTP_ROUTE } from '@opentelemetry/semantic-conventions';

Having that column is more just a (light) maintenance burden, and distraction.

Thoughts?


I realize I'm asking a little late. There are a lot of PRs for this and #2025 that are adding this table to READMEs.

@maryliag
Copy link
Contributor

maryliag commented Apr 5, 2024

I agree. I believe the columns for Attribute and Descriptions are important, this is why I was creating several PRs to add them, but don't see much value on adding the key column, since it doesn't affect the usage and the user shouldn't care about it. Also, as you mention adds overhead to maintain.

@JamieDanielson
Copy link
Member

Yeah that's a fair point. I can see it being plenty useful to keep just the attribute key and short description, and omitting the internal key field. So instead of previous it could just be (after the exported string change, 1.0+ becomes 1.22+)

## Semantic Conventions

This package uses `@opentelemetry/semantic-conventions` version `1.0+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)

Attributes collected:

| Attribute    | Short Description                  | 
| ------------ | ---------------------------------- | 
| `http.route` | The matched route (path template). |

@JamieDanielson
Copy link
Member

Okay, I left a comment on #2077 about this... sorry for the confusion heh but I'm okay with making the decision to omit the Notes column with the key. The attribute itself is the most important bit. @dyladan I guess let us know if you feel strongly about us keeping the Notes column, I think we've been kinda figuring it out as we go so I don't think there will be objection but wanted to check since you were the first to create this issue. Also maybe @pichlermarc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribfest These small and isolated issues are suitable for Kubecon Contribfest
Projects
None yet
Development

No branches or pull requests

8 participants