google-cloud-php icon indicating copy to clipboard operation
google-cloud-php copied to clipboard

feat(logging): add trace to logging on cloud run

Open javihgil opened this issue 1 year ago • 4 comments

javihgil avatar Nov 02 '23 14:11 javihgil

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Nov 02 '23 14:11 google-cla[bot]

Hi guys, I made this PR getting code from main branch, so I don't understand why Backwards compatibility check is failing.

What am I supposed to do to fix this?

Thanks

javihgil avatar Nov 22 '23 09:11 javihgil

Hi @javihgil , thanks a lot for taking time and contributing to the library.

Hi guys, I made this PR getting code from main branch, so I don't understand why Backwards compatibility check is failing. What am I supposed to do to fix this?

It was caused due to some merge conflicts getting resolved in a way which deleted incoming changes. I've fixed it and now all the tests pass.

Can you please tell me your inspiration behind this PR? I would like to know what were you trying to do which led you to finding this feature absence and how doing this would help your work?

yash30201 avatar Nov 22 '23 11:11 yash30201

Of course!

When you use this library with GAE, the Google\Cloud\Core\Report\GAEMetadataProvider sets an "appengine.googleapis.com/trace_id" label witch allows you to filter log entries by this trace, whose value is provided by HTTP_X_CLOUD_TRACE_CONTEXT header.

With CloudRun this header is also received, but it's ignored by CloudRunMetadataProvider so you can not filter log entries by trace_id.

This PR adds this label in metadata provider.

I renamed it to "run.googleapis.com/trace_id" instead of using "appengine.googleapis.com/trace_id" because I think is the propper way.

Thanks!

javihgil avatar Nov 22 '23 11:11 javihgil