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

Implement GCP X-Cloud-Trace-Context Propagator #1132

Conversation

ynikitin-etsy
Copy link
Contributor

This is an implementation for GCP/Google X-Cloud-Trace-Context header propagator. Propagator for this header is available in most languages except PHP and my team needs it, thus I'm presenting this PR for review.

The formatting/parsing logic is heavily borrowed from OpenCensus implementation with a few changes: https://github.com/census-instrumentation/opencensus-php/blob/master/src/Trace/Propagator/TraceContextFormatter.php

Tests are heavily borrowed from existing B3 Propagator tests in this library.

Please let me know how this needs to be adjusted. This has also been tested end to end with a Slim API and Honeycomb exporter.

@ynikitin-etsy ynikitin-etsy requested a review from a team October 25, 2023 20:55
@welcome
Copy link

welcome bot commented Oct 25, 2023

Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 25, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@ynikitin-etsy ynikitin-etsy force-pushed the ynikitin-etsy/implement-xcloudtrace-propagator branch from e9cd79b to 2c3c170 Compare October 25, 2023 21:05
@ynikitin-etsy
Copy link
Contributor Author

Will reopen after further review.

@brettmc
Copy link
Collaborator

brettmc commented Oct 26, 2023

Hi @ynikitin-etsy this PR looked ok to me. If you want to discuss further, here is good or in our slack channel.

@ynikitin-etsy ynikitin-etsy reopened this Oct 30, 2023
@ynikitin-etsy
Copy link
Contributor Author

@brettmc sorry about that. I had to go back for a CLA review, but this should be getting sorted out asap. I'm re-opening for review. Let me know if any changes are wanted. Thank you!

Copy link
Collaborator

@brettmc brettmc left a comment

Choose a reason for hiding this comment

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

Can you please add this extension to the git hub actions (under .github), and also to .gitsplit.yml (I've created https://github.com/opentelemetry-php/extension-propagator-cloudtrace as a destination).
Also, it needs a basic README - you can copy the B3 one.

@brettmc
Copy link
Collaborator

brettmc commented Oct 31, 2023

Looking good! I'd like to see the tests running, so don't forget to add to .github/workflows/php.yml and also .gitsplit.yml

@ynikitin-etsy
Copy link
Contributor Author

Looking good! I'd like to see the tests running, so don't forget to add to .github/workflows/php.yml and also .gitsplit.yml

Fixes with tests/formating/README pushed. Added to .gitsplit.yml. Sorry, I'm not sure I'm understanding what I'm supposed to add to php.yml? Tests should run as is since they are just under the normal tests folder like the B3 stuff.

@brettmc
Copy link
Collaborator

brettmc commented Nov 1, 2023

Tests should run as is since they are just under the normal tests folder like the B3 stuff

Sorry yes you are right, I'm thinking about our contrib repo which is set up differently...
Can you fix linting issues: https://github.com/open-telemetry/opentelemetry-php/pull/1132/checks (you can run make all locally to run php-cs-fixer and the various static analysis tools)

@ynikitin-etsy
Copy link
Contributor Author

ynikitin-etsy commented Nov 1, 2023

Tests should run as is since they are just under the normal tests folder like the B3 stuff

Sorry yes you are right, I'm thinking about our contrib repo which is set up differently... Can you fix linting issues: https://github.com/open-telemetry/opentelemetry-php/pull/1132/checks (you can run make all locally to run php-cs-fixer and the various static analysis tools)

Sorry about, I tried running the makefile stuff before, but had issues with login to fetch the image and getting the right platform images. This should be all set?

FYI to other people on ARM Mac's, if you put DOCKER_COMPOSE=DOCKER_DEFAULT_PLATFORM=linux/amd64 docker-compose into the .env file, it will work correctly.

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #1132 (3c45855) into main (42a8b95) will increase coverage by 0.01%.
The diff coverage is 85.05%.

❗ Current head 3c45855 differs from pull request most recent head ecaa647. Consider uploading reports for the commit ecaa647 to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1132      +/-   ##
============================================
+ Coverage     84.27%   84.28%   +0.01%     
- Complexity     2160     2193      +33     
============================================
  Files           279      282       +3     
  Lines          6137     6224      +87     
============================================
+ Hits           5172     5246      +74     
- Misses          965      978      +13     
Flag Coverage Δ
7.4 82.92% <85.05%> (+0.03%) ⬆️
8.0 84.21% <85.05%> (+0.01%) ⬆️
8.1 84.35% <85.05%> (+<0.01%) ⬆️
8.2 84.35% <85.05%> (+<0.01%) ⬆️
8.3 84.35% <85.05%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/Extension/Propagator/XCloudTrace/Utils.php 97.36% <97.36%> (ø)
...on/Propagator/XCloudTrace/XCloudTraceFormatter.php 82.35% <82.35%> (ø)
...n/Propagator/XCloudTrace/XCloudTracePropagator.php 71.87% <71.87%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42a8b95...ecaa647. Read the comment docs.

Copy link
Collaborator

@brettmc brettmc left a comment

Choose a reason for hiding this comment

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

LGTM! Just that one question about self:: - otherwise I'm happy to merge this when the CLA comes through.

@ynikitin-etsy
Copy link
Contributor Author

LGTM! Just that one question about self:: - otherwise I'm happy to merge this when the CLA comes through.

Should be fixed. Hopefully I can sign it within next few days. Thanks a bunch for your time!

@ynikitin-etsy
Copy link
Contributor Author

Okey, this should be all set! I had to work through getting the CLA approved in my org. Thanks for waiting!

@brettmc brettmc merged commit d6c4c89 into open-telemetry:main Nov 13, 2023
9 checks passed
@brettmc
Copy link
Collaborator

brettmc commented Nov 13, 2023

@brettmc
Copy link
Collaborator

brettmc commented Nov 14, 2023

@ynikitin-etsy I noticed in the readme that there's some differences in the naming of the repo vs the package name (cloudtrace vs xcloudtrace). I think we should pick one and update some things to make them consistent (and fix a couple of broken links/images in the readme).
Do you have an opinion on which? The header is x-cloud-trace, but the product looks like it's just "cloud trace".

@ynikitin-etsy
Copy link
Contributor Author

@ynikitin-etsy I noticed in the readme that there's some differences in the naming of the repo vs the package name (cloudtrace vs xcloudtrace). I think we should pick one and update some things to make them consistent (and fix a couple of broken links/images in the readme). Do you have an opinion on which? The header is x-cloud-trace, but the product looks like it's just "cloud trace".

Sorry for the delay. I can update to cloudtrace so we don't have to change repos and etc. I picked xcloudtrace to make it stand out thats its has to do with header propagation, because cloud trace sounds a bit generic. Anyways, I can open another PR to update these.

@ynikitin-etsy
Copy link
Contributor Author

Opened this: #1142

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.

3 participants