Skip to content

Commit

Permalink
using env to pass secrets to OTEL collector
Browse files Browse the repository at this point in the history
  • Loading branch information
eedygreen committed Nov 14, 2024
1 parent 246ce64 commit 0e1ccd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /app
COPY otelcol-builder.yaml .
RUN <<-EOF
apk update && apk add git
go install go.opentelemetry.io/collector/cmd/builder@latest
go install go.opentelemetry.io/collector/cmd/builder@v0.112.0
builder --config=otelcol-builder.yaml
EOF

Expand Down
8 changes: 0 additions & 8 deletions otelcol-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ exporters:
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.112.0
- import: go.opentelemetry.io/collector/exporter/otlphttpexporter
gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.112.0
- import: go.opentelemetry.io/collector/exporter/otlpexporter
gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/lokiexporter
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/lokiexporter v0.112.0
- import: go.opentelemetry.io/collector/exporter/debugexporter
gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.112.0

Expand All @@ -30,10 +26,6 @@ receivers:
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/otlpjsonfilereceiver v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver v0.112.0
- import: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver
gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/filelogreceiver v0.112.0

extensions:
- import: go.opentelemetry.io/collector/extension/zpagesextension
Expand Down
46 changes: 5 additions & 41 deletions otelcol-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ extensions:
endpoint: 0.0.0.0:55679
basicauth/grafana_cloud:
client_auth:
username: "910451"
password: "glc_eyJvIjoiMTAyODc5MiIsIm4iOiJzdGFjay05MTA0NTEtb3RscC13cml0ZS1vdGxwIiwiayI6Imh0T1VDTXRNSjM0MngyRjA1UTFyajAyNyIsIm0iOnsiciI6InByb2QtdXMtd2VzdC0wIn19"
basicauth/otlp:
client_auth:
username: "868232"
password: "glc_eyJvIjoiMTAyODc5MiIsIm4iOiJzdGFjay05MTA0NTEtaGwtcmVhZC1vdGxwaHR0cGxva2kiLCJrIjoiMTc3RW9ZRHB4ZGhFQzBIV0w5NW8yMTk4IiwibSI6eyJyIjoicHJvZC11cy13ZXN0LTAifX0="
basicauth/prometheus:
client_auth:
username: "1535416"
password: "glc_eyJvIjoiMTAyODc5MiIsIm4iOiJzdGFjay05MTA0NTEtaG0td3JpdGUtcHJvbWV0aGV1cyIsImsiOiJSOHM1YmlySjRDMGFQdjE5NmN6MWo4WTYiLCJtIjp7InIiOiJwcm9kLXVzLXdlc3QtMCJ9fQ=="
username: "830567"
password: "${env:GRAFANA_CLOUD}"

connectors:
grafanacloud:
Expand Down Expand Up @@ -52,19 +44,7 @@ receivers:
system.network.connections:
enabled: true
process:
filelog:
include: ["/ecs/relayer-${env:SYG_RELAYER_ID}-${env:SYG_RELAYER_ENV}/*.log" ] #"/ecs/relayer-1-STAGE"
operators:
- type: json_parser
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%d %H:%M:%S'
otlpjsonfile:
include:
- "/var/log/*.log"
exclude:
- "/var/log/example.log"


processors:
batch:
timeout: 10s
Expand All @@ -89,16 +69,8 @@ processors:
exporters:
debug:
verbosity: detailed
# datadog:
# retry_on_failure:
# enabled: true
# api:
# site: 'datadoghq.com'
# key: 'eb7c2acc9758f779ac7a65eaecb9b8b5'
otlphttp/grafana_cloud:
traces_endpoint: https://otlp-gateway-prod-us-west-0.grafana.net/otlp/v1/traces #https://chainsafe.grafana.net/loki/api/v1/push
metrics_endpoint: https://otlp-gateway-prod-us-west-0.grafana.net/otlp/v1/metrics
logs_endpoint: https://logs-prod-021.grafana.net:3100/otlp
endpoint: https://otlp-gateway-prod-us-east-0.grafana.net/otlp
auth:
authenticator: basicauth/grafana_cloud
encoding: json
Expand All @@ -110,14 +82,6 @@ exporters:
# remote_write_queue:
# enabled: false // its sending emtrics, lets test the otlp/v1/metrics now along with logs

otlphttp/loki:
endpoint: https://logs-prod-021.grafana.net:3100/otlp/vi/logs # https://logs-prod-021.grafana.net:3100/otlp
auth:
authenticator: basicauth/otlp
# default_labels_enabled:
# exporter:
# job:

service:
extensions: [health_check, pprof, zpages, basicauth/grafana_cloud, basicauth/otlp, basicauth/prometheus]
pipelines:
Expand All @@ -128,7 +92,7 @@ service:
metrics:
receivers: [otlp, hostmetrics]
processors: [resourcedetection, batch]
exporters: [otlphttp/grafana_cloud, debug]
exporters: [otlphttp/grafana_cloud]
logs:
receivers: [otlp, filelog, otlpjsonfile]
processors: [batch]
Expand Down

0 comments on commit 0e1ccd4

Please sign in to comment.