diff --git a/docs/changelog.md b/docs/changelog.md index 3e5eac712..2bc6cf0ac 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,11 @@ This changelog documents user-relevant changes to the GitHub runner charm. +## 2026-05-20 + +- Enhanced OpenTelemetry Collector configuration in the pre-job script to expose local OTLP (gRPC/HTTP) and Loki endpoints for workflow to push observability data. +- Enable system.cpu.logical.count and system.cpu.physical.count metrics. + ## 2026-04-24 - Exposed the configured GitHub path (org or repository) as a Terraform module output, allowing consumers to make decisions based on which path a runner is registered to. diff --git a/github-runner-manager/src/github_runner_manager/templates/pre-job.j2 b/github-runner-manager/src/github_runner_manager/templates/pre-job.j2 index c7d5f9b9b..3e6d307e6 100644 --- a/github-runner-manager/src/github_runner_manager/templates/pre-job.j2 +++ b/github-runner-manager/src/github_runner_manager/templates/pre-job.j2 @@ -144,38 +144,127 @@ receivers: collection_interval: 10s scrapers: cpu: + metrics: + system.cpu.logical.count: + enabled: true + system.cpu.physical.count: + enabled: true memory: disk: filesystem: network: load: + otlp: + protocols: + grpc: + endpoint: 0.0.0.0:44317 + http: + endpoint: 0.0.0.0:44318 + loki: + protocols: + http: + endpoint: 0.0.0.0:43100 + use_incoming_timestamp: true processors: - attributes/github_labels: + attributes/self_hosted_runner_github_labels: actions: - - key: github_runner + - key: service.name action: upsert - value: "$RUNNER_NAME" - - key: github_workflow + value: "self-hosted-runner" + - key: github.repository action: upsert - value: "$GITHUB_WORKFLOW" - - key: github_job + value: "$GITHUB_REPOSITORY" + - key: github.runner action: upsert - value: "$GITHUB_JOB" - - key: github_repository + value: "$RUNNER_NAME" + - key: github.workflow action: upsert - value: "$GITHUB_REPOSITORY" + value: "$GITHUB_WORKFLOW" + - key: github.job + action: upsert + value: "$GITHUB_JOB" + - key: github.run.id + action: upsert + value: "$GITHUB_RUN_ID" + - key: github.run.attempt + action: upsert + value: "$GITHUB_RUN_ATTEMPT" + - key: host.arch + action: upsert + value: "$(uname -m)" + resource/self_hosted_runner_github_labels: + attributes: + - key: service.name + action: upsert + value: "self-hosted-runner" + - key: github.repository + action: upsert + value: "$GITHUB_REPOSITORY" + - key: github.runner + action: upsert + value: "$RUNNER_NAME" + - key: github.workflow + action: upsert + value: "$GITHUB_WORKFLOW" + - key: github.job + action: upsert + value: "$GITHUB_JOB" + - key: github.run.id + action: upsert + value: "$GITHUB_RUN_ID" + - key: github.run.attempt + action: upsert + value: "$GITHUB_RUN_ATTEMPT" + - key: host.arch + action: upsert + value: "$(uname -m)" + transform/self_hosted_runner_loki_labels: + log_statements: + - context: resource + statements: + - > + set(resource.attributes["loki.resource.labels"], + Concat([resource.attributes["loki.resource.labels"], + ", service.name, github.repository, github.runner, github.workflow, github.job, github.run.id, github.run.attempt, host.arch"], "")) + where resource.attributes["loki.resource.labels"] != nil + - > + set(resource.attributes["loki.resource.labels"], + "service.name, github.repository, github.runner, github.workflow, github.job, github.run.id, github.run.attempt, host.arch") + where resource.attributes["loki.resource.labels"] == nil batch: exporters: - otlp/mimir: - endpoint: {{ otel_collector_endpoint }} + otlp/self_hosted_runner: + endpoint: "$ACTION_OTEL_EXPORTER_OTLP_ENDPOINT" tls: insecure: true service: pipelines: metrics: receivers: [hostmetrics] - processors: [attributes/github_labels, batch] - exporters: [otlp/mimir] + processors: [attributes/self_hosted_runner_github_labels, batch] + exporters: [otlp/self_hosted_runner] + metrics/otlp: + receivers: [otlp] + processors: [attributes/self_hosted_runner_github_labels, batch] + exporters: [otlp/self_hosted_runner] + logs/otlp: + receivers: [otlp] + processors: + - resource/self_hosted_runner_github_labels + - transform/self_hosted_runner_loki_labels + - batch + exporters: [otlp/self_hosted_runner] + logs/loki: + receivers: [loki] + processors: + - resource/self_hosted_runner_github_labels + - transform/self_hosted_runner_loki_labels + - batch + exporters: [otlp/self_hosted_runner] + traces: + receivers: [otlp] + processors: [resource/self_hosted_runner_github_labels, batch] + exporters: [otlp/self_hosted_runner] EOF /usr/bin/sudo /usr/bin/snap enable opentelemetry-collector