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

[otel] Add basic configuration samples #5002

Merged
merged 18 commits into from
Jun 28, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ shared:
'data/{{.BeatName}}-{{ commit_short }}/otelcol':
source: '{{ repo.RootDir }}/dev-tools/packaging/files/linux/otelcol.sh'
mode: 0755
'otel_samples':
source: '{{ repo.RootDir }}/internal/pkg/otel/samples/linux/'
mode: 0755

- &agent_binary_common_files
LICENSE.txt:
Expand Down Expand Up @@ -160,6 +163,9 @@ shared:
'data/{{.BeatName}}-{{ commit_short }}/otelcol':
source: '{{ repo.RootDir }}/dev-tools/packaging/files/darwin/otelcol.sh'
mode: 0755
'otel_samples':
source: '{{ repo.RootDir }}/internal/pkg/otel/samples/darwin/'
mode: 0755
<<: *agent_darwin_app_bundle_files
<<: *agent_binary_common_files

Expand Down Expand Up @@ -201,6 +207,10 @@ shared:
'data/{{.BeatName}}-{{ commit_short }}/otelcol.ps1':
source: '{{ repo.RootDir }}/dev-tools/packaging/files/windows/otelcol.ps1'
mode: 0755
# windows not supported yet
# 'otel_samples':
# source: '{{ repo.RootDir }}/internal/pkg/otel/samples/windows/'
# mode: 0755

- &agent_docker_spec
<<: *agent_binary_spec
Expand Down
73 changes: 73 additions & 0 deletions internal/pkg/otel/samples/darwin/logs_hostmetrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
receivers:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same file as the above logs_host_metrics.yml, right? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i wanted to do resource enrichment but i will take it out

# Receiver for platform specific log files
filelog/platformlogs:
include: [ /var/log/*.log ]
# start_at: beginning

# Receiver for CPU, Disk, Memory, and Filesystem metrics
hostmetrics/system:
collection_interval: 30s
scrapers:
disk:
filesystem:
cpu:
memory:

processors:
elasticinframetrics:
resourcedetection:
detectors: ["system"]
system:
hostname_sources: ["os"]
resource_attributes:
host.name:
enabled: true
host.id:
enabled: false
host.arch:
enabled: true
host.ip:
enabled: true
host.mac:
enabled: true
host.cpu.vendor.id:
enabled: true
host.cpu.family:
enabled: true
host.cpu.model.id:
enabled: true
host.cpu.model.name:
enabled: true
host.cpu.stepping:
enabled: true
host.cpu.cache.l2.size:
enabled: true
os.description:
enabled: true
os.type:
enabled: true

exporters:
elasticsearch:
endpoints: ["${env:ELASTIC_ENDPOINT}"]
api_key: ${env:ELASTIC_API_KEY}
mapping:
mode: ecs
logs_dynamic_index:
enabled: true
metrics_dynamic_index:
enabled: true
traces_dynamic_index:
enabled: true

service:
pipelines:
metrics/hostmetrics:
receivers: [hostmetrics/system]
processors: [elasticinframetrics, resourcedetection]
exporters: [elasticsearch]

logs/platformlogs:
receivers: [filelog/platformlogs]
processors: [resourcedetection]
exporters: [elasticsearch]
102 changes: 102 additions & 0 deletions internal/pkg/otel/samples/darwin/logs_metrics_traces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
receivers:
Copy link
Contributor

Choose a reason for hiding this comment

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

This file has everything that the above logs_host_metrics.yml has, and then some more. Is it valuable to have both?

Choose a reason for hiding this comment

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

adding traces requires adding a listening port so i think it makes sense for it to be optional


# Receiver for platform specific log files
filelog/platformlogs:
include: [ /var/log/*.log ]
# start_at: beginning

# Receiver for CPU, Disk, Memory, and Filesystem metrics
hostmetrics/system:
collection_interval: 30s
scrapers:
disk:
filesystem:
cpu:
memory:

# Receiver for logs, traces, and metrics from SDKs
otlp/fromsdk:
protocols:
grpc:
http:

processors:
elasticinframetrics:
resourcedetection:
detectors: ["system"]
system:
hostname_sources: ["os"]
resource_attributes:
host.name:
enabled: true
host.id:
enabled: false
host.arch:
enabled: true
host.ip:
enabled: true
host.mac:
enabled: true
host.cpu.vendor.id:
enabled: true
host.cpu.family:
enabled: true
host.cpu.model.id:
enabled: true
host.cpu.model.name:
enabled: true
host.cpu.stepping:
enabled: true
host.cpu.cache.l2.size:
enabled: true
os.description:
enabled: true
os.type:
enabled: true

exporters:

otlp/apm:
endpoint: "${env:APM_ENDPOINT}"
headers:
# Elastic APM Server secret token or API key
Authorization: "Bearer ${env:APM_SECRET_KEY}"

elasticsearch:
endpoints: ["${env:ELASTIC_ENDPOINT}"]
api_key: ${env:ELASTIC_API_KEY}
mapping:
mode: ecs
michalpristas marked this conversation as resolved.
Show resolved Hide resolved
logs_dynamic_index:
enabled: true
metrics_dynamic_index:
enabled: true
traces_dynamic_index:
enabled: true

service:
pipelines:
traces/fromsdk:
receivers: [otlp/fromsdk]
processors: []
exporters: [otlp/apm]

metrics/fromsdk:
receivers: [otlp/fromsdk]
processors: []
exporters: [otlp/apm]

metrics/hostmetrics:
receivers: [hostmetrics/system]
processors: [elasticinframetrics, resourcedetection]
exporters: [elasticsearch]

logs/fromsdk:
receivers: [otlp/fromsdk]
processors: []
exporters: [otlp/apm]

logs/platformlogs:
receivers: [filelog/platformlogs]
processors: [resourcedetection]
exporters: [elasticsearch]
66 changes: 66 additions & 0 deletions internal/pkg/otel/samples/darwin/platformlogs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
receivers:
# Receiver for platform specific log files
filelog/platformlogs:
include: [ /var/log/*.log ]
# start_at: beginning


processors:
resourcedetection:
detectors: ["system"]
system:
hostname_sources: ["os"]
resource_attributes:
host.name:
enabled: true
host.id:
enabled: false
host.arch:
enabled: true
host.ip:
enabled: true
host.mac:
enabled: true
host.cpu.vendor.id:
enabled: true
host.cpu.family:
enabled: true
host.cpu.model.id:
enabled: true
host.cpu.model.name:
enabled: true
host.cpu.stepping:
enabled: true
host.cpu.cache.l2.size:
enabled: true
os.description:
enabled: true
os.type:
enabled: true

exporters:
# Exporter to print the first 5 logs/metrics and then every 1000th
debug:
verbosity: detailed
sampling_initial: 5
sampling_thereafter: 1000

# Exporter to send logs and metrics to Elasticsearch
elasticsearch:
endpoints: ["${env:ELASTIC_ENDPOINT}"]
api_key: ${env:ELASTIC_API_KEY}
mapping:
mode: ecs
logs_dynamic_index:
enabled: true
metrics_dynamic_index:
enabled: true
traces_dynamic_index:
enabled: true

service:
pipelines:
logs/platformlogs:
receivers: [filelog/platformlogs]
processors: [resourcedetection]
exporters: [debug, elasticsearch]
78 changes: 78 additions & 0 deletions internal/pkg/otel/samples/darwin/platformlogs_hostmetrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
receivers:
Copy link
Contributor

Choose a reason for hiding this comment

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

Another version of the same file as logs_host_metrics.yml? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the first one

# Receiver for platform specific log files
filelog/platformlogs:
include: [ /var/log/*.log ]
# start_at: beginning

# Receiver for CPU, Disk, Memory, and Filesystem metrics
hostmetrics/system:
collection_interval: 30s
scrapers:
disk:
filesystem:
cpu:
memory:

processors:
resourcedetection:
detectors: ["system"]
system:
hostname_sources: ["os"]
resource_attributes:
host.name:
enabled: true
host.id:
enabled: false
host.arch:
enabled: true
host.ip:
enabled: true
host.mac:
enabled: true
host.cpu.vendor.id:
enabled: true
host.cpu.family:
enabled: true
host.cpu.model.id:
enabled: true
host.cpu.model.name:
enabled: true
host.cpu.stepping:
enabled: true
host.cpu.cache.l2.size:
enabled: true
os.description:
enabled: true
os.type:
enabled: true

exporters:
# Exporter to print the first 5 logs/metrics and then every 1000th
debug:
verbosity: detailed
sampling_initial: 5
sampling_thereafter: 1000

# Exporter to send logs and metrics to Elasticsearch
elasticsearch:
endpoints: ["${env:ELASTIC_ENDPOINT}"]
api_key: ${env:ELASTIC_API_KEY}
mapping:
mode: ecs
logs_dynamic_index:
enabled: true
metrics_dynamic_index:
enabled: true
traces_dynamic_index:
enabled: true

service:
pipelines:
metrics/hostmetrics:
receivers: [hostmetrics/system]
processors: [resourcedetection]
exporters: [debug, elasticsearch]
logs/platformlogs:
receivers: [filelog/platformlogs]
processors: [resourcedetection]
exporters: [debug, elasticsearch]
Loading