Skip to content

Add minutely rollup for service operations#232

Merged
Makisuo merged 1 commit into
mainfrom
codex/speed-up-service-top-operations
Jul 19, 2026
Merged

Add minutely rollup for service operations#232
Makisuo merged 1 commit into
mainfrom
codex/speed-up-service-top-operations

Conversation

@Makisuo

@Makisuo Makisuo commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add the service_operations_minutely AggregatingMergeTree datasource and live materialized view
  • normalize HTTP operation names through one shared ClickHouse-builder expression
  • add hybrid raw-edge/rollup summary and sparkline query builders while retaining the all-raw rollback builders
  • add the BYO ClickHouse schema migration and an explicit chunkable backfill specification
  • regenerate Tinybird, ClickHouse, local CLI, and ingest schema artifacts
  • round sparkline buckets to whole-minute multiples

Why

Maple telemetry showed the service-detail operation summary and sparkline queries repeatedly aggregating raw traces, with paired warehouse p95 around 17 seconds. The rollup moves repeated display-name calculation and minute-grain aggregation to ingestion time.

Rollout safety

This is intentionally a schema-first PR. Production API reads remain on the raw builders because managed Tinybird and BYO ClickHouse schema deployment/backfill can race with the API release. Hybrid reads must not be enabled until:

  • managed and BYO backfill commands/workflows exist and run under a coordinated write pause
  • raw-versus-rollup count/error parity and bounded t-digest tolerance are verified against ClickHouse
  • Maple MCP confirms the target latency on 1h–24h windows

The endpoint, response schema, cache TTL, atom shape, and telemetry context labels remain unchanged.

Validation

  • query-engine focused tests: 15 passed
  • domain schema/migration tests: 30 passed
  • web service-operation tests: 11 passed
  • API, web, domain, and query-engine typechecks passed
  • Tinybird and ClickHouse generated-artifact checks passed
  • ClickHouse schema lint and targeted Oxlint passed
  • independent review agent completed two passes; no blocker remains for this schema-first draft

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

@github-actions

Copy link
Copy Markdown

Ingest Rust Test + Benchmark Results

Commit: fa7a3e61aea1be7b69c9207dcfbc206d2ee85a1c

Load Benchmark — tinybird mode, median of 3 run(s) vs main

Metric main (median) PR (median) Delta
Requests/sec 11991.45 12282.40 +2.4% better
Rows/sec 119914.51 122823.95 +2.4% better
p50 latency 5.12 ms 5.08 ms -0.8% better
p95 latency 6.98 ms 9.93 ms +42.3% worse
p99 latency 10.74 ms 11.02 ms +2.6% worse
Export catch-up 0.026 s 0.026 s -1.8% better
Max RSS 17.14 MiB 16.84 MiB -1.8% better
Failures 0 0 same

Same code path on both sides (same LOAD_TEST_INGEST_MODE), so the delta column is meaningful. Numbers come from ubuntu-latest, which is noisy — treat single-digit-percent deltas as noise.

