From 6ef2a040f8f192e1c67e2635f093788471dd64eb Mon Sep 17 00:00:00 2001 From: Ben Elferink Date: Thu, 21 Nov 2024 13:53:50 +0200 Subject: [PATCH] [GEN-1776]: re-categorize actions in add-action-form (#1814) --- .../choose-action-modal/action-options.ts | 92 ++++++++++--------- frontend/webapp/utils/functions/icons.ts | 7 +- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/frontend/webapp/containers/main/actions/choose-action-modal/action-options.ts b/frontend/webapp/containers/main/actions/choose-action-modal/action-options.ts index 50de8bdb3..1ee2cb98d 100644 --- a/frontend/webapp/containers/main/actions/choose-action-modal/action-options.ts +++ b/frontend/webapp/containers/main/actions/choose-action-modal/action-options.ts @@ -15,46 +15,52 @@ export type ActionOption = { export const ACTION_OPTIONS: ActionOption[] = [ { - id: 'add_cluster_info', - label: 'Add Cluster Info', - description: 'Add static cluster-scoped attributes to your data.', - type: ActionsType.ADD_CLUSTER_INFO, - icon: getActionIcon(ActionsType.ADD_CLUSTER_INFO), - docsEndpoint: '/pipeline/actions/attributes/addclusterinfo', - docsDescription: - 'The “Add Cluster Info” Odigos Action can be used to add resource attributes to telemetry signals originated from the k8s cluster where the Odigos is running.', - allowedSignals: ['TRACES', 'METRICS', 'LOGS'], - }, - { - id: 'delete_attribute', - label: 'Delete Attribute', - description: 'Delete attributes from logs, metrics, and traces.', - type: ActionsType.DELETE_ATTRIBUTES, - icon: getActionIcon(ActionsType.DELETE_ATTRIBUTES), - docsEndpoint: '/pipeline/actions/attributes/deleteattribute', - docsDescription: 'The “Delete Attribute” Odigos Action can be used to delete attributes from logs, metrics, and traces.', - allowedSignals: ['TRACES', 'METRICS', 'LOGS'], - }, - { - id: 'rename_attribute', - label: 'Rename Attribute', - description: 'Rename attributes in logs, metrics, and traces.', - type: ActionsType.RENAME_ATTRIBUTES, - icon: getActionIcon(ActionsType.RENAME_ATTRIBUTES), - docsEndpoint: '/pipeline/actions/attributes/rename-attribute', - docsDescription: - 'The “Rename Attribute” Odigos Action can be used to rename attributes from logs, metrics, and traces. Different instrumentations might use different attribute names for similar information. This action let’s you to consolidate the names across your cluster.', - allowedSignals: ['TRACES', 'METRICS', 'LOGS'], - }, - { - id: 'pii-masking', - label: 'PII Masking', - description: 'Mask PII data in your traces.', - type: ActionsType.PII_MASKING, - icon: getActionIcon(ActionsType.PII_MASKING), - docsEndpoint: '/pipeline/actions/attributes/piimasking', - docsDescription: 'The “PII Masking” Odigos Action can be used to mask PII data from span attribute values.', - allowedSignals: ['TRACES'], + id: 'attributes', + label: 'Attributes', + icon: getActionIcon('attributes'), + items: [ + { + id: 'add_cluster_info', + label: 'Add Cluster Info', + description: 'Add static cluster-scoped attributes to your data.', + type: ActionsType.ADD_CLUSTER_INFO, + icon: getActionIcon(ActionsType.ADD_CLUSTER_INFO), + docsEndpoint: '/pipeline/actions/attributes/addclusterinfo', + docsDescription: 'The “Add Cluster Info” Odigos Action can be used to add resource attributes to telemetry signals originated from the k8s cluster where the Odigos is running.', + allowedSignals: ['TRACES', 'METRICS', 'LOGS'], + }, + { + id: 'delete_attribute', + label: 'Delete Attribute', + description: 'Delete attributes from logs, metrics, and traces.', + type: ActionsType.DELETE_ATTRIBUTES, + icon: getActionIcon(ActionsType.DELETE_ATTRIBUTES), + docsEndpoint: '/pipeline/actions/attributes/deleteattribute', + docsDescription: 'The “Delete Attribute” Odigos Action can be used to delete attributes from logs, metrics, and traces.', + allowedSignals: ['TRACES', 'METRICS', 'LOGS'], + }, + { + id: 'rename_attribute', + label: 'Rename Attribute', + description: 'Rename attributes in logs, metrics, and traces.', + type: ActionsType.RENAME_ATTRIBUTES, + icon: getActionIcon(ActionsType.RENAME_ATTRIBUTES), + docsEndpoint: '/pipeline/actions/attributes/rename-attribute', + docsDescription: + 'The “Rename Attribute” Odigos Action can be used to rename attributes from logs, metrics, and traces. Different instrumentations might use different attribute names for similar information. This action let’s you to consolidate the names across your cluster.', + allowedSignals: ['TRACES', 'METRICS', 'LOGS'], + }, + { + id: 'pii-masking', + label: 'PII Masking', + description: 'Mask PII data in your traces.', + type: ActionsType.PII_MASKING, + icon: getActionIcon(ActionsType.PII_MASKING), + docsEndpoint: '/pipeline/actions/attributes/piimasking', + docsDescription: 'The “PII Masking” Odigos Action can be used to mask PII data from span attribute values.', + allowedSignals: ['TRACES'], + }, + ], }, { id: 'sampler', @@ -78,8 +84,7 @@ export const ACTION_OPTIONS: ActionOption[] = [ type: ActionsType.PROBABILISTIC_SAMPLER, icon: getActionIcon('sampler'), docsEndpoint: '/pipeline/actions/sampling/probabilisticsampler', - docsDescription: - 'The “Probabilistic Sampler” Odigos Action supports probabilistic sampling based on a configured sampling percentage applied to the TraceID.', + docsDescription: 'The “Probabilistic Sampler” Odigos Action supports probabilistic sampling based on a configured sampling percentage applied to the TraceID.', allowedSignals: ['TRACES'], }, { @@ -89,8 +94,7 @@ export const ACTION_OPTIONS: ActionOption[] = [ type: ActionsType.LATENCY_SAMPLER, icon: getActionIcon('sampler'), docsEndpoint: '/pipeline/actions/sampling/latencysampler', - docsDescription: - 'The “Latency Sampler” Odigos Action is an Endpoint Action that samples traces based on their duration for a specific service and endpoint (HTTP route) filter.', + docsDescription: 'The “Latency Sampler” Odigos Action is an Endpoint Action that samples traces based on their duration for a specific service and endpoint (HTTP route) filter.', allowedSignals: ['TRACES'], }, ], diff --git a/frontend/webapp/utils/functions/icons.ts b/frontend/webapp/utils/functions/icons.ts index 17e8f727c..9f747bd77 100644 --- a/frontend/webapp/utils/functions/icons.ts +++ b/frontend/webapp/utils/functions/icons.ts @@ -33,11 +33,14 @@ export const getRuleIcon = (type?: InstrumentationRuleType) => { return `/icons/rules/${typeLowerCased}.svg`; }; -export const getActionIcon = (type?: ActionsType | 'sampler') => { +export const getActionIcon = (type?: ActionsType | 'sampler' | 'attributes') => { if (!type) return BRAND_ICON; const typeLowerCased = type.toLowerCase(); const isSampler = typeLowerCased.includes('sampler'); + const isAttributes = typeLowerCased === 'attributes'; - return `/icons/actions/${isSampler ? 'sampler' : typeLowerCased}.svg`; + const iconName = isSampler ? 'sampler' : isAttributes ? 'piimasking' : typeLowerCased; + + return `/icons/actions/${iconName}.svg`; };