Conversation
… PPL queries Signed-off-by: Adam Tackett <tackadam@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
❌ 1 Jest Test Failure(s)📄
|
Description
Fixes trace-to-log correlation failing when a correlated field is mapped to a
.keywordmulti-field sub-field.PPL cannot reference a
.keywordmulti-field in awhereclause — the query fails withAssertionError:The same query against the base field (
log_processed.trace_id) succeeds. The trace-to-log correlation UI let a user pick the.keywordsub-field fortraceId/spanId/serviceName, stored it in the log dataset'sschemaMappings.otelLogs, and later interpolated it verbatim into the PPLwhereclause — so adding such a dataset to a correlation caused "no related logs" for that span.Changes
field_mapping_editor.tsx): exclude multi-field sub-fields (field.subType.multi, i.e..keyword) from the dropdown options, so they can no longer be selected. ExtractedgetCorrelationFieldOptions()for direct unit testing.ppl_request_logs.tsx): add a smalltoPplFieldName()helper that strips a trailing.keyword, and use it for thetraceIdfield. This defensively fixes correlations that were already saved with a.keywordfield before this change.url_builder.ts): strip.keywordfrom thetraceId/spanIdfield names used in the generated PPL query, and in the client-sidefilterLogsBySpanIdlookup (the PPL response returns the base field).Scope
This targets the trace-to-log correlation path, which is where the
.keywordfield reaches PPL. Both the selection surface (prevention) and the query-build/URL surfaces (fix for existing mappings) are covered.Issues Resolved
N/A
Screenshot
N/A — behavior fix; the only UI change is that
.keywordsub-fields no longer appear in the correlation field dropdown.Testing the changes
yarn test:jestfor the three affected suites (correlation field-mapping editor, PPL logs request, logs URL builder) — all pass, with added coverage for: excluding.keywordfrom the dropdown options, stripping.keywordin the PPL query, and stripping it in the generated Explore-logs URL.yarn typecheckpasses.Manual: configure a trace-to-log correlation, confirm
.keywordfields are no longer offered in the field dropdown, and that a span with a previously-saved.keywordmapping now resolves related logs.Check List
yarn test:jestyarn test:jest_integration