-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for streaming metrics (#2)
- Loading branch information
Showing
9 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# 0.1.0 (Jun 04, 2024) | ||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lock-providers: | ||
terraform providers lock -platform=linux_amd64 -platform=linux_arm64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=windows_amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# aws-datadog-fargate | ||
Capability to report logs and metrics for an AWS fargate service to Datadog | ||
# Datadog Logs/Metrics for ECS/Fargate | ||
|
||
This capability sends application logs and metrics to Datadog for ECS (Fargate-based or EC2-based). | ||
|
||
## Logs | ||
|
||
Application logs are configured to send to Datadog in near real-time. (<1 min latency) | ||
These logs are tagged with `stack`, `block`, and `env`. | ||
|
||
The application logs are immediately sent to Cloudwatch and transmitted to Datadog via Kinesis Firehose. | ||
|
||
## Metrics | ||
|
||
The Datadog agent is added to your application as a sidecar container. | ||
This agent collects metrics from AWS and custom metrics from your application and sends them to Datadog in near real-time. | ||
|
||
### OpenTelemetry | ||
|
||
The Datadog agent is configured as an OpenTelemetry agent with a gRPC listener on port 4317 and HTTP listener on port 4318. | ||
This module automatically injects `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable into the app. | ||
This endpoint refers to the HTTP listener. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
locals { | ||
sidecar_name = "datadog-agent" | ||
agent_sidecar = { | ||
name = "datadog-agent" | ||
image = "public.ecr.aws/datadog/agent:latest" | ||
essential = true | ||
portMappings = jsonencode([ | ||
{ protocol = "tcp", containerPort = 4317 }, | ||
{ protocol = "tcp", containerPort = 4318 }, | ||
{ protocol = "tcp", containerPort = 8126 }, | ||
]) | ||
environment = jsonencode([ | ||
{ name = "ECS_FARGATE", value = "true" }, | ||
{ name = "DD_APM_ENABLED", value = "true" }, | ||
{ name = "DD_SITE", value = "datadoghq.com" }, | ||
{ name = "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT", value = "0.0.0.0:4317" }, | ||
{ name = "DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT", value = "0.0.0.0:4318" } | ||
]) | ||
secrets = jsonencode([{ name = "DD_API_KEY", valueFrom = local.api_key_secret_id }]) | ||
} | ||
} | ||
|
||
resource "aws_iam_role_policy_attachment" "execution-datadog" { | ||
role = local.execution_role_name | ||
policy_arn = aws_iam_policy.datadog.arn | ||
} | ||
|
||
resource "aws_iam_policy" "datadog" { | ||
name = "${local.resource_name}-datadog" | ||
policy = data.aws_iam_policy_document.datadog.json | ||
} | ||
|
||
data "aws_iam_policy_document" "datadog" { | ||
statement { | ||
sid = "AllowReadDatadogApiKey" | ||
effect = "Allow" | ||
resources = [local.api_key_secret_id] | ||
|
||
actions = [ | ||
"secretsmanager:GetSecretValue", | ||
"kms:Decrypt" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
output "noop" { | ||
value = [] | ||
output "env" { | ||
value = [ | ||
{ | ||
name = "OTEL_EXPORTER_OTLP_ENDPOINT" | ||
value = "http://localhost:4318" | ||
} | ||
] | ||
} | ||
|
||
output "sidecars" { | ||
value = [ | ||
local.agent_sidecar | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters