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

Add Gen AI user and session Semantic Conventions #1872

Open
kunshuo opened this issue Feb 5, 2025 · 5 comments
Open

Add Gen AI user and session Semantic Conventions #1872

kunshuo opened this issue Feb 5, 2025 · 5 comments
Labels
enhancement New feature or request experts needed This issue or pull request is outside an area where general approvers feel they can approve

Comments

@kunshuo
Copy link

kunshuo commented Feb 5, 2025

Area(s)
area:gen-ai

Propose new conventions

In the application scenario of large language models, C-end customers often have multiple rounds of conversations. It is necessary to record the C-end customers and sessions to which different requests belong, so as to conduct session-level analysis and analyze the long-term memory problem of the model in the session context. At the same time, the C-end customers and session dimensions can also be analyzed to count the activity and token consumption.

Describe the solution you'd like

gen_ai.user.id records the unique identity of the C-end user, and gen_ai.session.id records the session identifier.

These two identifiers will be transparently transmitted in the trace request, spanning multiple spans of the same trace.

@lmolkova @nirga @drewby @karthikscale3

@kunshuo kunshuo added enhancement New feature or request experts needed This issue or pull request is outside an area where general approvers feel they can approve labels Feb 5, 2025
@kunshuo kunshuo changed the title Add Gen AI user and session Add Gen AI user and session Semantic Conventions Feb 5, 2025
@lmolkova
Copy link
Contributor

lmolkova commented Feb 5, 2025

We have general-purpose enduser and session semantic conventions that are . They are intended to represent user's identity and session initiated by the client app.
They should be used in all scenarios including GenAI.

Could you please clarify if there is something new we need to add around GenAI?

@Cirilla-zmh
Copy link

They should be used in all scenarios including GenAI.

Yeah, I believe the common semantic conventions you mentioned are what we need. However, it seems that these attributes are not listed as the conditionally required/recommended items in GenAI spans.

Considering that session plays a key role in GenAI, I think session.id should be conditionally required.

"Enduser" may not be required in some scenarios where there is indeed no role for an end user, but I believe it is still a recommended attribute.

@Cirilla-zmh
Copy link

Several added context here:

We injected the enduser.id and session.id into the baggage so that they could be captured in spans and metrics (the session.id wouldn't be tagged in metrics). This allows us to filter specific end user or session data for further detailed analysis.

@lmolkova
Copy link
Contributor

lmolkova commented Feb 6, 2025

we can document them, it's not possible to require them since GenAI related instrumentation on the backend service don't usually have this information.

It's part of application/OTel distro to propagate user/session information and stamp it on all telemetry. We can definitely document this in GenAI conventions.

@Cirilla-zmh
Copy link

it's not possible to require them

Agree. And that's why I call them "conditionally required" (or "recommended").

We can definitely document this in GenAI conventions.

Of course! If you plan to document this with a new PR, could you please cc me so that I can learn the necessary steps? We intend to add Alibaba vendor (also known as Dashscope) semantic conventions to reduce communication costs and standardize our conventions. Thank you very much!
cc @kunshuo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experts needed This issue or pull request is outside an area where general approvers feel they can approve
Development

No branches or pull requests

4 participants