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 tenantId to each log lines #810

Merged
merged 2 commits into from
Jan 22, 2024
Merged

add tenantId to each log lines #810

merged 2 commits into from
Jan 22, 2024

Conversation

Yuqi-Du
Copy link
Contributor

@Yuqi-Du Yuqi-Du commented Jan 18, 2024

What this PR does:
add tenantId to each log lines
Using MDC, the Quarkus takes care of propagating the properties that we set from the event loop threads to the worker threads.

sample log
{"timestamp":"2024-01-18T09:48:36.366727-08:00","sequence":3334,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.stargate.sgv2.jsonapi.service.cqldriver.executor.QueryExecutor","level":"ERROR","message":"cql SELECT key, tx_id, doc_json FROM purchase_database.my_vsearch WHERE array_contains CONTAINS ? LIMIT 2147483647 value [address N123]","threadName":"vert.x-eventloop-thread-2","threadId":196,"mdc":{"tenantId":"unknown","spanId":"45c8ddd73498b50c","traceId":"d8f7ea0b41daa7200b8fb3ba53b52461","sampled":"true"},"ndc":"","hostName":"yuqi-du-x66h1xw5m2","processName":"sgv2-jsonapi-dev.jar","processId":16883}
Which issue(s) this PR fixes:
Fixes jira https://datastax.jira.com/jira/software/c/projects/C2/boards/525?search=line&selectedIssue=C2-3195

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@Yuqi-Du Yuqi-Du requested a review from a team as a code owner January 18, 2024 23:45
Copy link
Contributor

@jeffreyscarpenter jeffreyscarpenter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the following output in the unit test log:

2024-01-18T23:47:43.7758855Z {"timestamp":"2024-01-18T23:47:43.73542461Z","sequence":491,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus.grpc.runtime.supports.Channels","level":"INFO","message":"Shutting down gRPC channel ManagedChannelOrphanWrapper{delegate=ManagedChannelImpl{logId=1, target=dns:///localhost:9001}}","threadName":"main","threadId":1,"mdc":{"tenantId":"test-tenant"},"ndc":"","hostName":"fv-az1110-77","processName":"surefirebooter-20240118234630534_3.jar","processId":1835}

This means that it works, right?

@Yuqi-Du
Copy link
Contributor Author

Yuqi-Du commented Jan 19, 2024

I see the following output in the unit test log:

2024-01-18T23:47:43.7758855Z {"timestamp":"2024-01-18T23:47:43.73542461Z","sequence":491,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus.grpc.runtime.supports.Channels","level":"INFO","message":"Shutting down gRPC channel ManagedChannelOrphanWrapper{delegate=ManagedChannelImpl{logId=1, target=dns:///localhost:9001}}","threadName":"main","threadId":1,"mdc":{"tenantId":"test-tenant"},"ndc":"","hostName":"fv-az1110-77","processName":"surefirebooter-20240118234630534_3.jar","processId":1835}

This means that it works, right?

yes

@Yuqi-Du Yuqi-Du merged commit 8929cc9 into main Jan 22, 2024
2 checks passed
@Yuqi-Du Yuqi-Du deleted the log_line_tenant_id branch January 22, 2024 18:30
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.

2 participants