PR load benchmark JSON (per-iteration)
[
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 10,
    "duration_seconds": 0.162834685,
    "export_catchup_seconds": 0.025465883,
    "request_rps": 12282.395485949446,
    "row_rps": 122823.95485949445,
    "p50_ms": 5.04,
    "p95_ms": 9.912,
    "p99_ms": 11.018,
    "max_rss_mb": 17.59375,
    "max_cpu_percent": 20.0,
    "avg_cpu_percent": 20.0
  },
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 10,
    "duration_seconds": 0.160647829,
    "export_catchup_seconds": 0.025696226,
    "request_rps": 12449.592456054916,
    "row_rps": 124495.92456054916,
    "p50_ms": 5.075,
    "p95_ms": 9.932,
    "p99_ms": 10.483,
    "max_rss_mb": 16.8359375,
    "max_cpu_percent": 16.6,
    "avg_cpu_percent": 16.6
  },
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 11,
    "duration_seconds": 0.17185526,
    "export_catchup_seconds": 0.02573097,
    "request_rps": 11637.70023681556,
    "row_rps": 116377.00236815562,
    "p50_ms": 5.319,
    "p95_ms": 10.316,
    "p99_ms": 12.119,
    "max_rss_mb": 15.41015625,
    "max_cpu_percent": 0.0,
    "avg_cpu_percent": 0.0
  }
]
main load benchmark JSON (per-iteration)
[
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 11,
    "duration_seconds": 0.166785489,
    "export_catchup_seconds": 0.026166414,
    "request_rps": 11991.45088695336,
    "row_rps": 119914.5088695336,
    "p50_ms": 5.116,
    "p95_ms": 6.308,
    "p99_ms": 10.737,
    "max_rss_mb": 16.87890625,
    "max_cpu_percent": 0.0,
    "avg_cpu_percent": 0.0
  },
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 11,
    "duration_seconds": 0.162324613,
    "export_catchup_seconds": 0.026408937,
    "request_rps": 12320.990409507398,
    "row_rps": 123209.90409507399,
    "p50_ms": 5.049,
    "p95_ms": 6.98,
    "p99_ms": 10.155,
    "max_rss_mb": 17.640625,
    "max_cpu_percent": 0.0,
    "avg_cpu_percent": 0.0
  },
  {
    "ingest_mode": "tinybird",
    "requests": 2000,
    "successes": 2000,
    "failures": 0,
    "rows_sent": 20000,
    "rows_exported": 20000,
    "imports": 11,
    "duration_seconds": 0.168559268,
    "export_catchup_seconds": 0.025936954,
    "request_rps": 11865.26272764782,
    "row_rps": 118652.6272764782,
    "p50_ms": 5.241,
    "p95_ms": 10.125,
    "p99_ms": 11.54,
    "max_rss_mb": 17.14453125,
    "max_cpu_percent": 0.0,
    "avg_cpu_percent": 0.0
  }
]

WAL-acked microbench (cargo bench --bench ingest_bench)

   Compiling maple-ingest v0.1.0 (/home/runner/_work/maple/maple/apps/ingest)
    Finished `bench` profile [optimized] target(s) in 12.74s
     Running benches/ingest_bench.rs (target/release/deps/ingest_bench-581d2100de893627)
Gnuplot not found, using plotters backend
test ingest_accept/logs_10_rows_wal_ack ... bench:       90778 ns/iter (+/- 7647)

thread 'main' (5075) panicked at benches/ingest_bench.rs:73:22:
accept traces: QueueUnavailable("Telemetry WAL lane is full")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test ingest_accept/traces_10_spans_wal_ack ... 
error: bench failed, to rerun pass `--bench ingest_bench`

cargo test

test telemetry::tests::metrics_summary_data_points_are_dropped ... ok
test telemetry::tests::migrate_legacy_shard_relocates_frames_into_lanes ... ok
test telemetry::tests::logs_use_observed_time_when_time_unix_nano_is_zero ... ok
test telemetry::tests::pipeline_can_start_for_clickhouse_only_without_tinybird_credentials ... ok
test telemetry::tests::clickhouse_export_drops_passworded_non_https_endpoint_without_sending ... ok
test telemetry::tests::sampling_keeps_errors_even_when_ratio_low ... ok
test telemetry::tests::scraper_contract::scraper_otlp_json_decodes_with_gateway_serde_and_encodes_to_rows ... ok
test telemetry::tests::pipeline_e2e_exports_metrics_to_fake_tinybird ... ok
test telemetry::tests::signal_tag_round_trips_all_variants ... ok
test telemetry::tests::telemetry_signal_as_str_is_canonical_lowercase ... ok
test telemetry::tests::timestamp_has_nano_precision ... ok
test telemetry::tests::timestamps_match_clickhouse_datetime64_nine_format ... ok
test telemetry::tests::trace_encoder_matches_tinybird_row_shape ... ok
test telemetry::tests::traces_emit_exactly_the_jsonpaths_declared_in_datasources_ts ... ok
test telemetry::tests::wal_partial_drain_advances_cursor_without_truncating ... ok
test telemetry::tests::wal_round_trips_frame ... ok
test telemetry::tests::wal_truncates_after_full_drain_allowing_further_appends ... ok
test telemetry::tests::pipeline_e2e_exports_gzip_ndjson_to_fake_tinybird ... ok
test telemetry::tests::pipeline_e2e_exports_traces_to_fake_tinybird ... ok
test telemetry::tests::pipeline_exports_ready_org_to_clickhouse_without_tinybird_calls ... ok
test telemetry::tests::slow_clickhouse_lane_does_not_block_cosharded_tinybird_org ... ok
test telemetry::tests::clickhouse_breaker_sheds_after_threshold_failures ... ok

