diff --git a/api/dataStores.yaml b/api/dataStores.yaml index bb9e33b4d2..16e2d836ec 100644 --- a/api/dataStores.yaml +++ b/api/dataStores.yaml @@ -182,6 +182,7 @@ components: type: string enum: [ + agent, jaeger, opensearch, tempo, @@ -195,7 +196,7 @@ components: honeycomb, azureappinsights, signoz, - dynatrace + dynatrace, ] SupportedClients: type: string diff --git a/cli/openapi/model_supported_data_stores.go b/cli/openapi/model_supported_data_stores.go index 92fbbd6abb..fd994890e8 100644 --- a/cli/openapi/model_supported_data_stores.go +++ b/cli/openapi/model_supported_data_stores.go @@ -20,6 +20,7 @@ type SupportedDataStores string // List of SupportedDataStores const ( + AGENT SupportedDataStores = "agent" JAEGER SupportedDataStores = "jaeger" OPENSEARCH SupportedDataStores = "opensearch" TEMPO SupportedDataStores = "tempo" @@ -38,6 +39,7 @@ const ( // All allowed values of SupportedDataStores enum var AllowedSupportedDataStoresEnumValues = []SupportedDataStores{ + "agent", "jaeger", "opensearch", "tempo", diff --git a/server/datastore/datastore_entities.go b/server/datastore/datastore_entities.go index 3327700835..ebd3f17ce3 100644 --- a/server/datastore/datastore_entities.go +++ b/server/datastore/datastore_entities.go @@ -141,6 +141,7 @@ const ( DatastoreTypeAzureAppInsights DataStoreType = "azureappinsights" DatastoreTypeSignoz DataStoreType = "signoz" DatastoreTypeDynatrace DataStoreType = "dynatrace" + DatastoreTypeAgent DataStoreType = "agent" ) var validTypes = []DataStoreType{ @@ -158,6 +159,7 @@ var validTypes = []DataStoreType{ DatastoreTypeAzureAppInsights, DatastoreTypeSignoz, DatastoreTypeDynatrace, + DatastoreTypeAgent, } var otlpBasedDataStores = []DataStoreType{ @@ -168,6 +170,7 @@ var otlpBasedDataStores = []DataStoreType{ DataStoreTypeHoneycomb, DatastoreTypeSignoz, DatastoreTypeDynatrace, + DatastoreTypeAgent, } func (ds DataStore) Validate() error { diff --git a/server/openapi/model_supported_data_stores.go b/server/openapi/model_supported_data_stores.go index 20423930e3..2e5caff4ab 100644 --- a/server/openapi/model_supported_data_stores.go +++ b/server/openapi/model_supported_data_stores.go @@ -13,6 +13,7 @@ type SupportedDataStores string // List of SupportedDataStores const ( + AGENT SupportedDataStores = "agent" JAEGER SupportedDataStores = "jaeger" OPENSEARCH SupportedDataStores = "opensearch" TEMPO SupportedDataStores = "tempo" diff --git a/web/src/components/CustomizationWrapper/CustomizationWrapper.tsx b/web/src/components/CustomizationWrapper/CustomizationWrapper.tsx index 1809013ec6..f19cbe3b98 100644 --- a/web/src/components/CustomizationWrapper/CustomizationWrapper.tsx +++ b/web/src/components/CustomizationWrapper/CustomizationWrapper.tsx @@ -1,12 +1,14 @@ import {useMemo} from 'react'; -import CustomizationProvider from 'providers/Customization'; +import CustomizationProvider, {Flag} from 'providers/Customization'; interface IProps { children: React.ReactNode; } +const flagValues = {[Flag.IsAnalyticsPageEnabled]: true, [Flag.IsAgentDataStoreEnabled]: false}; + const getComponent = (id: string, fallback: React.ComponentType) => fallback; -const getFlag = () => true; +const getFlag = (flag: Flag) => flagValues[flag]; const getIsAllowed = () => true; const CustomizationWrapper = ({children}: IProps) => { diff --git a/web/src/components/DataStoreIcon/DataStoreIcon.tsx b/web/src/components/DataStoreIcon/DataStoreIcon.tsx index 3fc2b92afa..35cbad07d7 100644 --- a/web/src/components/DataStoreIcon/DataStoreIcon.tsx +++ b/web/src/components/DataStoreIcon/DataStoreIcon.tsx @@ -1,5 +1,6 @@ import {useTheme} from 'styled-components'; import {SupportedDataStores} from 'types/DataStore.types'; +import Agent from './Icons/Agent'; import Elastic from './Icons/Elastic'; import Jaeger from './Icons/Jaeger'; import Lightstep from './Icons/Lightstep'; @@ -16,6 +17,7 @@ import Signoz from './Icons/Signoz'; import Dynatrace from './Icons/Dynatrace'; const iconMap = { + [SupportedDataStores.Agent]: Agent, [SupportedDataStores.JAEGER]: Jaeger, [SupportedDataStores.SignalFX]: SignalFx, [SupportedDataStores.ElasticApm]: Elastic, diff --git a/web/src/components/DataStoreIcon/Icons/Agent.tsx b/web/src/components/DataStoreIcon/Icons/Agent.tsx new file mode 100644 index 0000000000..65d2115212 --- /dev/null +++ b/web/src/components/DataStoreIcon/Icons/Agent.tsx @@ -0,0 +1,14 @@ +import {IIconProps} from '../DataStoreIcon'; + +const Agent = ({color, width = '20', height = '20'}: IIconProps) => ( + + + +); + +export default Agent; diff --git a/web/src/components/Settings/DataStoreForm/DataStoreForm.tsx b/web/src/components/Settings/DataStoreForm/DataStoreForm.tsx index e80c88b64f..a8c7a223c9 100644 --- a/web/src/components/Settings/DataStoreForm/DataStoreForm.tsx +++ b/web/src/components/Settings/DataStoreForm/DataStoreForm.tsx @@ -51,8 +51,12 @@ const DataStoreForm = ({ const onValidation = useCallback( async (_: any, draft: TDraftDataStore) => { - const isValid = await DataStoreService.validateDraft(draft); - onIsFormValid(isValid); + try { + const isValid = await DataStoreService.validateDraft(draft); + onIsFormValid(isValid); + } catch (e) { + onIsFormValid(false); + } }, [onIsFormValid] ); diff --git a/web/src/components/Settings/DataStoreForm/DataStoreSelectionInput.tsx b/web/src/components/Settings/DataStoreForm/DataStoreSelectionInput.tsx index 025c172bea..8954feea66 100644 --- a/web/src/components/Settings/DataStoreForm/DataStoreSelectionInput.tsx +++ b/web/src/components/Settings/DataStoreForm/DataStoreSelectionInput.tsx @@ -3,6 +3,7 @@ import {noop} from 'lodash'; import {useTheme} from 'styled-components'; import {ConfigMode, SupportedDataStores} from 'types/DataStore.types'; import {SupportedDataStoresToName} from 'constants/DataStore.constants'; +import {Flag, useCustomization} from 'providers/Customization'; import {useSettingsValues} from 'providers/SettingsValues/SettingsValues.provider'; import DataStoreIcon from '../../DataStoreIcon/DataStoreIcon'; @@ -16,6 +17,7 @@ interface IProps { const supportedDataStoreList = Object.values(SupportedDataStores); const DataStoreSelectionInput = ({onChange = noop, value = SupportedDataStores.JAEGER}: IProps) => { + const {getFlag} = useCustomization(); const { color: {text, primary}, } = useTheme(); @@ -25,6 +27,10 @@ const DataStoreSelectionInput = ({onChange = noop, value = SupportedDataStores.J return ( {supportedDataStoreList.map(dataStore => { + if (dataStore === SupportedDataStores.Agent && !getFlag(Flag.IsAgentDataStoreEnabled)) { + return null; + } + const isSelected = value === dataStore; const isConfigured = configuredDataStoreType === dataStore && dataStoreConfig.mode === ConfigMode.READY; return ( diff --git a/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx b/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx index 04443dc97f..0a5c9c2d0f 100644 --- a/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx +++ b/web/src/components/Settings/DataStorePlugin/DataStorePlugin.tsx @@ -1,4 +1,5 @@ import {IDataStorePluginMap, SupportedDataStores} from 'types/DataStore.types'; +import Agent from './forms/Agent'; import GrpcClient from './forms/GrpcClient'; import ElasticSearch from './forms/ElasticSearch'; import OpenTelemetryCollector from './forms/OpenTelemetryCollector'; @@ -8,6 +9,7 @@ import AwsXRay from './forms/AwsXRay'; import AzureAppInsights from './forms/AzureAppInsights/AzureAppInsights'; export const DataStoreComponentMap: IDataStorePluginMap = { + [SupportedDataStores.Agent]: Agent, [SupportedDataStores.JAEGER]: GrpcClient, [SupportedDataStores.TEMPO]: BaseClient, [SupportedDataStores.SignalFX]: SignalFx, diff --git a/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.styled.ts b/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.styled.ts new file mode 100644 index 0000000000..6279787ff1 --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.styled.ts @@ -0,0 +1,24 @@ +import {Typography} from 'antd'; +import styled from 'styled-components'; + +export const Container = styled.div``; + +export const Title = styled(Typography.Title)` + && { + font-size: ${({theme}) => theme.size.md}; + } +`; + +export const Description = styled(Typography.Paragraph)` + && { + color: ${({theme}) => theme.color.textSecondary}; + font-size: ${({theme}) => theme.size.md}; + } +`; + +export const SwitchContainer = styled.div` + align-items: center; + display: flex; + gap: 8px; + margin-bottom: 18px; +`; diff --git a/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.tsx b/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.tsx new file mode 100644 index 0000000000..dbe5c09b48 --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.tsx @@ -0,0 +1,12 @@ +import {Col, Row} from 'antd'; +import Ingestor from './Ingestor'; + +const Agent = () => ( + + + + + +); + +export default Agent; diff --git a/web/src/components/Settings/DataStorePlugin/forms/Agent/Ingestor.tsx b/web/src/components/Settings/DataStorePlugin/forms/Agent/Ingestor.tsx new file mode 100644 index 0000000000..06f6d728d5 --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/Agent/Ingestor.tsx @@ -0,0 +1,40 @@ +import {Form, Switch} from 'antd'; +import DocsBanner from 'components/DocsBanner/DocsBanner'; +import {TCollectorDataStores, TDraftDataStore} from 'types/DataStore.types'; +import * as S from './Agent.styled'; + +const Ingestor = () => { + const form = Form.useFormInstance(); + const dataStoreType = Form.useWatch('dataStoreType', form) as TCollectorDataStores; + const baseName = ['dataStore', dataStoreType]; + + return ( + + + The Tracetest Agent can be used to collect OpenTelemetry trace information from the host it is running on. + + Ingestor Endpoint + + The Tracetest Agent exposes trace ingestion endpoints on ports 4317 for gRPC and 4318 for HTTP. Turn on the + Tracetest ingestion endpoint to start sending traces. Use your local hostname and port to connect. For example, + localhost:4317 for gRPC. + + + + + + + + + Need more information about setting up the agent ingestion endpoint?{' '} + + Go to our docs + + + + ); +}; + +export default Ingestor; diff --git a/web/src/components/Settings/DataStorePlugin/forms/Agent/index.ts b/web/src/components/Settings/DataStorePlugin/forms/Agent/index.ts new file mode 100644 index 0000000000..9fe8afc59c --- /dev/null +++ b/web/src/components/Settings/DataStorePlugin/forms/Agent/index.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export {default} from './Agent'; diff --git a/web/src/components/Settings/DataStorePlugin/forms/OpenTelemetryCollector/Ingestor.tsx b/web/src/components/Settings/DataStorePlugin/forms/OpenTelemetryCollector/Ingestor.tsx index dfaaede286..727f2aa150 100644 --- a/web/src/components/Settings/DataStorePlugin/forms/OpenTelemetryCollector/Ingestor.tsx +++ b/web/src/components/Settings/DataStorePlugin/forms/OpenTelemetryCollector/Ingestor.tsx @@ -18,14 +18,16 @@ const Ingestor = () => { Ingestor Endpoint Tracetest exposes trace ingestion endpoints on ports 4317 for gRPC and 4318 for HTTP. Turn on the Tracetest - ingestion endpoint to start sending traces. Use the Tracetest Server’s hostname and port to connect.For example, - with Docker use tracetest:4317 for gRPC. + ingestion endpoint to start sending traces. Use the Tracetest Server’s hostname and port to connect. For + example, with Docker use tracetest:4317 for gRPC. - Enable Tracetest ingestion endpoint + Need more information about setting up ingestion endpoint?{' '} diff --git a/web/src/constants/DataStore.constants.tsx b/web/src/constants/DataStore.constants.tsx index 1a84e01268..4fda70c483 100644 --- a/web/src/constants/DataStore.constants.tsx +++ b/web/src/constants/DataStore.constants.tsx @@ -1,6 +1,7 @@ import {SupportedDataStores} from '../types/DataStore.types'; export const SupportedDataStoresToName = { + [SupportedDataStores.Agent]: 'Agent', [SupportedDataStores.JAEGER]: 'Jaeger', [SupportedDataStores.OpenSearch]: 'OpenSearch', [SupportedDataStores.SignalFX]: 'SignalFX', @@ -18,6 +19,7 @@ export const SupportedDataStoresToName = { } as const; export const SupportedDataStoresToDocsLink = { + [SupportedDataStores.Agent]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/agent', [SupportedDataStores.JAEGER]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/jaeger', [SupportedDataStores.OpenSearch]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/opensearch', [SupportedDataStores.ElasticApm]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/elasticapm', @@ -32,13 +34,12 @@ export const SupportedDataStoresToDocsLink = { [SupportedDataStores.Honeycomb]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/honeycomb', [SupportedDataStores.AzureAppInsights]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/azure-app-insights', - [SupportedDataStores.Signoz]: - 'https://docs.tracetest.io/configuration/connecting-to-data-stores/signoz', - [SupportedDataStores.Dynatrace]: - 'https://docs.tracetest.io/configuration/connecting-to-data-stores/dynatrace', + [SupportedDataStores.Signoz]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/signoz', + [SupportedDataStores.Dynatrace]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/dynatrace', } as const; export const SupportedDataStoresToDefaultEndpoint = { + [SupportedDataStores.Agent]: '', [SupportedDataStores.JAEGER]: 'jaeger:16685', [SupportedDataStores.OpenSearch]: 'http://opensearch:9200', [SupportedDataStores.SignalFX]: '', diff --git a/web/src/models/DataStore.model.ts b/web/src/models/DataStore.model.ts index aa42418b4a..fb4fc07cb1 100644 --- a/web/src/models/DataStore.model.ts +++ b/web/src/models/DataStore.model.ts @@ -14,6 +14,7 @@ type DataStore = Model['spec'] & { azureappinsights?: TRawAzureAppInsightsDataStore & TRawOtlpDataStore; signoz?: TRawOtlpDataStore; dynatrace?: TRawOtlpDataStore; + agent?: TRawOtlpDataStore; }; const DataStore = ({ diff --git a/web/src/providers/Customization/Customization.provider.tsx b/web/src/providers/Customization/Customization.provider.tsx index a83cd95f57..2aa5d5437a 100644 --- a/web/src/providers/Customization/Customization.provider.tsx +++ b/web/src/providers/Customization/Customization.provider.tsx @@ -8,6 +8,7 @@ export enum Operation { export enum Flag { IsAnalyticsPageEnabled = 'isAnalyticsPageEnabled', + IsAgentDataStoreEnabled = 'isAgentDataStoreEnabled', } interface IContext { diff --git a/web/src/services/DataStore.service.ts b/web/src/services/DataStore.service.ts index f52635855b..ab7631fdf4 100644 --- a/web/src/services/DataStore.service.ts +++ b/web/src/services/DataStore.service.ts @@ -10,6 +10,7 @@ import AwsXRayService from './DataStores/AwsXRay.service'; import AzureAppInsightsService from './DataStores/AzureAppInsights.service'; const dataStoreServiceMap = { + [SupportedDataStores.Agent]: OtelCollectorService, [SupportedDataStores.JAEGER]: JaegerService, [SupportedDataStores.TEMPO]: BaseClientService, [SupportedDataStores.OpenSearch]: ElasticSearchService, diff --git a/web/src/types/DataStore.types.ts b/web/src/types/DataStore.types.ts index a27d8b4e3a..7943dd2ed3 100644 --- a/web/src/types/DataStore.types.ts +++ b/web/src/types/DataStore.types.ts @@ -1,7 +1,7 @@ import {FormInstance} from 'antd'; import {Model, TDataStoreSchemas, TConfigSchemas} from 'types/Common.types'; import ConnectionTestStep from 'models/ConnectionResultStep.model'; -import DataStore, { TRawOtlpDataStore } from 'models/DataStore.model'; +import DataStore, {TRawOtlpDataStore} from 'models/DataStore.model'; import DataStoreConfig from 'models/DataStoreConfig.model'; import {THeader} from './Test.types'; @@ -16,6 +16,7 @@ export enum ConnectionTypes { } export enum SupportedDataStores { + Agent = 'agent', JAEGER = 'jaeger', TEMPO = 'tempo', OtelCollector = 'otlp', @@ -29,7 +30,7 @@ export enum SupportedDataStores { Honeycomb = 'honeycomb', AzureAppInsights = 'azureappinsights', Signoz = 'signoz', - Dynatrace = 'dynatrace' + Dynatrace = 'dynatrace', } export enum SupportedClientTypes { @@ -88,6 +89,7 @@ export interface IElasticSearch extends TRawElasticSearch { } export type IDataStore = DataStore & { + agent?: TRawOtlpDataStore; jaeger?: IBaseClientSettings; tempo?: IBaseClientSettings; opensearch?: IElasticSearch; diff --git a/web/src/types/Generated.types.ts b/web/src/types/Generated.types.ts index 3fba1a6f1d..1780de0984 100644 --- a/web/src/types/Generated.types.ts +++ b/web/src/types/Generated.types.ts @@ -1382,6 +1382,7 @@ export interface external { }; /** @enum {string} */ SupportedDataStores: + | "agent" | "jaeger" | "opensearch" | "tempo"