electric icon indicating copy to clipboard operation
electric copied to clipboard

Replace direct telemetry deps with the electric_telemetry library

Open alco opened this issue 2 months ago • 4 comments

  • [ ] Test statsd export
  • [x] Test CallHomeReporter
  • [x] Test OpenTelemetry export
  • [x] Test Prometheus export

alco avatar Nov 10 '25 22:11 alco

Codecov Report

:x: Patch coverage is 8.84615% with 237 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 75.35%. Comparing base (69e4599) to head (3b9522e). :warning: Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...metry/lib/electric/telemetry/call_home_reporter.ex 0.00% 94 Missing :warning:
...ry/lib/electric/telemetry/application_telemetry.ex 22.54% 79 Missing :warning:
...elemetry/lib/electric/telemetry/stack_telemetry.ex 0.00% 18 Missing :warning:
...electric/telemetry/reporters/call_home_reporter.ex 0.00% 16 Missing :warning:
...lectric-telemetry/lib/electric/telemetry/poller.ex 0.00% 13 Missing :warning:
...try/lib/electric/telemetry/reporters/prometheus.ex 0.00% 6 Missing :warning:
...lemetry/lib/electric/telemetry/reporters/statsd.ex 0.00% 6 Missing :warning:
...telemetry/lib/electric/telemetry/reporters/otel.ex 0.00% 3 Missing :warning:
.../electric-telemetry/lib/electric/telemetry/opts.ex 0.00% 1 Missing :warning:
...telemetry/lib/electric/telemetry/system_monitor.ex 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3412      +/-   ##
==========================================
+ Coverage   67.82%   75.35%   +7.53%     
==========================================
  Files         184       51     -133     
  Lines        9955     2743    -7212     
  Branches      405      409       +4     
==========================================
- Hits         6752     2067    -4685     
+ Misses       3201      674    -2527     
  Partials        2        2              
Flag Coverage Δ
electric-telemetry 22.71% <8.84%> (?)
elixir 57.74% <8.84%> (-6.27%) :arrow_down:
elixir-client 74.47% <ø> (+0.52%) :arrow_up:
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 93.07% <ø> (+0.08%) :arrow_up:
packages/y-electric 55.12% <ø> (ø)
postgres-140000 ?
postgres-150000 ?
postgres-170000 ?
postgres-180000 ?
sync-service ?
typescript 87.45% <ø> (+0.06%) :arrow_up:
unit-tests 75.35% <8.84%> (+7.53%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Nov 10 '25 22:11 codecov[bot]

Deploy Preview for electric-next ready!

Name Link
Latest commit 3b9522e73c492da13318558aae7ddcc1e418ec8b
Latest deploy log https://app.netlify.com/projects/electric-next/deploys/692467527fdd830008080b1e
Deploy Preview https://deploy-preview-3412--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.

netlify[bot] avatar Nov 10 '25 22:11 netlify[bot]

Why not keep https://github.com/electric-sql/electric-telemetry as part of our mono-repo as another elixir project? Easier to access and work with.

msfstef avatar Nov 11 '25 09:11 msfstef

@msfstef Main reason is decoupling.

Our primary use case for telemetry is in Electric Cloud. So if we're going to make any changes to the telemetry code, it'll be informed by Cloud and should be tested first in Cloud. All while Electric keeps using its own stable version of the lib.

How can we achieve that?

  1. Keep electric-telemetry in a separate repo and pin Cloud and Electric to different commits.
  2. Publish electric-telemetry on Hex and pin different versions of the package in the two repos.

Moving electric-telemetry into Electric's repo would work fine with the 2nd option but I'm against publishing our telemetry as a Hex package since it is only ever going to work as part of Electric.

With the 1st option it becomes awkward: we cannot use electric-telemetry in Electric as a path dependency because then Electric will necessarily always use the latest version of it. And the alternative is to pull it from Github (i.e. {:electric_telemetry, github: "electric-sql/electric", path: "packages/electric-telemetry", ref: "..."}), even though it's part of the same repo as Electric itself?

alco avatar Nov 11 '25 13:11 alco

Open in StackBlitz

npm i https://pkg.pr.new/@electric-sql/react@3412
npm i https://pkg.pr.new/@electric-sql/client@3412
npm i https://pkg.pr.new/@electric-sql/y-electric@3412

commit: acf1224

pkg-pr-new[bot] avatar Nov 18 '25 12:11 pkg-pr-new[bot]