Task · OPN-0070

Live delivery proof miscategorises structured metadata as promoted labels

Description

live_delivery_proof.py queried Loki without the categorize-labels response encoding. In that default encoding Loki MERGES structured metadata into each stream’s label map and omits the per-entry metadata element entirely, so the harness read:

Both were measurement artifacts. Re-querying the same three Wave 5 proof instances with X-Loki-Response-Encoding-Flags: categorize-labels shows stream labels of exactly opnsense_action, opnsense_source, opnsense_subsystem, service_instance_id, service_name (all inside the documented seven), dst_domain present in structuredMetadata with the expected value, and dst_domain absent from stream labels in every stream.

Acceptance Criteria

Definition of Done

Implementation Notes

Fixed in scripts/testbed/live_delivery_proof.py: loki_query sends X-Loki-Response-Encoding-Flags: categorize-labels, and records() reads the structuredMetadata member of the per-entry category map.

Verified live against the retained Wave 5 data rather than only in tests. Querying m7kni Loki for instances delivery-proof-33843852532, delivery-proof-33848582974 and delivery-proof-33849420068 both ways:

So the Wave 5 ‘202 unexpected promoted label keys’ figure is 203 structured-metadata keys minus the one that is also a stream label. No label expansion exists.

Tests: test_records_reads_the_categorized_structured_metadata_member, test_records_yields_no_metadata_for_an_uncategorized_response (fails closed rather than reading merged labels as exporter behaviour) and test_loki_query_requests_categorized_labels. The former test_records_keeps_structured_metadata_separate_from_labels encoded the bug in its fixture and was replaced. 16 tests OK.

CodeRabbit: 1 pass, complete, zero findings.

View the source file on GitHub