Skip to content

Conversation

@alco
Copy link
Member

@alco alco commented Dec 16, 2025

It got lost in the extraction of telemetry code into a separate package.

See the old code here, new code here.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.75%. Comparing base (850ad3d) to head (be0debe).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...metry/lib/electric/telemetry/call_home_reporter.ex 40.00% 3 Missing ⚠️
...electric/telemetry/reporters/call_home_reporter.ex 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3620      +/-   ##
==========================================
- Coverage   88.13%   82.75%   -5.38%     
==========================================
  Files          18       30      +12     
  Lines        1643     2012     +369     
  Branches      409      413       +4     
==========================================
+ Hits         1448     1665     +217     
- Misses        193      345     +152     
  Partials        2        2              
Flag Coverage Δ
electric-telemetry 58.80% <63.63%> (?)
elixir 58.80% <63.63%> (?)
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 93.76% <ø> (ø)
packages/y-electric 55.66% <ø> (ø)
typescript 88.13% <ø> (ø)
unit-tests 82.75% <63.63%> (-5.38%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@balegas
Copy link
Contributor

balegas commented Dec 17, 2025

Do we have any test coverage for the call home reporter? It would be useful to check if the emitted metrics follow the specified format. We've broken metrics a few times.

@balegas
Copy link
Contributor

balegas commented Dec 17, 2025

We were also not adding electric_default, iirc?

alco added 5 commits December 18, 2025 00:43
This is to be able to override the first_report_in specifically and thus
test that ApplicationTelemetry configures the reporter correctly, as
opposed to just testing the CallHomeReporter itself by writing setup
code for it in the test function.
You won't believe how much time I had sunk trying to figure out the
source of endless flakes in call home reporter tests. As soon as I
linked the task process to the CallHomeReporter process they all went
away as if by magic.

This linking won't make the CallHomeReporter process exit if a task
fails, since the former traps exits. But it's super important to not
leave any orphaned tasks when running tests using Bypass because, oh
boy...
@netlify
Copy link

netlify bot commented Dec 18, 2025

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 998b681
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/6943565c434ddf00083d0e33
😎 Deploy Preview https://deploy-preview-3620--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@alco
Copy link
Member Author

alco commented Dec 18, 2025

@balegas I have added separate tests that verify CallHomeReporter's payload when running 1) under ApplicationTelemetry and 2) StackTelemetry. In the latter case stack_id and pg_version will be included under environment. These tests only verify the payload shape, not the value of each field.

I had spent way too much time dealing with flakes before I finally got it to work by replacing Task.start() with Task.async() in CallHomeReporter and adding all the necessary clauses of handle_info.

We were also not adding electric_default, iirc?

data.environment.electric_installation_id = "electric_default" both for application- and stack-based CallHomeReporter. The new tests verify this.

@alco alco self-assigned this Dec 18, 2025
@alco alco merged commit 10bee98 into main Dec 18, 2025
45 of 46 checks passed
@alco alco deleted the alco/stack_id-in-call-home-telemetry branch December 18, 2025 11:11
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.

4 participants