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

[opentelemetry-collector] Support automated collector configuration reloading #1219

Closed
chunter0 opened this issue Jun 7, 2024 · 1 comment · Fixed by #1221
Closed

[opentelemetry-collector] Support automated collector configuration reloading #1219

chunter0 opened this issue Jun 7, 2024 · 1 comment · Fixed by #1221

Comments

@chunter0
Copy link
Contributor

chunter0 commented Jun 7, 2024

Now that collector supports reloading configuration when a SIGHUP is received, can we expose shareProcessNamespace field on Deployment/Daemonset templates. Adding this will allow configuration reloads to be handled by automation from a sidecar through extraContainers field.

Quick Example

  1. Install with extraContainers
cat << EOF | helm upgrade -i collector open-telemetry/opentelemetry-collector -f -

mode: daemonset

image:
  repository: otel/opentelemetry-collector

extraContainers:
- name: reloader
  args:
  - sleep
  - infinity
  image: alpine:3.14
EOF

From the sidecar we don't see any processes for otel-collector

$ kc exec daemonsets/collector-opentelemetry-collector-agent -c reloader -- ps ax
PID   USER     TIME  COMMAND
    1 root      0:00 sleep infinity
   13 root      0:00 ps ax

After updating daemonset to include shareProcesses

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: collector-opentelemetry-collector-agent
spec:
  template:
    spec:
      shareProcessNamespace: true

We'll now see collector process from sidecar so we can automate detecting config changes

$ kc exec daemonsets/collector-opentelemetry-collector-agent -c reloader -- ps ax
PID   USER     TIME  COMMAND
    1 65535     0:00 /pause
    7 10001     0:00 /otelcol --config=/conf/relay.yaml
   43 root      0:00 sleep infinity
   64 root      0:00 ps ax

This is useful when exporters connection endpoints have changed and helm doesn't re-deploy for deployments/daemonsets since configuration is loaded via a file and not command-line args.

A local test using sidecar shows expected logs and the service is properly reloaded 👍

kc exec -n gloo-mesh daemonsets/collector-opentelemetry-collector-agent -c reloader -- sh -c 'kill -HUP $(pidof otelcol)'
2024-06-07T15:13:56.265Z        info    [email protected]/collector.go:323       Received signal from OS {"signal": "hangup"}
2024-06-07T15:13:56.265Z        warn    [email protected]/collector.go:232       Config updated, restart service
2024-06-07T15:13:56.265Z        info    [email protected]/service.go:243 Starting shutdown...
2024-06-07T15:13:56.265Z        info    healthcheck/handler.go:132      Health Check state change       {"kind": "extension", "name": "health_check", "status": "unavailable"}
2024-06-07T15:13:56.265Z        info    extensions/extensions.go:59     Stopping extensions...
2024-06-07T15:13:56.265Z        info    [email protected]/service.go:257 Shutdown complete.
2024-06-07T15:13:56.267Z        info    [email protected]/service.go:113 Setting up own telemetry...

@jaronoff97
Copy link
Contributor

We also added this capability into the operator, so I think it makes sense to enable it here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants