Skip to content

Commit

Permalink
[OTLP] add entity processor to the otlp metrics and logs pipeline (#1504
Browse files Browse the repository at this point in the history
)
  • Loading branch information
duhminick authored Jan 30, 2025
1 parent 8d8b261 commit 77aa32a
Show file tree
Hide file tree
Showing 11 changed files with 558 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/influxdata/telegraf => github.com/aws/telegraf v0.10.2-0.2025
// to be all replaced since there are some changes that will always be from upstream
replace (
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241216205413-8e059f1441db
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241216205413-8e059f1441db
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20250116001040-07637c7e4577
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241216205413-8e059f1441db
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483 h1:J8HaD+Zpfi1gcel3HCKpoHHEsrc
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241216205413-8e059f1441db h1:M3mCeHB5pVhpGdFkx9qJlBtUURxkg6fEQUNNJdYLk3I=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241216205413-8e059f1441db/go.mod h1:f9JwM/LQdKH8ZbYoH9TO35rmjM6WoTNlhWtYJ3YZucc=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241216205413-8e059f1441db h1:N0An6pXgyPzUIwzqyiO2u6U2SwedbIR25ntcf4KoU3g=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241216205413-8e059f1441db/go.mod h1:LPWBVdTSNbZkk80v6aCUthS59cnR4VauVRdAIE3ifaY=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20250116001040-07637c7e4577 h1:+OuAFQweLKuerVx77Z4zACf/qFITKdJWXO55K3Y6vAY=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20250116001040-07637c7e4577/go.mod h1:LPWBVdTSNbZkk80v6aCUthS59cnR4VauVRdAIE3ifaY=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241216205413-8e059f1441db h1:L+xPXimFZAtTgougLt59HvivqCyBgh066rv/XbenHUM=
github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241216205413-8e059f1441db/go.mod h1:GNeNylfr5KMt55XowzSdgbP7z8CkIAfIHtWSd+xxtws=
github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241216205413-8e059f1441db h1:rdQRfKoW60Aomz9Tc8fF0Ld5x/Q96vNz8idPQF/qG9Q=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[agent]
collection_jitter = "0s"
debug = false
flush_interval = "1s"
flush_jitter = "0s"
hostname = "host_name_from_env"
interval = "60s"
logfile = ""
logtarget = "lumberjack"
metric_batch_size = 1000
metric_buffer_limit = 10000
omit_hostname = false
precision = ""
quiet = false
round_interval = false

[inputs]

[outputs]

[[outputs.cloudwatchlogs]]
force_flush_interval = "30s"
log_stream_name = "host_name_from_env"
region = "us-west-2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"logs": {
"force_flush_interval": 30,
"metrics_collected": {
"otlp": {
"grpc_endpoint": "0.0.0.0:1234",
"http_endpoint": "0.0.0.0:2345",
"tls": {
"cert_file": "/path/to/cert.pem",
"key_file": "/path/to/key.pem"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
exporters:
awsemf:
certificate_file_path: ""
detailed_metrics: false
dimension_rollup_option: NoDimensionRollup
disable_metric_extraction: false
eks_fargate_container_insights_enabled: false
endpoint: ""
enhanced_container_insights: false
imds_retries: 1
local_mode: false
log_group_name: /aws/cwagent
log_retention: 0
log_stream_name: ""
max_retries: 2
middleware: agenthealth/logs
namespace: CWAgent
no_verify_ssl: false
num_workers: 8
output_destination: cloudwatch
profile: ""
proxy_address: ""
region: us-west-2
request_timeout_seconds: 30
resource_arn: ""
resource_to_telemetry_conversion:
enabled: true
retain_initial_value_of_delta_metric: false
role_arn: ""
version: "0"
extensions:
agenthealth/logs:
is_usage_data_enabled: true
stats:
operations:
- PutLogEvents
usage_flags:
mode: K8E
region_type: ACJ
agenthealth/statuscode:
is_status_code_enabled: true
is_usage_data_enabled: true
stats:
usage_flags:
mode: K8E
region_type: ACJ
entitystore:
kubernetes_mode: K8sEC2
mode: ec2
region: us-west-2
server:
listen_addr: :4311
tls_ca_path: /etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt
tls_cert_path: /etc/amazon-cloudwatch-observability-agent-server-cert/server.crt
tls_key_path: /etc/amazon-cloudwatch-observability-agent-server-cert/server.key
processors:
awsentity/service/otlp:
entity_type: Service
kubernetes_mode: K8sEC2
platform: ec2
batch/hostOtlpMetrics/cloudwatchlogs:
metadata_cardinality_limit: 1000
send_batch_max_size: 0
send_batch_size: 8192
timeout: 30s
cumulativetodelta/hostOtlpMetrics/cloudwatchlogs:
exclude:
match_type: ""
include:
match_type: ""
initial_value: 2
max_staleness: 0s
receivers:
otlp/metrics:
protocols:
grpc:
dialer:
timeout: 0s
endpoint: 0.0.0.0:1234
include_metadata: false
max_concurrent_streams: 0
max_recv_msg_size_mib: 0
read_buffer_size: 524288
tls:
ca_file: ""
cert_file: /path/to/cert.pem
client_ca_file: ""
client_ca_file_reload: false
include_system_ca_certs_pool: false
key_file: /path/to/key.pem
max_version: ""
min_version: ""
reload_interval: 0s
transport: tcp
write_buffer_size: 0
http:
endpoint: 0.0.0.0:2345
include_metadata: false
logs_url_path: /v1/logs
max_request_body_size: 0
metrics_url_path: /v1/metrics
tls:
ca_file: ""
cert_file: /path/to/cert.pem
client_ca_file: ""
client_ca_file_reload: false
include_system_ca_certs_pool: false
key_file: /path/to/key.pem
max_version: ""
min_version: ""
reload_interval: 0s
traces_url_path: /v1/traces
service:
extensions:
- agenthealth/logs
- agenthealth/statuscode
- entitystore
- server
pipelines:
metrics/hostOtlpMetrics/cloudwatchlogs:
exporters:
- awsemf
processors:
- awsentity/service/otlp
- cumulativetodelta/hostOtlpMetrics/cloudwatchlogs
- batch/hostOtlpMetrics/cloudwatchlogs
receivers:
- otlp/metrics
telemetry:
logs:
development: false
disable_caller: false
disable_stacktrace: false
encoding: console
level: info
sampling:
enabled: true
initial: 2
thereafter: 500
tick: 10s
metrics:
address: ""
level: None
traces: {}
21 changes: 21 additions & 0 deletions translator/tocwconfig/sampleConfig/otlp_metrics_eks_config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[agent]
collection_jitter = "0s"
debug = false
flush_interval = "1s"
flush_jitter = "0s"
hostname = ""
interval = "60s"
logfile = ""
logtarget = "lumberjack"
metric_batch_size = 1000
metric_buffer_limit = 10000
omit_hostname = false
precision = ""
quiet = false
round_interval = false

[inputs]

[outputs]

[[outputs.cloudwatch]]
20 changes: 20 additions & 0 deletions translator/tocwconfig/sampleConfig/otlp_metrics_eks_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"metrics": {
"append_dimensions": {
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
"ImageId": "${aws:ImageId}",
"InstanceId": "${aws:InstanceId}",
"InstanceType": "${aws:InstanceType}"
},
"metrics_collected": {
"otlp": {
"grpc_endpoint": "0.0.0.0:1234",
"http_endpoint": "0.0.0.0:2345",
"tls": {
"cert_file": "/path/to/cert.pem",
"key_file": "/path/to/key.pem"
}
}
}
}
}
129 changes: 129 additions & 0 deletions translator/tocwconfig/sampleConfig/otlp_metrics_eks_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
exporters:
awscloudwatch:
force_flush_interval: 1m0s
max_datums_per_call: 1000
max_values_per_datum: 150
middleware: agenthealth/metrics
namespace: CWAgent
region: us-west-2
resource_to_telemetry_conversion:
enabled: true
extensions:
agenthealth/metrics:
is_usage_data_enabled: true
stats:
operations:
- PutMetricData
usage_flags:
mode: K8E
region_type: ACJ
agenthealth/statuscode:
is_status_code_enabled: true
is_usage_data_enabled: true
stats:
usage_flags:
mode: K8E
region_type: ACJ
entitystore:
kubernetes_mode: K8sEC2
mode: ec2
region: us-west-2
server:
listen_addr: :4311
tls_ca_path: /etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt
tls_cert_path: /etc/amazon-cloudwatch-observability-agent-server-cert/server.crt
tls_key_path: /etc/amazon-cloudwatch-observability-agent-server-cert/server.key
processors:
awsentity/service/otlp:
entity_type: Service
kubernetes_mode: K8sEC2
platform: ec2
cumulativetodelta/hostOtlpMetrics:
exclude:
match_type: ""
include:
match_type: ""
initial_value: 2
max_staleness: 0s
ec2tagger:
ec2_instance_tag_keys:
- AutoScalingGroupName
ec2_metadata_tags:
- ImageId
- InstanceId
- InstanceType
imds_retries: 1
middleware: agenthealth/statuscode
refresh_interval_seconds: 0s
receivers:
otlp/metrics:
protocols:
grpc:
dialer:
timeout: 0s
endpoint: 0.0.0.0:1234
include_metadata: false
max_concurrent_streams: 0
max_recv_msg_size_mib: 0
read_buffer_size: 524288
tls:
ca_file: ""
cert_file: /path/to/cert.pem
client_ca_file: ""
client_ca_file_reload: false
include_system_ca_certs_pool: false
key_file: /path/to/key.pem
max_version: ""
min_version: ""
reload_interval: 0s
transport: tcp
write_buffer_size: 0
http:
endpoint: 0.0.0.0:2345
include_metadata: false
logs_url_path: /v1/logs
max_request_body_size: 0
metrics_url_path: /v1/metrics
tls:
ca_file: ""
cert_file: /path/to/cert.pem
client_ca_file: ""
client_ca_file_reload: false
include_system_ca_certs_pool: false
key_file: /path/to/key.pem
max_version: ""
min_version: ""
reload_interval: 0s
traces_url_path: /v1/traces
service:
extensions:
- agenthealth/metrics
- agenthealth/statuscode
- entitystore
- server
pipelines:
metrics/hostOtlpMetrics:
exporters:
- awscloudwatch
processors:
- awsentity/service/otlp
- cumulativetodelta/hostOtlpMetrics
- ec2tagger
receivers:
- otlp/metrics
telemetry:
logs:
development: false
disable_caller: false
disable_stacktrace: false
encoding: console
level: info
sampling:
enabled: true
initial: 2
thereafter: 500
tick: 10s
metrics:
address: ""
level: None
traces: {}
Loading

0 comments on commit 77aa32a

Please sign in to comment.