Skip to content

Add git detector to telemetry#2409

Open
jdecool wants to merge 3 commits into
flow-php:1.xfrom
jdecool:git-detector
Open

Add git detector to telemetry#2409
jdecool wants to merge 3 commits into
flow-php:1.xfrom
jdecool:git-detector

Conversation

@jdecool

@jdecool jdecool commented May 31, 2026

Copy link
Copy Markdown
Contributor

Change Log


Added

  • Add git detector to telemetry
  • Add git detector to phpunit telemetry

Fixed

Changed

Removed

Deprecated

Security

Description


Sending PHPUnit data is very useful to see what happens during test execution.

But when used in an active project, where there are a lot of tests running, it's very interesting to have Git repository-related information.

So this PR adds a Git detector to attach some VCS information. As it could be interesting outside of the PHPUnit context, I've added it to the telemetry module.

@jdecool jdecool requested a review from norberttech as a code owner May 31, 2026 21:07
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.95918% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.18%. Comparing base (2101cba) to head (f37bf22).
⚠️ Report is 1 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                1.x    #2409      +/-   ##
============================================
+ Coverage     85.16%   85.18%   +0.01%     
- Complexity    21366    21395      +29     
============================================
  Files          1618     1620       +2     
  Lines         65951    66049      +98     
============================================
+ Hits          56166    56262      +96     
- Misses         9785     9787       +2     
Components Coverage Δ
etl 88.43% <ø> (ø)
cli 89.40% <ø> (ø)
lib-array-dot 81.44% <ø> (ø)
lib-azure-sdk 64.44% <ø> (ø)
lib-doctrine-dbal-bulk 93.61% <ø> (ø)
lib-filesystem 85.03% <ø> (ø)
lib-types 90.06% <ø> (ø)
lib-parquet 70.10% <ø> (ø)
lib-parquet-viewer 82.26% <ø> (ø)
lib-snappy 89.38% <ø> (ø)
lib-dremel 0.00% <ø> (ø)
lib-postgresql 88.59% <ø> (ø)
lib-telemetry 86.15% <97.05%> (+0.20%) ⬆️
bridge-filesystem-async-aws 92.74% <ø> (ø)
bridge-filesystem-azure 90.45% <ø> (ø)
bridge-monolog-http 96.82% <ø> (ø)
bridge-monolog-telemetry 94.11% <ø> (ø)
bridge-openapi-specification 92.07% <ø> (ø)
symfony-http-foundation 78.57% <ø> (ø)
bridge-psr18-telemetry 100.00% <ø> (ø)
bridge-psr3-telemetry 97.84% <ø> (ø)
bridge-psr7-telemetry 100.00% <ø> (ø)
bridge-telemetry-otlp 89.90% <ø> (ø)
bridge-symfony-http-foundation-telemetry 89.47% <ø> (ø)
bridge-symfony-filesystem-bundle 90.66% <ø> (ø)
bridge-symfony-filesystem-cache 98.14% <ø> (ø)
bridge-symfony-postgresql-bundle 93.83% <ø> (ø)
bridge-symfony-postgresql-cache 94.41% <ø> (ø)
bridge-symfony-postgresql-messenger 98.80% <ø> (ø)
bridge-symfony-postgresql-session 93.65% <ø> (ø)
bridge-symfony-telemetry-bundle 81.83% <100.00%> (+0.13%) ⬆️
adapter-chartjs 84.05% <ø> (ø)
adapter-csv 91.16% <ø> (ø)
adapter-doctrine 90.79% <ø> (ø)
adapter-google-sheet 99.18% <ø> (ø)
adapter-http 72.34% <ø> (ø)
adapter-json 88.63% <ø> (ø)
adapter-logger 50.00% <ø> (ø)
adapter-parquet 77.70% <ø> (ø)
adapter-text 74.13% <ø> (ø)
adapter-xml 83.40% <ø> (ø)
adapter-avro 0.00% <ø> (ø)
adapter-excel 94.21% <ø> (ø)
adapter-postgresql 91.06% <ø> (ø)
adapter-seal 85.42% <ø> (ø)
bridge-phpunit-postgresql 75.30% <ø> (ø)
bridge-phpunit-telemetry 80.11% <100.00%> (+0.02%) ⬆️
bridge-phpstan-types 0.00% <ø> (ø)
bridge-postgresql-valinor 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/lib/telemetry/src/Flow/Telemetry/Resource/Detector/GitDetector.php Outdated
@norberttech

