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

Include tracing_stackdriver layer to format logs for GCP #803

Merged
merged 2 commits into from
Aug 6, 2024

Conversation

Pessina
Copy link
Contributor

@Pessina Pessina commented Aug 6, 2024

This PR includes the tracing-stackdriver layer to format the logs for GCP so we can apply custom filters on the data.

Related ticket: #795

@Pessina Pessina changed the title Include tracing_stackdriver layer to format logs on GCP format Include tracing_stackdriver layer to format logs for GCP Aug 6, 2024
@volovyks volovyks linked an issue Aug 6, 2024 that may be closed by this pull request
@volovyks
Copy link
Collaborator

volovyks commented Aug 6, 2024

@Pessina I guess the only way to check it is to merge it. Have you done any kind of testing?

@Pessina
Copy link
Contributor Author

Pessina commented Aug 6, 2024

@volovyks I created a demo repo to test it and check the logs output.

This is the new format with the added stackdriver layer:

2024-08-06T07:35:04.149541Z  INFO ThreadId(01) main: tracing_sandbox: User logged in
{"time":"2024-08-06T07:35:04.1496Z","target":"tracing_sandbox","logging.googleapis.com/sourceLocation":{"file":"src/main.rs","line":"29"},"span":{"name":"main"},"spans":[{"name":"main"}],"severity":"INFO","message":"User logged in"}

2024-08-06T07:35:04.149734Z DEBUG ThreadId(01) main: tracing_sandbox: User session created
{"time":"2024-08-06T07:35:04.149743Z","target":"tracing_sandbox","logging.googleapis.com/sourceLocation":{"file":"src/main.rs","line":"30"},"span":{"name":"main"},"spans":[{"name":"main"}],"severity":"DEBUG","message":"User session created"}

2024-08-06T07:35:04.149766Z  WARN ThreadId(01) main: tracing_sandbox: Some warning
{"time":"2024-08-06T07:35:04.149772Z","target":"tracing_sandbox","logging.googleapis.com/sourceLocation":{"file":"src/main.rs","line":"31"},"span":{"name":"main"},"spans":[{"name":"main"}],"severity":"WARNING","message":"Some warning"}

2024-08-06T07:35:04.149791Z ERROR ThreadId(01) main: tracing_sandbox: Critical operation failed
{"time":"2024-08-06T07:35:04.149796Z","target":"tracing_sandbox","logging.googleapis.com/sourceLocation":{"file":"src/main.rs","line":"32"},"span":{"name":"main"},"spans":[{"name":"main"}],"severity":"ERROR","message":"Critical operation failed"}

But as I can't run on MPC i didn't tested there.

@Pessina Pessina merged commit a7155cf into develop Aug 6, 2024
3 checks passed
@Pessina Pessina deleted the felipe/format-gcp-logs branch August 6, 2024 08:15
@volovyks
Copy link
Collaborator

volovyks commented Aug 6, 2024

@Pessina ok, let's test it in real env.

@ChaoticTempest
Copy link
Member

we should be putting this formatter inside the is_running_on_gcp() call only because now for testing, every other log is showing these extra lines which is going to get annoying

@volovyks volovyks mentioned this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracing log level does not correspond with level in GCP logs
3 participants