Skip to content

Commit 6435242

Browse files
Merge pull request #3 from hivemq/feat/copilot-metrics
Copilot metrics retention strategy
2 parents 3650db9 + 04f25f2 commit 6435242

File tree

5 files changed

+31537
-10
lines changed

5 files changed

+31537
-10
lines changed

.github/workflows/copilot_metrics_retention.yaml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,48 @@
22

33
on:
44
push:
5-
5+
schedule:
6+
- cron: '0 0 * * 0'
7+
# This cron expression runs the workflow every Sunday at midnight UTC
8+
permissions:
9+
contents: write
10+
id-token: write
11+
pull-requests: write
12+
actions: write
13+
614
jobs:
715
first-job:
816
runs-on: ubuntu-latest
9-
17+
1018
steps:
1119
- name: Checkout
1220
uses: actions/checkout@v4
1321

14-
- name: Copilot Metrics Retention
15-
uses: ambilykk/copilot-metrics-retention@main
16-
with:
22+
- name: Copilot Metrics Retention
23+
uses: ambilykk/copilot-metrics-retention@5b9ef15ce66fc883afb3b6127f960e44d5233a50
24+
with:
1725
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
1826
org_name: 'hivemq'
19-
json_path: 'metrics.json'
20-
27+
json_path: 'metrics_hivemq.json'
28+
29+
- name: Copilot Metrics Retention
30+
uses: ambilykk/copilot-metrics-retention@5b9ef15ce66fc883afb3b6127f960e44d5233a50
31+
with:
32+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
33+
org_name: 'hivemq-cloud'
34+
json_path: 'metrics_hivemq-cloud.json'
35+
2136
- uses: actions/upload-artifact@v4
2237
with:
2338
name: metrics.json
24-
path: 'metrics.json'
25-
39+
path: |
40+
metrics_hivemq.json
41+
metrics_hivemq-cloud.json
42+
43+
- name: Commit and push if it changed
44+
run: |
45+
git config user.name 'Copilot Metrics Retention'
46+
git config user.email '[email protected]'
47+
git add metrics_hivemq.json metrics_hivemq-cloud.json
48+
git commit -m "Copilot Metrics data update" || exit 0
49+
git push

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ GitHub only offers a 28-day retention period for Copilot metrics. This solution
77
A GitHub Action retrieves the JSON metrics and renders them into a single JSON file. [Ref](*https://github.com/marketplace/actions/copilot-metrics-retention)
88

99
## Convert the json into SQlite dbfile
10-
Open the terminal into the repo folder and run `python3 app.py`, visit the page `http://127.0.0.1:5000/`, download the json artifact and load the file, click on `Convert & Download SQLite DB`, this will generate a .db file available under the upload folder having the name `copilot_metrics.db`
10+
Open the terminal into the repo folder and run `python3 app.py`, visit the page `http://127.0.0.1:5000/`.
11+
Load the `metrics.json`, click on `Convert & Download SQLite DB`, this will generate a .db file available under the upload folder having the name `copilot_metrics.db`
1112

1213
## Visualite the copilot_metrics.db via metabase
1314

0 commit comments

Comments
 (0)