Skip to content

Commit

Permalink
feat(artillery): add support for Datadog tracing on Fargate (#2381)
Browse files Browse the repository at this point in the history
Datadog does not provide HTTP endpoints for OTel. Traces have to
be sent via Datadog Agent.

This change adds Datadog Agent as a sidecar with the configuration
needed to enables tracing.
  • Loading branch information
hassy authored Dec 20, 2023
1 parent f98bb48 commit 4ae406b
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions packages/artillery/lib/platform/aws-ecs/legacy/run-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ async function tryRunCluster(scriptPath, options, artilleryReporter) {

logProgress('Checking cluster...');
const clusterExists = await checkTargetCluster(context);

if (!clusterExists) {
if (typeof context.cliOptions.cluster === 'undefined') {
// User did not specify a cluster with --cluster, and ARTILLERY_CLUSTER_NAME
Expand Down Expand Up @@ -1096,6 +1097,54 @@ async function ensureTaskExists(context) {
mode: 'non-blocking'
}
}
},
{
name: 'datadog-agent',
image: 'public.ecr.aws/datadog/agent:7',
environment: [
{
name: 'DD_API_KEY',
value: ''
},
{
name: 'DD_OTLP_CONFIG_TRACES_ENABLED',
value: 'true'
},
{
name: 'DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT',
value: '0.0.0.0:4318'
},
{
name: 'DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GCPR_ENDPOINT',
value: '0.0.0.0:4317'
},
{
name: 'DD_APM_ENABLED',
value: 'true'
},
{
name: 'DD_APM_RECEIVER_PORT',
value: '8126'
},
{
name: 'DD_APM_TRACE_BUFFER',
value: '100'
},
{
name: 'DD_SITE',
value: 'datadoghq.com'
}
],
logConfiguration: {
logDriver: 'awslogs',
options: {
'awslogs-group': `${context.logGroupName}/${context.clusterName}`,
'awslogs-region': context.region,
'awslogs-stream-prefix': `artilleryio/${context.testId}`,
'awslogs-create-group': 'true',
mode: 'non-blocking'
}
}
}
],
executionRoleArn: context.taskRoleArn
Expand Down Expand Up @@ -1353,6 +1402,10 @@ async function generateTaskOverrides(context) {
value: '1'
}
]
},
{
name: 'datadog-agent',
environment: []
}
],
taskRoleArn: context.taskRoleArn
Expand All @@ -1374,13 +1427,17 @@ async function generateTaskOverrides(context) {
}
overrides.containerOverrides[0].environment =
overrides.containerOverrides[0].environment.concat(extraEnv);
overrides.containerOverrides[1].environment =
overrides.containerOverrides[1].environment.concat(extraEnv);
}

if (context.cliOptions.launchConfig) {
const lc = context.cliOptions.launchConfig;
if (lc.environment) {
overrides.containerOverrides[0].environment =
overrides.containerOverrides[0].environment.concat(lc.environment);
overrides.containerOverrides[1].environment =
overrides.containerOverrides[1].environment.concat(lc.environment);
}

//
Expand Down

0 comments on commit 4ae406b

Please sign in to comment.