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

Expose a way to get session id #390

Closed
nicgirault opened this issue May 6, 2020 · 5 comments
Closed

Expose a way to get session id #390

nicgirault opened this issue May 6, 2020 · 5 comments
Labels

Comments

@nicgirault
Copy link

In my app, there is a "debug" page allowing users to send us a report. I would like to be able to display the session id in this report to help the support team accessing the logs corresponding to the session.

Right now I've to do something like this:

(datadogLogs.logger as any).session.getId()

It would be convenient to be able to do something like:

datadogLogs.getSessionId()

or

datadogLogs.session.getId()

meaning that the session would not be anymore a private attribute here: https://github.com/DataDog/browser-sdk/blob/master/packages/logs/src/logger.ts#L132

@bcaudan
Copy link
Contributor

bcaudan commented May 6, 2020

Hi @nicgirault,

Thanks for raising that, it is an interesting use case.
Let us think about how we would want to expose it and we will get back to you.

@bcaudan bcaudan added the enhancement New feature or request label May 28, 2020
@bcaudan bcaudan added the logs label Jun 18, 2020
@bcaudan bcaudan changed the title [typescript] expose a way to get logger session id Expose a way to get session id May 7, 2021
@ivanzusko
Copy link

Hi there 👋
Sorry for the disturbance. May I ask is there any progress on exposing a way to get session-id?

@bcaudan
Copy link
Contributor

bcaudan commented Jun 24, 2021

👋 Not at the moment
I think a consistent way to do that would be to expose a getInternalContext API like on the RUM side.
Happy to review a PR about it 😉

@paul-cla
Copy link

I came here looking for this information, and with the above hints I put DD_RUM.getInternalContext() into the Chrome console and one of the returned values is session_id. Is this what you're looking for?

@liywjl
Copy link
Contributor

liywjl commented Jul 15, 2022

Hello 👋

We have added getInternalContext to DD_LOGS which should be available on version 4.15.0 of the SDK. This should allow access to session_id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants