From 45ead71359de8a715c582b88b19f2f874744af21 Mon Sep 17 00:00:00 2001 From: Raj Kamal Singh <1133322+rkssisodiya@users.noreply.github.com> Date: Sun, 29 Oct 2023 17:46:08 +0530 Subject: [PATCH] Fix: get log pipelines trace parser working (#3822) * chore: add trace parser fields to log pipeline ProcessorData interface * chore: update trace parsing processor form field configs * chore: logs pipeline preview: better display of sample logs when too few logs in sample * fix: log pipelines: get tests passing: remove name prop passed to antd input --- .../FormFields/DescriptionTextArea.tsx | 6 +----- .../AddNewPipeline/FormFields/NameInput.tsx | 2 +- .../AddNewProcessor/FormFields/NameInput.tsx | 2 +- .../FormFields/ParsingRulesTextArea.tsx | 6 +----- .../PipelineListsView/AddNewProcessor/config.ts | 14 +++++++------- .../Preview/components/LogsList/styles.scss | 4 ++-- frontend/src/types/api/pipeline/def.ts | 11 +++++++++++ 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/DescriptionTextArea.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/DescriptionTextArea.tsx index 6bd456e7f1..5914114d84 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/DescriptionTextArea.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/DescriptionTextArea.tsx @@ -16,11 +16,7 @@ function DescriptionTextArea({ label={{fieldData.fieldName}} key={fieldData.id} > - + ); } diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/NameInput.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/NameInput.tsx index 21e25118af..ab96a6c689 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/NameInput.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/FormFields/NameInput.tsx @@ -16,7 +16,7 @@ function NameInput({ fieldData }: NameInputProps): JSX.Element { rules={formValidationRules} name={fieldData.name} > - + ); } diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/NameInput.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/NameInput.tsx index 3991715f63..bcc41e9677 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/NameInput.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/NameInput.tsx @@ -23,7 +23,7 @@ function NameInput({ fieldData }: NameInputProps): JSX.Element { initialValue={fieldData.initialValue} rules={fieldData.rules ? fieldData.rules : formValidationRules} > - + diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/ParsingRulesTextArea.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/ParsingRulesTextArea.tsx index 4d7f8b2ec0..ef0338eec0 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/ParsingRulesTextArea.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/FormFields/ParsingRulesTextArea.tsx @@ -20,11 +20,7 @@ function ParsingRulesTextArea({ name={fieldData.name} label={{fieldData.fieldName}} > - + diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/config.ts b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/config.ts index e7e5677cd8..46171c030a 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/config.ts +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewProcessor/config.ts @@ -24,7 +24,7 @@ export type ProcessorFormField = { id: number; fieldName: string; placeholder: string; - name: string; + name: string | Array; rules?: Array<{ [key: string]: boolean }>; initialValue?: string; }; @@ -152,21 +152,21 @@ export const processorFields: { [key: string]: Array } = { }, { id: 2, - fieldName: 'Trace Id Parce From', + fieldName: 'Parse Trace Id From', placeholder: 'processor_trace_id_placeholder', - name: 'traceId', + name: ['trace_id', 'parse_from'], }, { id: 3, - fieldName: 'Span id Parse From', + fieldName: 'Parse Span Id From', placeholder: 'processor_span_id_placeholder', - name: 'spanId', + name: ['span_id', 'parse_from'], }, { id: 4, - fieldName: 'Trace flags parse from', + fieldName: 'Parse Trace flags From', placeholder: 'processor_trace_flags_placeholder', - name: 'traceFlags', + name: ['trace_flags', 'parse_from'], }, ], retain: [ diff --git a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/LogsList/styles.scss b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/LogsList/styles.scss index 80cec9ef28..13d62e17cc 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/LogsList/styles.scss +++ b/frontend/src/container/PipelinePage/PipelineListsView/Preview/components/LogsList/styles.scss @@ -3,7 +3,6 @@ height: 100%; display: flex; flex-direction: column; - justify-content: space-between; align-items: stretch; box-sizing: border-box; @@ -11,8 +10,9 @@ } .logs-preview-list-item { - width: 100%; position: relative; + width: 100%; + max-height: 2rem; display: flex; justify-content: space-between; diff --git a/frontend/src/types/api/pipeline/def.ts b/frontend/src/types/api/pipeline/def.ts index 808aecf658..5462dfe611 100644 --- a/frontend/src/types/api/pipeline/def.ts +++ b/frontend/src/types/api/pipeline/def.ts @@ -16,6 +16,17 @@ export interface ProcessorData { on_error?: string; field?: string; value?: string; + + // trace parser fields. + trace_id?: { + parse_from: string; + }; + span_id?: { + parse_from: string; + }; + trace_flags?: { + parse_from: string; + }; } export interface PipelineData {