Copy link
Copy Markdown
Member

@jdecool I really appreciate the PR but it's a bigger addition that should go through a Proposal Process since there are many architectural choices required in the implementation (like how to call git for example).
There is also a part that is not covered at all, it should be also possible to configure this detector through symfony telemetry bundle (which could be another task and this is what the proposal process is for).

We can keep this PR and work on it directly, but in the future I would appreciate opening a proper Proposal so we can first talk about how to implement the feature before writing any code

@jdecool

jdecool commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your review and your comments.

No problem, I'm going to start the proposal process.

To explain this PR, I've initially planned to try to add custom detectors dynamically during the PHPUnit process, but I think that git detector could be added by default.

But you are right, it's a big change and should be discussed before implementing it.

@norberttech

Copy link
Copy Markdown
Member

To explain this PR, I've initially planned to try to add custom detectors dynamically during the PHPUnit process, but I think that git detector could be added by default.

I fully agree, git detector should be part of the telemetry, it should be optional though, but also exposed to the whole telemetry not only phpunit bridge

But you are right, it's a big change and should be discussed before implementing it.

I'm glad we are on the same page!

@norberttech

Copy link
Copy Markdown
Member

@jdecool if you would like to brainstorm this first, or have any questions about implementation, scope etc, you can always find me on Flow discord: https://discord.gg/flow-php or you can schedule with me a session online

@jdecool

jdecool commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @norberttech I've joined the discord.

I plan to work on this PR and the proposal process this weekend.

@github-actions github-actions Bot added size: L and removed size: M labels Jun 9, 2026
@github-actions github-actions Bot added size: M and removed size: L labels Jun 9, 2026
@github-actions github-actions Bot added size: L and removed size: M labels Jun 9, 2026
@jdecool jdecool marked this pull request as draft June 9, 2026 21:16
@@ -40,6 +41,7 @@ public static function create(Configuration $config): Telemetry
{
$telemetryResource = resource_detector()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would pass git_detector() here with other default detectors:

resource_detector([
  os_detector(),
  host_detector(),
  process_detector(),
  composer_detector(),
  environment_detector(),
  git_detector() 
]);

but ideally (can be handled in next pr) we should probably allow users to configure which detectors they want to use

Comment thread src/lib/telemetry/src/Flow/Telemetry/Resource/Detector/GitDetector.php Outdated
@norberttech

Copy link
Copy Markdown
Member

its looking good @jdecool !

@jdecool

jdecool commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, I haven't been around much lately; I was really busy last week.

I'll finish this pull request soon. Thanks for your feedback and help.

@norberttech

Copy link
Copy Markdown
Member

Sorry, I haven't been around much lately; I was really busy last week.

I'll finish this pull request soon. Thanks for your feedback and help.

Take your time, it's a marathon, not a sprint. I always prefer to wait than merge something not fully baked. Thank you!

@datadog-official

This comment has been minimized.

@github-actions github-actions Bot added size: L and removed size: XL labels Jun 20, 2026
@jdecool jdecool force-pushed the git-detector branch 3 times, most recently from aca1187 to d8c90c2 Compare June 20, 2026 17:12
@jdecool jdecool marked this pull request as ready for review June 20, 2026 17:18
@jdecool

jdecool commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for your patience @norberttech .

I've made some suggested changes; please take a look and let me know if it's OK for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants