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

documentation request: example of adding trace and spanId properties to log for Cloud Logging #153

Open
naseemkullah opened this issue Aug 18, 2020 · 5 comments
Labels
documentation Improvements or additions to documentation enhancement accepted An actionable enhancement for which PRs will be accepted priority: p2

Comments

@naseemkullah
Copy link

Please see https://cloud.google.com/trace/docs/trace-log-integration

@naseemkullah
Copy link
Author

In particular I'd like to know the best practice on fetching the project Id for a workload running in GCP since the trace value needs to be:

   projects/[PROJECT_ID]/traces/[TRACE_ID]

I've avoided added PROJECT_ID or equivalent as an env var for workloads, and would preferably continue to.

Also looked at https://github.com/googleapis/gcp-metadata#access-specific-properties which seems a little involved.

Any suggestions? @kintel @steren @jonahrosenblum

@kintel
Copy link

kintel commented Aug 19, 2020

I think the best way to obtain the Project ID is likely asking GoogleAuth: https://github.com/googleapis/google-auth-library-nodejs#choosing-the-correct-credential-type-automatically. Google auth also have a bunch of internal ways of obtaining the Project ID from common env. variables etc.

However, since this exporter already does the job of determining the correct Project ID (

this._projectId = this._auth.getProjectId().catch(err => {
), we may want to expose that as a public API here. As adding a public API would be something we need to consider across all languages, that's unlikely to happen very soon.

@aabmass Is this something you could look into, perhaps by zooming out a bit and thinking about how to write logs with correct Trace info from a OpenTelemetry-instrumented app?

@aabmass aabmass added documentation Improvements or additions to documentation priority: p3 enhancement accepted An actionable enhancement for which PRs will be accepted labels Nov 9, 2022
@aabmass
Copy link
Contributor

aabmass commented Nov 9, 2022

I think it would be easy to update our documentation here showing how to get the project ID and trace ID. We should also explore linking to integrations with Cloud Logging SDK and OTel Logging SDK which is actively being worked on.

@aabmass
Copy link
Contributor

aabmass commented Feb 13, 2023

Triaged again. We'd like to provide and document a better story for correlating traces and logs. Raised to p2

@dashpole
Copy link
Contributor

Still relevant, and something we plan to tackle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement accepted An actionable enhancement for which PRs will be accepted priority: p2
Projects
None yet
Development

No branches or pull requests

4 participants