Change runner to connect to otel collector on pre-job#781
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an otel-collector-endpoint charm config to enable runner-side OpenTelemetry host-metrics collection by generating an OTel Collector config during the runner pre-job phase and propagating this setting through charm state into runner VM provisioning.
Changes:
- Introduces
otel-collector-endpointconfig and threads it throughCharmState→ApplicationConfiguration→ runner cloud-init templating. - Generates an OTel Collector YAML config in the runner pre-job script and attempts to enable/start the
opentelemetry-collectorsnap. - Adds unit/integration tests for parsing/propagation and verifies the config file is written on the runner.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| charmcraft.yaml | Adds the new charm config option for OTel collector endpoint. |
| src/charm_state.py | Parses/validates the endpoint and persists it in stored charm state. |
| src/factories.py | Propagates OTel config into the application/service configuration model. |
| github-runner-manager/src/github_runner_manager/configuration/base.py | Adds OtelCollectorConfig and wires it into SupportServiceConfig. |
| github-runner-manager/src/github_runner_manager/openstack_cloud/openstack_runner_manager.py | Passes endpoint into Jinja context for pre-job generation. |
| github-runner-manager/src/github_runner_manager/templates/pre-job.j2 | Writes OTel Collector config and enables/starts the collector service. |
| tests/unit/conftest.py | Extends fixture to include otel_collector_config. |
| tests/unit/test_factories.py | Unit test that OTel config is propagated into service config. |
| tests/unit/test_charm_state.py | Unit tests for endpoint parsing/validation helper. |
| tests/integration/test_charm_runner.py | Integration test verifying config file content is written on the runner VM. |
florentianayuwono
approved these changes
Apr 22, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/canonical/github-runner-operator/sessions/a046e899-791c-40b0-95f3-ccfef17c9536 Co-authored-by: yhaliaw <43424755+yhaliaw@users.noreply.github.com>
cbartz
added a commit
to canonical/github-runner-operators
that referenced
this pull request
Apr 24, 2026
Replace github_job_id with github_job and instance with github_runner to match the actual attribute labels set by the pre-job OTel config (see canonical/github-runner-operator#781). Add github_repository and github_workflow template variables so the dashboard can be filtered the same way as the existing PS6 hostmetrics dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applicable spec:
Overview
This pull request adds support for configuring and enabling OpenTelemetry (OTel) metrics collection for GitHub Runner Manager deployments. It introduces a new configuration option for specifying an OTel collector endpoint, ensures this configuration is validated and propagated through the system, and updates the runner setup to generate and apply the necessary OTel configuration at runtime. Comprehensive tests are included to validate the new logic.
OpenTelemetry Collector Integration:
otel-collector-endpointconfiguration option tocharmcraft.yamland integrated it throughout the charm state and service configuration, allowing users to specify an OTel collector endpoint in the formathost:port. [1] [2] [3] [4] [5]OtelCollectorConfigmodel to validate and store OTel collector configuration, with robust parsing and validation logic to ensure only validhost:portvalues are accepted. [1] [2] [3] [4]Runner Setup and Cloud-Init Updates:
Testing and Validation:
Rationale
These changes allow users to easily enable and configure OpenTelemetry metrics collection for their self-hosted runners, improving observability and integration with monitoring systems.
Checklist
urgent,trivial,complex).github-runner-manager/pyproject.toml.