test result: ok. 36 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.73s

     Running unittests src/bin/load_test.rs (target/debug/deps/load_test-661a0aa1eb3f6d6d)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/main.rs (target/debug/deps/maple_ingest-c33bf80c577edb95)

running 38 tests
test autumn::tests::allowed_only_no_balance_field ... ok
test autumn::tests::flat_overage_allows ... ok
test autumn::tests::flat_hardcap_depleted_blocks ... ok
test autumn::tests::flat_hardcap_with_remaining_allows ... ok
test autumn::tests::flat_sub_one_gb_remaining_still_allows ... ok
test autumn::tests::flat_unlimited_allows ... ok
test autumn::tests::nested_balance_object_depleted_blocks ... ok
test autumn::tests::nested_overage_allows ... ok
test autumn::tests::nested_balance_object_with_remaining_allows ... ok
test autumn::tests::null_balance_no_subscription_blocks ... ok
test tests::api_error_from_pipeline_maps_variants_to_status ... ok
test autumn::tests::unrecognized_shape_returns_none ... ok
test tests::clickhouse_destination_uses_native_pipeline_even_in_forward_mode ... ok
test tests::clickhouse_destination_is_terminal_in_dual_mode ... ok
test tests::api_error_kind_maps_status_to_stable_label ... ok
test tests::cloudflare_ndjson_payload_parses_multiple_records ... ok
test tests::cloudflare_timestamps_support_rfc3339_unix_and_unix_nano ... ok
test tests::cloudflare_validation_payload_is_detected ... ok
test tests::clickhouse_target_resolver_requires_current_schema ... ok
test tests::clickhouse_target_resolver_rejects_password_over_http ... ok
test tests::decrypt_aes256_gcm_matches_node_crypto_fixture ... ok
test tests::clickhouse_target_resolver_decrypts_current_schema_password ... ok
test tests::enrichment_overwrites_tenant_fields ... ok
test tests::extract_ingest_key_returns_sentinel_literal_unchanged ... ok
test tests::hash_is_deterministic ... ok
test tests::cloudflare_log_record_maps_body_severity_and_attributes ... ok
test tests::rejection_span_status_is_error_only_for_5xx ... ok
test tests::resolve_ingest_key_keeps_stale_schema_on_managed_native_path ... ok
test tests::resolve_ingest_key_returns_none_when_hash_missing ... ok
test tests::resolve_ingest_key_returns_self_managed_false_when_no_settings_row ... ok
test tests::resolve_ingest_key_returns_self_managed_true_when_active_settings_row ... ok
test tests::sentinel_token_matches_only_exact_literal ... ok
test tests::tinybird_destination_keeps_forward_mode_on_forward_path ... ok
test autumn::tests::fails_open_on_transport_error ... ok
test tests::resolve_connector_refreshes_routing_before_auth_cache_expires ... ok
test tests::resolve_ingest_key_refreshes_routing_before_auth_cache_expires ... ok
test tests::resolve_ingest_key_serves_last_known_routing_when_refresh_fails ... ok
test tests::forward_mode_switches_ready_org_to_clickhouse_without_forwarding_again ... ok

test result: ok. 38 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.19s

   Doc-tests maple_ingest

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

@Makisuo
Makisuo marked this pull request as ready for review July 19, 2026 12:29
@pullfrog

pullfrog Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Your Pullfrog Router balance is exhausted.

You have a card on file but auto-reload is disabled, so runs paused once your balance went past the overdraft buffer.

Top up balance → · Enable auto-reload →

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Rerun failed job ➔View workflow run | via Pullfrog | Using Claude Opus𝕏

@Makisuo
Makisuo merged commit b079d44 into main Jul 19, 2026
7 of 10 checks passed
@Makisuo
Makisuo deleted the codex/speed-up-service-top-operations branch July 19, 2026 12:36

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

1 participant