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

chore(ui): adding support for Datadog Data Store #1972

Merged
merged 4 commits into from
Feb 13, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions api/dataStores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ components:
elasticApm,
newRelic,
lightstep,
datadog
]
SupportedClients:
type: string
Expand Down
2 changes: 2 additions & 0 deletions cli/openapi/model_supported_data_stores.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions docs/docs/configuration/connecting-to-data-stores/datadog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Datadog

If you want to use [Datadog](https://www.datadoghq.com/) as the trace data store, you'll configure the OpenTelemetry Collector to receive traces from your system and then send them to both Tracetest and Datadog. And, you don't have to change your existing pipelines to do so.

:::tip
Examples of configuring Tracetest with Datadog can be found in the [`examples` folder of the Tracetest GitHub repo](https://github.com/kubeshop/tracetest/tree/main/examples).
:::

## Configuring OpenTelemetry Collector to Send Traces to both Datadog and Tracetest

In your OpenTelemetry Collector config file, make sure to set the `exporter` to `otlp/tt`, with the `endpoint` pointing to your Tracetest instance on port `21321`. If you are running Tracetest with Docker, the endpoint might look like this `http://tracetest:21321`.

Additionally, set another `exporter` to `datadog`, with the `endpoint` pointing to your Datadog account. Set the site to the Datadog API `datadoghq.com` and add your API key.

```yaml
# collector.config.yaml

# If you already have receivers declared, you can just ignore
# this one and still use yours instead.
receivers:
otlp:
protocols:
http:
grpc:

processors:
batch:
send_batch_max_size: 100
send_batch_size: 10
timeout: 10s

exporters:
# OTLP for Tracetest
otlp/tt:
endpoint: tracetest:21321 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true
# Datadog exporter
datadog:
api:
site: datadoghq.com
key: <datadog_API_key> # Add here you API key for Datadog
# Read more in docs here: https://docs.datadoghq.com/opentelemetry/otel_collector_datadog_exporter
service:
pipelines:
traces/tt:
receivers: [otlp]
processors: [batch]
exporters: [otlp/tt] # exporter sending traces to your Tracetest instance
traces/dd:
receivers: [otlp]
processors: [batch]
exporters: [datadog] # exporter sending traces to directly to Datadog
```

### Configure Tracetest to Use Lightstep as a Trace Data Store

You also have to configure your Tracetest instance to expose an `otlp` endpoint to make it aware it will receive traces from the OpenTelemetry Collector.

### Web UI

In the Web UI, open settings, and select Datadog.

![](../img/configure-datadog.png)

### CLI

Or, if you prefer using the CLI, you can use this file config.

```yaml
type: DataStore
spec:
name: OpenTelemetry Collector pipeline
type: otlp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the type be datadog here? I know it's going to work with otlp, but to be able to display the proper selected option in the UI should we have datadog here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we can change this for Datadog. I'll do this on the next PR, that handles examples and documentation.

isDefault: true
```

Proceed to run this command in the terminal, and specify the file above.

```bash
tracetest datastore apply -f my/data-store/file/location.yaml
```
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ const sidebars = {
id: "configuration/connecting-to-data-stores/new-relic",
label: "New Relic",
},
{
type: "doc",
id: "configuration/connecting-to-data-stores/datadog",
label: "Datadog",
},
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion examples/quick-start-datadog-nodejs/test-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: Test
spec:
id: W656Q0c4g
name: http://app:8080
description: akadlkasjdf
description: Calling Hello World API
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem with akadlkasjdf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My documentation OCD won't free me if I don't update this description 😂

trigger:
type: http
httpRequest:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# One example on how to set up a collector configuration for Datadog can be seen here:
# https://docs.datadoghq.com/opentelemetry/otel_collector_datadog_exporter/?tab=onahost

receivers:
otlp:
protocols:
Expand All @@ -23,7 +20,8 @@ exporters:
datadog:
api:
site: datadoghq.com
key: ${DATADOG_API_KEY} # Add here you API key for Datadog
key: <datadog_API_key> # Add here you API key for Datadog
# Read more in docs here: https://docs.datadoghq.com/opentelemetry/otel_collector_datadog_exporter

service:
pipelines:
Expand Down
3 changes: 3 additions & 0 deletions server/model/data_stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const (
newrelic string = "newrelic"
lighstep string = "lighstep"
elasticapm string = "elasticapm"
datadog string = "datadog"
)

func DataStoreFromConfig(dsc config.TracingBackendDataStoreConfig) DataStore {
Expand All @@ -84,6 +85,8 @@ func DataStoreFromConfig(dsc config.TracingBackendDataStoreConfig) DataStore {
ds.Type = openapi.NEW_RELIC
case lighstep:
ds.Type = openapi.LIGHTSTEP
case datadog:
ds.Type = openapi.DATADOG
case otlp:
ds.Type = openapi.OTLP
}
Expand Down
1 change: 1 addition & 0 deletions server/openapi/model_supported_data_stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
ELASTIC_APM SupportedDataStores = "elasticApm"
NEW_RELIC SupportedDataStores = "newRelic"
LIGHTSTEP SupportedDataStores = "lightstep"
DATADOG SupportedDataStores = "datadog"
)

// AssertSupportedDataStoresRequired checks if the required fields are not zero-ed
Expand Down
1 change: 1 addition & 0 deletions server/tracedb/tracedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (f *traceDBFactory) New(ds model.DataStore) (tdb TraceDB, err error) {
tdb, err = newSignalFXDB(ds.Values.SignalFx)
case openapi.NEW_RELIC:
case openapi.LIGHTSTEP:
case openapi.DATADOG:
case openapi.OTLP:
tdb, err = newCollectorDB(f.repo)
default:
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/DataStoreIcon/DataStoreIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {SupportedDataStores} from 'types/Config.types';
import Elastic from './Icons/Elastic';
import Jaeger from './Icons/Jaeger';
import Lightstep from './Icons/Lightstep';
import NewRelic from './Icons/NewrRelic';
import Datadog from './Icons/Datadog';
import NewRelic from './Icons/NewRelic';
import OpenSearch from './Icons/OpenSearch';
import Otlp from './Icons/Otlp';
import SignalFx from './Icons/SignalFx';
Expand All @@ -18,6 +19,7 @@ const iconMap = {
[SupportedDataStores.OpenSearch]: OpenSearch,
[SupportedDataStores.NewRelic]: NewRelic,
[SupportedDataStores.Lightstep]: Lightstep,
[SupportedDataStores.Datadog]: Datadog,
} as const;

interface IProps {
Expand Down
14 changes: 14 additions & 0 deletions web/src/components/DataStoreIcon/Icons/Datadog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {IIconProps} from '../DataStoreIcon';

const Datadog = ({color, width = '20', height = '20'}: IIconProps) => {
return (
<svg width={width} height={height} viewBox="0 0 19 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M15.5705 14.1915L13.9152 13.0947L12.5343 15.4118L10.9282 14.9401L9.51412 17.1082L9.58662 17.7907L17.2753 16.3676L16.8287 11.5418L15.5705 14.1915ZM8.4002 12.1109L9.63378 11.9405C9.83338 12.0306 9.97233 12.0649 10.2117 12.126C10.5844 12.2236 11.0158 12.3172 11.6548 11.9937C11.8035 11.9197 12.1133 11.6352 12.2385 11.473L17.2928 10.5519L17.8084 16.8204L9.14955 18.3881L8.4002 12.1109ZM17.7888 9.85213L17.29 9.9476L16.3315 0L0 1.90232L2.01199 18.3038L3.92359 18.0251C3.77093 17.8061 3.53323 17.5412 3.1273 17.2021C2.5643 16.7322 2.76343 15.9342 3.09547 15.4302C3.53486 14.5787 5.79872 13.4966 5.67046 12.1356C5.62445 11.6408 5.54615 10.9966 5.08887 10.5552C5.07167 10.7384 5.10258 10.9149 5.10258 10.9149C5.10258 10.9149 4.91483 10.6742 4.82119 10.346C4.72825 10.2202 4.65529 10.1801 4.55654 10.012C4.48613 10.2065 4.49543 10.4319 4.49543 10.4319C4.49543 10.4319 4.34184 10.0673 4.31697 9.7597C4.22589 9.89742 4.20289 10.1591 4.20289 10.1591C4.20289 10.1591 4.00329 9.58441 4.04883 9.2749C3.95775 9.00554 3.68775 8.47103 3.7642 7.25611C4.2626 7.60693 5.3598 7.5236 5.78733 6.89059C5.92931 6.68098 6.02643 6.10865 5.71646 4.98104C5.51733 4.25792 5.02427 3.18119 4.83211 2.77271L4.80911 2.78929C4.91042 3.1184 5.11931 3.80837 5.19947 4.14285C5.44205 5.1575 5.50711 5.51065 5.39326 5.97841C5.29636 6.38502 5.064 6.65111 4.47498 6.94847C3.88595 7.24678 3.1043 6.52086 3.05481 6.48072C2.48251 6.02276 2.03987 5.2756 1.99038 4.91265C1.93903 4.51538 2.21832 4.27683 2.35913 3.95192C2.15767 4.0098 1.93298 4.11251 1.93298 4.11251C1.93298 4.11251 2.20112 3.83381 2.53177 3.59269C2.66863 3.50166 2.74902 3.44378 2.89332 3.32334C2.68443 3.31983 2.51481 3.3259 2.51481 3.3259C2.51481 3.3259 2.86311 3.13684 3.2242 2.99912C2.96001 2.98745 2.7072 2.99726 2.7072 2.99726C2.7072 2.99726 3.48444 2.64807 4.09833 2.39178C4.52052 2.21789 4.93295 2.26924 5.16462 2.60582C5.46877 3.04674 5.78826 3.28622 6.46535 3.43467C6.88104 3.24958 7.00744 3.15434 7.52979 3.0115C7.98962 2.50359 8.35071 2.43777 8.35071 2.43777C8.35071 2.43777 8.17156 2.60279 8.12369 2.86211C8.3844 2.65577 8.6702 2.48352 8.6702 2.48352C8.6702 2.48352 8.55959 2.62076 8.45643 2.83877L8.48036 2.87448C8.78452 2.69125 9.14212 2.54677 9.14212 2.54677C9.14212 2.54677 9.03988 2.67655 8.91998 2.84461C9.14932 2.84274 9.6145 2.85441 9.79504 2.87495C10.8609 2.89852 11.0821 1.73146 11.491 1.58511C12.0031 1.40141 12.232 1.29031 13.1047 2.15137C13.8536 2.89059 14.4387 4.21381 14.1483 4.51024C13.9048 4.75626 13.4242 4.41431 12.8917 3.74745C12.6103 3.39429 12.3974 2.97695 12.2978 2.4464C12.2137 1.99872 11.8863 1.73893 11.8863 1.73893C11.8863 1.73893 12.0763 2.16327 12.0763 2.53813C12.0763 2.74284 12.1019 3.5082 12.4286 3.93768C12.3963 4.00047 12.3812 4.24835 12.3454 4.29573C11.9653 3.83428 11.149 3.504 11.0158 3.40666C11.4664 3.77756 12.502 4.62951 12.8998 5.44599C13.276 6.21812 13.0543 6.92583 13.2446 7.10906C13.2988 7.16158 14.0537 8.10644 14.1989 8.5812C14.4522 9.40865 14.214 10.2781 13.8824 10.8175L12.9565 10.9625C12.821 10.9247 12.7297 10.9058 12.6082 10.835C12.6751 10.716 12.8083 10.4191 12.8096 10.3579L12.7574 10.2657C12.4692 10.6758 11.9864 11.0741 11.5854 11.3028C11.0605 11.6016 10.4554 11.5556 10.0616 11.433C8.94368 11.0867 7.88669 10.3278 7.63179 10.1285C7.63179 10.1285 7.62389 10.2877 7.67199 10.3234C7.95384 10.6427 8.59956 11.2204 9.22367 11.623L7.89319 11.7701L8.52219 16.69C8.24336 16.7301 8.19991 16.7497 7.89459 16.7934C7.62552 15.8385 7.11084 15.215 6.54831 14.8518C6.05222 14.5316 5.36793 14.4595 4.71291 14.5897L4.67086 14.6387C5.12628 14.5911 5.66395 14.6574 6.21627 15.0087C6.75836 15.353 7.19519 16.2423 7.35598 16.7777C7.56185 17.4621 7.70429 18.1941 7.15011 18.9699C6.7558 19.5215 5.6047 19.8263 4.67481 19.1669C4.9232 19.5682 5.25895 19.8964 5.71089 19.9582C6.38194 20.0497 7.01883 19.9328 7.45729 19.4807C7.83162 19.0941 8.03005 18.2858 7.97777 17.4346L8.57005 17.3482L8.78382 18.8761L18.5889 17.6901L17.7888 9.85213ZM11.8235 5.70275C11.7961 5.76554 11.7531 5.80662 11.8177 6.01085L11.8217 6.02252L11.8319 6.0489L11.8588 6.11005C11.9753 6.34907 12.1031 6.57455 12.3166 6.68962C12.3719 6.68028 12.429 6.67398 12.4883 6.67095C12.6888 6.66208 12.8155 6.69405 12.8959 6.73747C12.9031 6.69732 12.9047 6.6385 12.9003 6.55191C12.8847 6.24917 12.96 5.73426 12.3807 5.46327C12.1621 5.36127 11.8554 5.39278 11.7531 5.51999C11.7717 5.52232 11.7884 5.52629 11.8015 5.53072C11.956 5.58511 11.8512 5.63856 11.8235 5.70275ZM13.447 8.52751C13.371 8.4855 13.016 8.50207 12.7664 8.53195C12.291 8.5882 11.7778 8.75393 11.6653 8.84216C11.4608 9.00088 11.5538 9.2777 11.7048 9.39138C12.1284 9.70928 12.4997 9.92239 12.8917 9.87057C13.1324 9.83883 13.3445 9.45603 13.4949 9.10871C13.5978 8.86947 13.5978 8.61131 13.447 8.52751ZM9.23808 6.07761C9.37215 5.9497 8.57028 5.78164 7.94803 6.20786C7.48912 6.52226 7.47448 7.19636 7.91387 7.57846C7.95779 7.61627 7.99404 7.64311 8.02796 7.66505C8.15622 7.60437 8.30238 7.54298 8.4706 7.48813C8.75478 7.39546 8.99108 7.34761 9.18533 7.32217C9.27828 7.21783 9.38632 7.03414 9.35937 6.70152C9.32266 6.25034 8.98225 6.32199 9.23808 6.07761Z"
fill={color}
/>
</svg>
);
};

export default Datadog;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const DataStoreComponentMap: IDataStorePluginMap = {
[SupportedDataStores.ElasticApm]: ElasticSearch,
[SupportedDataStores.OtelCollector]: OpenTelemetryCollector,
[SupportedDataStores.Lightstep]: OpenTelemetryCollector,
[SupportedDataStores.Datadog]: OpenTelemetryCollector,
[SupportedDataStores.NewRelic]: OpenTelemetryCollector,
};

Expand Down
39 changes: 38 additions & 1 deletion web/src/constants/CollectorConfig.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exporters:
otlp/ls:
endpoint: ingest.lightstep.com:443
headers:
"lightstep-access-token": "<lightstep_access_token>" # Send traces to Lightstep. Read more in docs here: https://docs.lightstep.com/otel/otel-quick-start
"lightstep-access-token": "<lightstep_access_token>" # Send traces to Lightstep. Read more in docs here: https://docs.lightstep.com/otel/otel-quick-start

service:
pipelines:
Expand Down Expand Up @@ -98,7 +98,44 @@ service:
exporters: [logging, otlp/nr]
`;

export const Datadog = `receivers:
otlp:
protocols:
http:
grpc:

processors:
batch:
send_batch_max_size: 100
send_batch_size: 10
timeout: 10s

exporters:
# OTLP for Tracetest
otlp/tt:
endpoint: tracetest:21321 # Send traces to Tracetest. Read more in docs here: https://docs.tracetest.io/configuration/connecting-to-data-stores/opentelemetry-collector
tls:
insecure: true
# Datadog exporter
datadog:
api:
site: datadoghq.com
key: <datadog_API_key> # Add here you API key for Datadog
# Read more in docs here: https://docs.datadoghq.com/opentelemetry/otel_collector_datadog_exporter
service:
pipelines:
traces/tt:
receivers: [otlp]
processors: [batch]
exporters: [otlp/tt]
traces/dd:
receivers: [otlp]
processors: [batch]
exporters: [datadog]
`;

export const CollectorConfigMap = {
[SupportedDataStores.Datadog]: Datadog,
[SupportedDataStores.Lightstep]: Lightstep,
[SupportedDataStores.NewRelic]: NewRelic,
[SupportedDataStores.OtelCollector]: OtelCollector,
Expand Down
4 changes: 4 additions & 0 deletions web/src/constants/DataStore.constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const SupportedDataStoresToName = {
[SupportedDataStores.ElasticApm]: 'Elastic APM',
[SupportedDataStores.NewRelic]: 'New Relic',
[SupportedDataStores.Lightstep]: 'Lightstep',
[SupportedDataStores.Datadog]: 'Datadog',
} as const;

export const SupportedDataStoresToDocsLink = {
Expand All @@ -17,6 +18,7 @@ export const SupportedDataStoresToDocsLink = {
[SupportedDataStores.ElasticApm]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/elasticapm',
[SupportedDataStores.NewRelic]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/new-relic',
[SupportedDataStores.Lightstep]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/lightstep',
[SupportedDataStores.Datadog]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/datadog',
[SupportedDataStores.SignalFX]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/signalfx',
[SupportedDataStores.TEMPO]: 'https://docs.tracetest.io/configuration/connecting-to-data-stores/tempo',
[SupportedDataStores.OtelCollector]:
Expand All @@ -38,10 +40,12 @@ export const SupportedDataStoresToExplanation: Record<string, React.ReactElement
[SupportedDataStores.OtelCollector]: collectorExplanation,
[SupportedDataStores.NewRelic]: collectorExplanation,
[SupportedDataStores.Lightstep]: collectorExplanation,
[SupportedDataStores.Datadog]: collectorExplanation,
};

export const NoTestConnectionDataStoreList = [
SupportedDataStores.OtelCollector,
SupportedDataStores.Lightstep,
SupportedDataStores.Datadog,
SupportedDataStores.NewRelic,
];
1 change: 1 addition & 0 deletions web/src/models/DataStore.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type DataStore = Model<
otlp?: {};
newRelic?: {};
lightstep?: {};
datadog?: {};
}
>;

Expand Down
1 change: 1 addition & 0 deletions web/src/services/DataStore.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const dataStoreServiceMap = {
[SupportedDataStores.OtelCollector]: OtelCollectorService,
[SupportedDataStores.NewRelic]: OtelCollectorService,
[SupportedDataStores.Lightstep]: OtelCollectorService,
[SupportedDataStores.Datadog]: OtelCollectorService,
} as const;

const DataStoreService = (): IDataStoreService => ({
Expand Down
7 changes: 5 additions & 2 deletions web/src/types/Config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum SupportedDataStores {
OpenSearch = 'openSearch',
ElasticApm = 'elasticApm',
SignalFX = 'signalFx',
Datadog = 'datadog',
}

export enum SupportedClientTypes {
Expand All @@ -29,7 +30,8 @@ export enum SupportedClientTypes {
export type TCollectorDataStores =
| SupportedDataStores.NewRelic
| SupportedDataStores.OtelCollector
| SupportedDataStores.Lightstep;
| SupportedDataStores.Lightstep
| SupportedDataStores.Datadog;

export type TRawGRPCClientSettings = TDataStoreSchemas['GRPCClientSettings'];
export type TRawElasticSearch = TDataStoreSchemas['ElasticSearch'];
Expand Down Expand Up @@ -80,7 +82,8 @@ type IDataStore = TRawDataStore & {
otlp?: {};
lightstep?: {};
newRelic?: {};
};
datadog?: {};
}

export type TDraftDataStore = {
dataStore?: IDataStore;
Expand Down
3 changes: 2 additions & 1 deletion web/src/types/Generated.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ export interface external {
| "otlp"
| "elasticApm"
| "newRelic"
| "lightstep";
| "lightstep"
| "datadog";
/** @enum {string} */
SupportedClients: "http" | "grpc";
};
Expand Down