Skip to content

Commit

Permalink
[DPE-3383] fix dashboard 5/edge VM (#344)
Browse files Browse the repository at this point in the history
## Issue
1. Dashboard wasn't showing metrics
2. lint +fmt out of date
3. integration test CI out of date

## Solution
Update dashboard to show metrics
<img width="1438" alt="Screenshot 2024-01-30 at 10 37 22"
src="https://github.com/canonical/mongodb-operator/assets/32723809/31fc5834-5550-4022-82a3-898890806f03">
  • Loading branch information
MiaAltieri authored Jan 31, 2024
1 parent 537173d commit 0a139e2
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 28 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
run: python3 -m pip install tox
- name: Run tests
run: tox run -e unit

lib-check:
name: Check libraries
runs-on: ubuntu-latest
Expand All @@ -61,21 +60,14 @@ jobs:
with:
fetch-depth: 0
- name: Check libs
uses: canonical/charming-actions/check-libraries@2.2.2
uses: canonical/charming-actions/check-libraries@2.4.0
with:
credentials: "${{ secrets.CHARMHUB_TOKEN }}" # FIXME: current token will expire in 2023-07-04
github-token: "${{ secrets.GITHUB_TOKEN }}"

build:
strategy:
fail-fast: true
matrix:
charm: [".", "tests/integration/relation_tests/new_relations/application-charm"]
name: Build ${{ matrix.charm }} charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
with:
charmcraft-snap-channel: "latest/edge"
path-to-charm-directory: ${{ matrix.charm }}
name: Build charms
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v8

integration-test:
strategy:
Expand Down Expand Up @@ -111,10 +103,8 @@ jobs:
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact-name }}

- name: Free up disk space
- name: Free disk space
run: |
# From https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
echo "Free disk space before cleanup"
df -T
# free space in the runner
Expand Down
1 change: 1 addition & 0 deletions lib/charms/mongodb/v0/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Simple functions, which can be used in both K8s and VM charms."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
import json
Expand Down
1 change: 1 addition & 0 deletions lib/charms/mongodb/v0/mongodb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code for interactions with MongoDB."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

Expand Down
1 change: 1 addition & 0 deletions lib/charms/mongodb/v0/mongodb_secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Secrets related helper classes/functions."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

Expand Down
1 change: 1 addition & 0 deletions lib/charms/mongodb/v0/users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Users configuration for MongoDB."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
from typing import Set
Expand Down
1 change: 1 addition & 0 deletions src/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration for MongoDB Charm."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

Expand Down
13 changes: 5 additions & 8 deletions src/grafana_dashboards/MongoDB_ReplSet_Summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"type": "datasource",
"uid": "${prometheusds}"
},
"expr": "count by(set) (group by(service_name, set) (mongodb_mongod_replset_number_of_members{cluster=~\"$cluster\",juju_application=\"$juju_application\",juju_model=\"$juju_model\",juju_model_uuid=\"$juju_model_uuid\",juju_unit=\"$juju_unit\",set=~\"$replset\"} or mongodb_mongod_replset_my_state{cluster=~\"$cluster\",juju_application=\"$juju_application\",juju_model=\"$juju_model\",juju_model_uuid=\"$juju_model_uuid\",juju_unit=\"$juju_unit\",set=~\"$replset\"}))",
"expr": "mongodb_mongod_replset_number_of_members{juju_application=~\"$juju_application\",juju_model=~\"$juju_model\",juju_model_uuid=~\"$juju_model_uuid\",juju_unit=~\"$juju_unit\"} ",
"interval": "5m",
"intervalFactor": 1,
"legendFormat": "",
Expand Down Expand Up @@ -3130,22 +3130,19 @@
]
},
"time": {
"from": "2023-03-27T08:51:52.293Z",
"to": "2023-04-12T08:51:52.293Z"
"from": "now-12h",
"to": "now"
},
"timepicker": {
"hidden": false,
"now": true,
"refresh_intervals": [
"1s",
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"6h",
"1d"
],
"time_options": [
Expand Down
1 change: 1 addition & 0 deletions src/machine_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Machine Charm specific functions for operating MongoDB."""

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
import logging
Expand Down
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def juju_has_secrets(mocker: MockerFixture):
(i.e. not the real juju version)
"""
if version("juju") < "3":
mocker.patch.object(
JujuVersion, "has_secrets", new_callable=PropertyMock
).return_value = False
mocker.patch.object(JujuVersion, "has_secrets", new_callable=PropertyMock).return_value = (
False
)
return False
else:
mocker.patch.object(
JujuVersion, "has_secrets", new_callable=PropertyMock
).return_value = True
mocker.patch.object(JujuVersion, "has_secrets", new_callable=PropertyMock).return_value = (
True
)
return True


Expand Down

0 comments on commit 0a139e2

Please sign in to comment.