mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-01 02:30:35 +01:00
Split the five telemetry<signal> packages, which mixed three concerns, into three per-signal layers with a cycle-free dependency direction: - telemetryschema/<signal>telemetryschema — primitives (const + table selection, field_mapper, condition_builder, trace helpers); leaf layer. - statementbuilder/<signal>statementbuilder — SQL generation. The parent statementbuilder package is contract-only (the Builders bundle + Config); each sub-package exposes a factory.ProviderFactory[..., statementbuilder.Config] whose New internalizes FieldMapper/ConditionBuilder/AggExprRewriter and reads SkipResourceFingerprint. Traces exposes two factories (query + operator). telemetryresourcefilter moves here as statementbuilder/resourcefilter. - telemetrymetadata — key/value resolution; NewTelemetryMetaStore collapses from 24 args to (settings, telemetrystore, flagger), sourcing table names from the schema constants. Centralize query-stack assembly in signoz.go via newQueryStack: build the single metadata store, run each per-signal statement-builder factory, assemble the statementbuilder.Builders bundle, and build the bucket cache — once. This is the only place that imports the concrete sub-packages (so the edge runs subs -> parent, cycle-free), and it removes the duplicate metadata store that signozquerier used to build, leaving signozquerier a thin querier.New(*statementbuilder.Builders) adapter. Also: - statementbuilder.Config owns SkipResourceFingerprint (moved off querier.Config). YAML key moves querier.skip_resource_fingerprint -> statementbuilder.skip_resource_fingerprint. - Querier interface moves into querier.go (interfaces.go removed); BucketCache -> bucket_cache.go, Handler -> api.go. - Add pkg/querier/queriertest.MockQuerier.