Skip to content

Record metrics for a cancelled stream query #484

Description

@robinskil

Parent: #481

Describe the bug

The stream output records query metrics at stream end. A cancelled query never reaches that point.

The query store then holds no row for the query. The atlas_* counters are lost too.

A slow query that a client abandons leaves no trace.

Impact

These queries need diagnosis the most. A user reports a slow query. The query store holds nothing about it.

The two output routes differ here. run_query_to_file records metrics after the write. The code says so at runtime.rs:237.

Expected behavior

A cancelled query records the metrics it collected.

Open decision

The row is partial. A reader must not read it as a complete query.

Pick one option:

  1. Add a state column. Values: complete, cancelled.
  2. Add a boolean column for a partial row.
  3. Mark the row in an existing column.

Option 1 is clearer. It also costs a schema change in the query store.

Suggested fix

  1. Pick an option above.
  2. Record the metrics when the stream drops.
  3. Mark the row with the chosen column.

A Drop implementation on the stream wrapper is one way. CoalesceSqlStream already wraps the stream.

Keep the record step cheap. A drop runs on the runtime.

Files

beacon-db/beacon-core/src/runtime.rs

beacon-server/beacon-server/src/axum/client/query.rs

Scope

Every stream query. The format does not matter.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingeffort-S1 to 3 daysrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions