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

Adapt charm to support COS integration #127

Merged
merged 65 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
adef63c
Add public interface
cbartz Sep 19, 2023
84ee906
Remove promtail prefix from fcts
cbartz Sep 19, 2023
9e39f04
Fix license header
cbartz Sep 20, 2023
2c01d35
Merge install and config into start
cbartz Sep 20, 2023
ba5144b
Add interface to log metrics
cbartz Sep 20, 2023
256a671
Add grafana_dashboard lib
cbartz Sep 20, 2023
88b7d0c
Move logging of event to metrics module
cbartz Sep 20, 2023
b9a5b94
Introduce charm state
cbartz Sep 20, 2023
b22f3cc
Update attrs doc
cbartz Sep 20, 2023
86f0321
Merge branch 'main' into ISD-1086
cbartz Sep 27, 2023
e93eb2d
Implement COS integration
cbartz Sep 19, 2023
c55128b
Remove grafana_dashboard
cbartz Sep 27, 2023
031d5a0
Change proxy server settings in test_charm
cbartz Sep 27, 2023
5297a0a
Ignore whitelist in pylintrc
cbartz Sep 27, 2023
1ec56ff
Add missing newlines
cbartz Sep 27, 2023
cf84c97
Exclude woke.yaml from license check
cbartz Sep 27, 2023
50dd756
Add final newline to .woke.yaml
cbartz Sep 28, 2023
2d9205b
Remove usage of requests.session in metrics
cbartz Sep 28, 2023
4126f30
Pin pydantic more specifically
cbartz Sep 28, 2023
17b783a
Fix type hint/doc string in ProxyConfig
cbartz Sep 28, 2023
03477d4
Pin pydantic
cbartz Oct 3, 2023
46345f4
Rename NotCompleteError
cbartz Oct 3, 2023
7c1075a
Remove hardcoding of promtail arch
cbartz Oct 3, 2023
f4757a9
Remove hardcoding of promtail arch
cbartz Oct 3, 2023
671bdea
Rename -> download_info
cbartz Oct 3, 2023
5c2a774
promtail.start -> promtail.setup
cbartz Oct 3, 2023
e7c5cc8
handle non-happy case first in metrics
cbartz Oct 3, 2023
95c9918
Remove group
cbartz Oct 3, 2023
e91481c
Adapt promtail.yaml.j2
cbartz Oct 3, 2023
c8ef938
Introduce constant in test_charm
cbartz Oct 3, 2023
c9fff7a
Move issue_metrics to RunnerManagerConfig
cbartz Oct 3, 2023
7c097a1
Fix promtail.service.j2
cbartz Oct 3, 2023
c53e9ee
Capture time only when needed
cbartz Oct 3, 2023
0bc0449
Narrow the exception catch
cbartz Oct 3, 2023
75c314e
Introduce constants in Promtail
cbartz Oct 3, 2023
6a772e9
Retry Promtail health check and raise error
cbartz Oct 3, 2023
01d382d
Use Path.write_bytes in promtail
cbartz Oct 3, 2023
27c6aa2
set unit status to Blocked for unhealthy promtail
cbartz Oct 3, 2023
d25a905
Fix integration test
cbartz Oct 3, 2023
470704e
Lint
cbartz Oct 3, 2023
5f34add
Catch RequestException
cbartz Oct 5, 2023
ce5beac
Drop Promtail and call Loki directly
cbartz Oct 5, 2023
0df1c49
Add unit test for charm state
cbartz Oct 5, 2023
0fa5da1
Switch to cos_agent integration
cbartz Oct 5, 2023
3f92a23
Adapt integration test
cbartz Oct 5, 2023
8e580f1
Fix integration test
cbartz Oct 5, 2023
11640bd
Simplify integration test
cbartz Oct 5, 2023
b0ffa24
Fix issue_event
cbartz Oct 6, 2023
0c76856
Add code to set up logrotate
cbartz Oct 6, 2023
87fc8c6
Update grafana dashboard
cbartz Oct 6, 2023
e524665
Cleanup
cbartz Oct 6, 2023
81a2f85
Remove status in wait_for_idle
cbartz Oct 6, 2023
2e15634
Merge branch 'main' into ISD-1086
cbartz Oct 6, 2023
9c46219
Small fixes
cbartz Oct 6, 2023
3a45dcb
Dont keep charm inside state
cbartz Oct 6, 2023
0007db5
Update src-docs
cbartz Oct 9, 2023
11f5b35
Dont use mutable default value
cbartz Oct 9, 2023
d1e28b6
Compute event name on instantiation
cbartz Oct 9, 2023
92d07a2
Raise LogrotateSetupError
cbartz Oct 9, 2023
b4d939d
Reuse _create_runner func
cbartz Oct 9, 2023
c6f82ae
Check that metrics log is empty
cbartz Oct 9, 2023
b066c95
Fix docstring in Event
cbartz Oct 9, 2023
cda48f1
Lint
cbartz Oct 9, 2023
5fac439
Merge branch 'main' into ISD-1086
cbartz Oct 9, 2023
05595ff
app_no_runner -> app
cbartz Oct 9, 2023
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
26 changes: 26 additions & 0 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@ jobs:
--token ${{secrets.E2E_TESTING_TOKEN}} \
--token-alt ${{secrets.E2E_TESTING_TOKEN_ALT}} \
tests/integration/test_charm_scheduled_events.py
integration-test-charm-metrics:
name: Integration test charm metrics
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
juju: [ 3.1, 2.9 ]
steps:
- uses: actions/checkout@v4
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: ${{ matrix.juju }}/stable
provider: lxd
- name: Enable br_netfilter
run: sudo modprobe br_netfilter
- name: Run Integration tests
run: |
tox -e integration-juju${{ matrix.juju }} -- \
--keep-models \
--path ${{secrets.E2E_TESTING_REPO}} \
--token ${{secrets.E2E_TESTING_TOKEN}} \
--token-alt ${{secrets.E2E_TESTING_TOKEN_ALT}} \
tests/integration/test_charm_metrics.py
required_status_checks:
name: Required Integration Test Status Checks
runs-on: ubuntu-latest
Expand All @@ -108,6 +132,7 @@ jobs:
- integration-test-charm
- integration-test-charm-fork-repo
- integration-test-charm-scheduled-events
- integration-test-charm-metrics
if: always() && !cancelled()
timeout-minutes: 30
steps:
Expand All @@ -116,3 +141,4 @@ jobs:
[ '${{ needs.integration-test-charm.result }}' = 'success' ] || (echo integration-test-charm failed && false)
[ '${{ needs.integration-test-charm-fork-repo.result }}' = 'success' ] || (echo integration-test-charm-fork-repo failed && false)
[ '${{ needs.integration-test-charm-scheduled-events.result }}' = 'success' ] || (echo integration-test-charm-schedule-events failed && false)
[ '${{ needs.integration-test-charm-metrics.result }}' = 'success' ] || (echo integration-test-charm-metrics failed && false)
2 changes: 2 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ header:
- 'CODEOWNERS'
- 'icon.svg'
- 'LICENSE'
- '.pylintrc'
- '.woke.yaml'
comment: on-failure
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MAIN]
extension-pkg-whitelist=pydantic # see https://github.com/pydantic/pydantic/issues/1961#issuecomment-759522422
3 changes: 3 additions & 0 deletions .woke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignore_files:
cbartz marked this conversation as resolved.
Show resolved Hide resolved
# Ignore pylintrc as it uses non compliant terminology: whitelist
- .pylintrc
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,34 @@ If there are more idle runners than configured, the oldest idle runners are unre

During each time period, every unit will make one or more API calls to GitHub. The interval may need to be adjusted if the number of units is large enough to trigger [Rate Limiting](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).


## COS
The charm is designed to provide comprehensive metrics and monitoring capabilities for both the Runners and the Charm itself. These metrics are made available through the `cos-agent` integration with the `cos_agent` interface. Additionally, a Grafana Dashboard is included to help visualize these metrics effectively.

### Loki Integration
#### Loki Push API
The charm seamlessly integrates with Loki, a powerful log aggregation system, through the `cos_agent` interface. This integration allows the charm to push various metrics and logs related to the Runners and the Charm itself to a Loki instance. This provides valuable insights into the performance and behavior of your deployment.

### Grafana Dashboard
To make monitoring even more accessible, the charm comes with a pre-configured Grafana Dashboard. This dashboard is designed to visualize the metrics collected by the charm, making it easier for operators to track the health and performance of the system.

#### Automated Dashboard Deployment
You can automate the deployment of the Grafana Dashboard using the [cos-integration-k8s](https://charmhub.io/cos-configuration-k8s) charm. This simplifies the setup process and ensures that your monitoring infrastructure is ready to go with minimal manual intervention.

#### Configuration Options
To enable the automated deployment of the Grafana Dashboard, you can provide the following configuration options when deploying the `cos-integration-k8s` charm:

```ini
git_repo=https://https://github.com/canonical/github-runner-operator
git_branch=main
git_depth=1
grafana_dashboards_path=src/grafana_dashboard_metrics
```





## Development

This charm uses black and flake8 for formatting. Both run with the lint stage of tox.
Expand Down
Loading