Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dynamic Collector Config #3372

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions web/src/components/Settings/DataStorePlugin/forms/Agent/Agent.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import {Col, Row} from 'antd';
import Ingestor from './Ingestor';
import Configuration from '../OpenTelemetryCollector/Configuration';

const Agent = () => (
<Row gutter={[16, 16]}>
<Col span={24}>
<Ingestor />
</Col>
</Row>
<>
<Row gutter={[16, 16]}>
<Col span={24}>
<Ingestor />
</Col>
</Row>
<Row gutter={[16, 16]}>
<Col span={24}>
<Configuration />
</Col>
</Row>
</>
);

export default Agent;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Col, Form, Row} from 'antd';
import {CollectorConfigMap} from 'constants/CollectorConfig.constants';
import {TCollectorDataStores, TDraftDataStore} from 'types/DataStore.types';
import {FramedCodeBlock} from 'components/CodeBlock';
import {withCustomization} from 'providers/Customization';
import * as S from './OpenTelemetryCollector.styled';
import DataStoreDocsBanner from '../../../DataStoreDocsBanner/DataStoreDocsBanner';

Expand Down Expand Up @@ -34,4 +35,4 @@ const Configuration = () => {
);
};

export default Configuration;
export default withCustomization(Configuration, 'collectorConfiguration');
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Form, Switch} from 'antd';
import DocsBanner from 'components/DocsBanner/DocsBanner';
import {INGESTOR_ENDPOINT_URL} from 'constants/Common.constants';
import {withCustomization} from 'providers/Customization';
import {TCollectorDataStores, TDraftDataStore} from 'types/DataStore.types';
import * as S from './OpenTelemetryCollector.styled';

Expand Down Expand Up @@ -39,4 +40,4 @@ const Ingestor = () => {
);
};

export default Ingestor;
export default withCustomization(Ingestor, 'ingestorConfiguration');
97 changes: 49 additions & 48 deletions web/src/constants/CollectorConfig.constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {SupportedDataStores} from '../types/DataStore.types';
import {SupportedDataStores} from 'types/DataStore.types';

export const Lightstep = `receivers:
export const tracetest = `# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true`;

export const Lightstep = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -13,11 +19,9 @@ processors:
exporters:
logging:
logLevel: debug
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true

${traceTestBlock}

# OTLP for Lightstep
otlp/lightstep:
endpoint: ingest.lightstep.com:443
Expand All @@ -36,7 +40,7 @@ service:
exporters: [logging, otlp/lightstep]
`;

export const OtelCollector = `receivers:
export const OtelCollector = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -47,10 +51,7 @@ processors:
timeout: 100ms

exporters:
otlp/1:
endpoint: tracetest:4317
tls:
insecure: true
${traceTestBlock}

service:
pipelines:
Expand All @@ -60,7 +61,7 @@ service:
exporters: [otlp/1]
`;

export const NewRelic = `receivers:
export const NewRelic = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -73,11 +74,9 @@ processors:
exporters:
logging:
logLevel: debug
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true

${traceTestBlock}

# OTLP for New Relic
otlp/newrelic:
endpoint: otlp.nr-data.net:443
Expand All @@ -98,7 +97,7 @@ service:
exporters: [logging, otlp/newrelic]
`;

export const Datadog = `receivers:
export const Datadog = (traceTestBlock: string) => `receivers:
otlp:
protocols:
http:
Expand All @@ -111,11 +110,8 @@ processors:
timeout: 10s

exporters:
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true
${traceTestBlock}

# Datadog exporter
datadog:
api:
Expand All @@ -134,7 +130,7 @@ service:
exporters: [datadog]
`;

export const Honeycomb = `receivers:
export const Honeycomb = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -147,11 +143,9 @@ processors:
exporters:
logging:
logLevel: debug
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true

${traceTestBlock}

# OTLP for Honeycomb
otlp/honeycomb:
endpoint: "api.honeycomb.io:443"
Expand All @@ -171,7 +165,7 @@ service:
exporters: [logging, otlp/honeycomb]
`;

export const AzureAppInsights = `receivers:
export const AzureAppInsights = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -183,10 +177,8 @@ processors:
exporters:
azuremonitor:
instrumentation_key: <your-instrumentation-key>
otlp/tracetest:
endpoint: tracetest:4317
tls:
insecure: true

${traceTestBlock}

service:
pipelines:
Expand All @@ -199,7 +191,7 @@ service:
exporters: [azuremonitor]
`;

export const Signoz = `receivers:
export const Signoz = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -212,11 +204,9 @@ processors:
exporters:
logging:
logLevel: debug
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true

${traceTestBlock}

# OTLP for Signoz
otlp/signoz:
endpoint: address-to-your-signoz-server:4317 # Send traces to Signoz. Read more in docs here: https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/#opentelemetry-collector-configuration
Expand All @@ -235,7 +225,7 @@ service:
exporters: [logging, otlp/signoz]
`;

export const Dynatrace = `receivers:
export const Dynatrace = (traceTestBlock: string) => `receivers:
otlp:
protocols:
grpc:
Expand All @@ -247,12 +237,10 @@ processors:

exporters:
logging:
verbosity: detailed
# OTLP for Tracetest
otlp/tracetest:
endpoint: tracetest:4317 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true
verbosity: detailed

${traceTestBlock}

# OTLP for Dynatrace
otlphttp/dynatrace:
endpoint: https://abc12345.live.dynatrace.com/api/v2/otlp # Send traces to Dynatrace. Read more in docs here: https://www.dynatrace.com/support/help/extend-dynatrace/opentelemetry/collector#configuration
Expand All @@ -272,6 +260,18 @@ service:
`;

export const CollectorConfigMap = {
[SupportedDataStores.Datadog]: Datadog(tracetest),
[SupportedDataStores.Lightstep]: Lightstep(tracetest),
[SupportedDataStores.NewRelic]: NewRelic(tracetest),
[SupportedDataStores.OtelCollector]: OtelCollector(tracetest),
[SupportedDataStores.Honeycomb]: Honeycomb(tracetest),
[SupportedDataStores.AzureAppInsights]: AzureAppInsights(tracetest),
[SupportedDataStores.Signoz]: Signoz(tracetest),
[SupportedDataStores.Dynatrace]: Dynatrace(tracetest),
[SupportedDataStores.Agent]: OtelCollector(tracetest),
} as const;

export const CollectorConfigFunctionMap = {
[SupportedDataStores.Datadog]: Datadog,
[SupportedDataStores.Lightstep]: Lightstep,
[SupportedDataStores.NewRelic]: NewRelic,
Expand All @@ -280,4 +280,5 @@ export const CollectorConfigMap = {
[SupportedDataStores.AzureAppInsights]: AzureAppInsights,
[SupportedDataStores.Signoz]: Signoz,
[SupportedDataStores.Dynatrace]: Dynatrace,
[SupportedDataStores.Agent]: OtelCollector,
} as const;
3 changes: 2 additions & 1 deletion web/src/types/DataStore.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export type TCollectorDataStores =
| SupportedDataStores.Lightstep
| SupportedDataStores.Datadog
| SupportedDataStores.Signoz
| SupportedDataStores.Dynatrace;
| SupportedDataStores.Dynatrace
| SupportedDataStores.Agent;

export type TRawGRPCClientSettings = TDataStoreSchemas['GRPCClientSettings'];
export type TRawElasticSearch = TDataStoreSchemas['ElasticSearch'];
Expand Down
Loading