Skip to content

feat(sync-service): Add ELECTRIC_EXCLUDE_SPANS env var#3952

Merged
robacourt merged 1 commit intomainfrom
rob/less-spans
Mar 4, 2026
Merged

feat(sync-service): Add ELECTRIC_EXCLUDE_SPANS env var#3952
robacourt merged 1 commit intomainfrom
rob/less-spans

Conversation

@robacourt
Copy link
Contributor

@robacourt robacourt commented Mar 3, 2026

Summary

Add a general-purpose ELECTRIC_EXCLUDE_SPANS environment variable that allows excluding arbitrary OTel spans by name via a comma-separated list, helping manage telemetry quota usage with providers like Honeycomb.

Changes

  • Parse ELECTRIC_EXCLUDE_SPANS in config/runtime.exs into a MapSet of span names
  • Add exclusion check in Electric.Telemetry.Sampler that gates span creation before existing filter.* and pg_txn.* rules
  • Add exclude_spans: MapSet.new() default in Electric.Config

Usage

ELECTRIC_EXCLUDE_SPANS="shape_status.validate_shape_handle,shape_get.api.load_shape_info"

Test Plan

  • All existing telemetry tests pass (11 tests)
  • Full test suite passes (1780 tests, 0 failures)
  • Manual verification: set ELECTRIC_EXCLUDE_SPANS and confirm excluded spans are no longer created

Generated with Claude Code

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.77%. Comparing base (1e232f3) to head (3934255).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3952   +/-   ##
=======================================
  Coverage   88.77%   88.77%           
=======================================
  Files          25       25           
  Lines        2415     2415           
  Branches      606      604    -2     
=======================================
  Hits         2144     2144           
  Misses        269      269           
  Partials        2        2           
Flag Coverage Δ
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/start 82.83% <ø> (ø)
packages/typescript-client 94.01% <ø> (ø)
packages/y-electric 56.05% <ø> (ø)
typescript 88.77% <ø> (ø)
unit-tests 88.77% <ø> (ø)

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.

Allow excluding arbitrary OTel spans by name via a comma-separated env
var, helping manage telemetry quota usage with providers like Honeycomb.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@robacourt robacourt self-assigned this Mar 3, 2026
@blacksmith-sh

This comment has been minimized.

@balegas balegas requested a review from magnetised March 3, 2026 23:00
@balegas
Copy link
Contributor

balegas commented Mar 3, 2026

Looks good to me, but needs a elixir dev review

Copy link
Contributor

@magnetised magnetised left a comment

Choose a reason for hiding this comment

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

🥇

@robacourt robacourt merged commit e423cb7 into main Mar 4, 2026
51 of 52 checks passed
@robacourt robacourt deleted the rob/less-spans branch March 4, 2026 10:36
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

This PR has been released! 🚀

The following packages include changes from this PR:

  • @core/sync-service@1.4.12

Thanks for contributing to Electric!

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