Skip to content

Fix otel-export Lux metric ordering#4226

Closed
robacourt wants to merge 1 commit intomainfrom
rob/redact-url-params
Closed

Fix otel-export Lux metric ordering#4226
robacourt wants to merge 1 commit intomainfrom
rob/redact-url-params

Conversation

@robacourt
Copy link
Copy Markdown
Contributor

@robacourt robacourt commented Apr 29, 2026

Issue

  • fix(telemetry): align metric exports with emitted events #4201 added new metric assertions to otel-export.lux, but it placed them in a later collector block than the one where those metrics are actually exported.
  • In the failing run, electric.plug.serve_shape.* and the related storage metrics were already printed by the OTEL collector before the final Lux block started waiting for them.
  • That meant Lux timed out even though the metrics were present in the collector log.
  • An earlier fragility made this worse: the loose ?Span #[0-9]+ checks could match arbitrary earlier spans and advance the collector cursor past the export window we actually cared about.

The Fix

  • Move each metric assertion into the OTEL export window where that metric actually appears.
  • Stop matching arbitrary Span #N lines and instead anchor directly on shape_snapshot.execute_for_shape plus the expected shape.query_reason.
  • Keep the test aligned with the real collector output order, instead of assuming the metrics will still be visible in a later block.

Implementation

  • move the OTEL metric assertions to the export windows where the metrics actually appear
  • stop matching arbitrary Span #N lines before shape_snapshot.execute_for_shape
  • keep the test focused on Lux ordering rather than sync-service behavior

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3512 1 3511 27
View the top 1 failed test(s) by shortest run time
Elixir.Electric.ShapeCacheTest::test get_or_create_shape_handle/2 against real db crashes when initial snapshot query fails to return data quickly enough
Stack Traces | 0s run time
18) test get_or_create_shape_handle/2 against real db crashes when initial snapshot query fails to return data quickly enough (Electric.ShapeCacheTest)
     test/electric/shape_cache_test.exs:507
     ** (EXIT from #PID<0.17815.0>) killed

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@robacourt robacourt force-pushed the rob/redact-url-params branch from 4d6f0f9 to ab6b41e Compare April 29, 2026 11:26
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.

2 participants