#file: noinspection YAMLSchemaValidation
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
resource:
attributes:
# This needs to be set in the container env vars
- key: deployment.environment.name
value: ${env:DEPLOYMENT_ENVIRONMENT}
action: upsert
# Without this, XRay will not correlate the logs from the correct log groups with traces
- key: aws.log.group.arns
action: delete
- key: aws.log.group.names
# This needs to be set in the container env vars
value: ${env:OTEL_LOG_GROUP_NAME}
action: upsert
- key: aws.log.stream.arns
action: delete
- key: aws.log.stream.names
# This needs to be set in the container env vars
value: ${env:OTEL_LOG_STREAM_NAME}
action: upsert
# Set FaaS semconv attributes for Lambda functions
# Many of these should be set by the .NET Lambda SDK, but we set them here to ensure they are always present
# List of default env vars in Lambda: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html
# Docs: https://opentelemetry.io/docs/specs/semconv/faas/faas-spans/
- key: cloud.provider
value: aws
action: upsert
- key: cloud.platform
value: aws_lambda
action: upsert
- key: cloud.account.id
# This needs to be set in the lambda function's env vars
value: ${env:AWS_ACCOUNT_ID}
action: upsert
- key: cloud.region
value: ${env:AWS_REGION}
action: upsert
- key: faas.name
value: ${env:AWS_LAMBDA_FUNCTION_NAME}
action: upsert
- key: faas.version
value: ${env:AWS_LAMBDA_FUNCTION_VERSION}
action: upsert
- key: faas.max_memory
value: ${env:AWS_LAMBDA_FUNCTION_MEMORY_SIZE}
action: upsert
batch:
decouple:
# Only keep relevant metrics
# Docs: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/filterprocessor
filter/metrics:
metrics:
include:
match_type: regexp
metric_names:
- '^http\.server\.request\.duration$'
- '^http\.server\.request\.body\.size$'
- '^http\.server\.response\.body\.size$'
- '^http\.server\.active_requests$'
- '^dotnet\.thread_pool\..*'
- '^client\..*'
# Normalize datapoint attributes so downstream exporters get controlled cardinality
# Docs: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor
transform/metrics:
error_mode: ignore
metric_statements:
- context: resource
statements:
# Keep only the deployment.environment.name and service.name resource attributes for metrics
# These will also become metric labels, so they contribute to cardinality as well
- keep_keys(resource.attributes, ["deployment.environment.name", "service.name"])
- context: datapoint
statements:
# HTTP Server - Latency per endpoint with status code breakdown
- keep_keys(datapoint.attributes, ["http.route", "http.response.status_code"]) where
metric.name == "http.server.request.duration" or
metric.name == "http.server.request.body.size" or
metric.name == "http.server.response.body.size"
# HTTP Server - Active requests per endpoint (real-time load)
- keep_keys(datapoint.attributes, ["http.route"]) where
metric.name == "http.server.active_requests"
# .NET Runtime - Thread metrics (aggregated across all tasks)
- keep_keys(datapoint.attributes, []) where
IsMatch(metric.name, "^dotnet\\.thread_pool\\..*")
# AWS SDK - Calls to Bedrock, DynamoDB, S3, etc. (aggregated)
- keep_keys(datapoint.attributes, ["rpc.service"]) where
IsMatch(metric.name, "^client\\..*")
exporters:
# Docs: https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlphttpexporter
otlp:
endpoint: ingress.${env:AWS_REGION}.aws.dash0.com:4317
headers:
Authorization: "Bearer ${env:OTLP_BEARER_TOKEN}"
service:
# Docs: https://opentelemetry.io/docs/collector/internal-telemetry/#activate-internal-telemetry-in-the-collector
telemetry:
logs:
# This needs to be set in the lambda's env vars
level: ${env:OPENTELEMETRY_COLLECTOR_TELEMETRY_LOG_LEVEL}
pipelines:
traces:
receivers: [ otlp ]
# batch SHOULD come after any data drops, including filtering and sampling
processors: [ resource, batch, decouple ]
exporters: [ otlp ]
metrics:
receivers: [ otlp ]
# batch SHOULD come after any data drops, including filtering and sampling
processors: [ resource, filter/metrics, transform/metrics, batch, decouple ]
exporters: [ otlp ]
logs:
receivers: [ otlp ]
# batch SHOULD come after any data drops, including filtering and sampling
processors: [ resource, batch, decouple ]
exporters: [ otlp ]3 views