feat(profile): wire COS observability into kubernetes and machine scaffolds - #5
Open
tonyandrewmeyer wants to merge 65 commits into
Open
feat(profile): wire COS observability into kubernetes and machine scaffolds#5tonyandrewmeyer wants to merge 65 commits into
tonyandrewmeyer wants to merge 65 commits into
Conversation
Fixes canonical#2598. CHARMCRAFT-690
Add the common remote build how-to and reference pages. --------- Signed-off-by: JJ Coldiron <jj.coldiron@canonical.com>
…l#2705) The `pack --help` overview instructed users to ensure a valid `metadata.yaml` exists. That is the legacy split-file format; modern (4.x) charms put metadata inline in `charmcraft.yaml`, so the stale guidance sent readers looking for a file that should not exist. --------- Signed-off-by: Tony Meyer <tony.meyer@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This adds release notes for Charmcraft 4.3 so we can tag 4.3.0. This also creates (and excludes) blank release notes for Charmcraft 4.4. Requires canonical#2727
…ical#2691) Warns about the deprecation of charmhub-hosted charmlibs in all charmlibs-related commands. --------- Signed-off-by: Alex Lowe <alex.lowe@canonical.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: James Garner <james.garner@canonical.com> Co-authored-by: Imani Pelton <imani.pelton@canonical.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…cal#2743) * docs: add Canonical K8s instructions to web app charm how-tos Migrate the MicroK8s-only steps in the manage-web-app-charms how-to guides to also cover Canonical K8s, matching the tabbed pattern used in the "Use a database with your 12-factor app charm" guide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix link * Update docs/howto/manage-web-app-charms/use-web-app-charm.rst Co-authored-by: Ali UĞUR <39213991+alithethird@users.noreply.github.com> Signed-off-by: florentianayuwono <76247368+florentianayuwono@users.noreply.github.com> --------- Signed-off-by: florentianayuwono <76247368+florentianayuwono@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Ali UĞUR <39213991+alithethird@users.noreply.github.com>
…ical#2721) * build(deps): update dependency django to v5.2.15 * docs: update django tutorial with version * docs: one way to sync the docs and code * fix: trailing whitespace * docs: script in conf.py to extract django version * docs: make linter happy * fix(docs): revert phrasing change in tutorial * fix: update install spread step of spread-docs.yaml * chore(copilot): add 24.04 base support to Django framework * fix: workflow path in spread-docs.yaml * chore(copilot): add 24.04 base support to Flask framework * fix: name of charms in task.yaml * fix: CHARMCRAFTCRAFT * fix: name of charms in task.yaml * chore: revert all spread test changes * chore: reorder the imports in conf.py * docs: update name of django version global var * chore: incorporate feedback from @medubelko * chore: update placeholder to something less concerning * chore: convert code snippet to function * chore(docs): update spread test and docs for updatelogfile action howto * fix(docs): revert spread test changes * chore(docs): update flask and fastapi versions * docs: small refactoring --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael DuBelko <michael.dubelko@canonical.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The 12-factor tooling accepts a configuration file `paas-config.yaml` that is read by the `paas-charm` library. See https://canonical-12-factor-app-support.readthedocs-hosted.com/latest/reference/paas-config/ This file is written in `yaml` format, and currently it contains functionality about Prometheus scraping configuration and [logging formatting in the frameworks](https://canonical-12-factor-app-support.readthedocs-hosted.com/latest/reference/paas-config-structured-logging/). If the file is not correct, because it is not valid `yaml` or because the keys/values are wrong, the application will get into error state, as it is invalid and the file has to be fixed and the charm packed again. To improve the feedback loop, this PR will make the `charmcraft pack` fail if the `paas-config.yaml` is not correct `yaml`. It will also fail if the `framework_logging_format` is set to `json` for any of the frameworks where it is not supported (only Gunicorn and Uvicorn based frameworks support this option, as the other frameworks can be easily configured in the charmed application).
* build(deps): update dependency django to v5.2.15 * docs: update django tutorial with version * docs: one way to sync the docs and code * fix: trailing whitespace * docs: script in conf.py to extract django version * docs: make linter happy * fix(docs): revert phrasing change in tutorial * fix: update install spread step of spread-docs.yaml * chore(copilot): add 24.04 base support to Django framework * fix: workflow path in spread-docs.yaml * chore(copilot): add 24.04 base support to Flask framework * fix: name of charms in task.yaml * fix: CHARMCRAFTCRAFT * fix: name of charms in task.yaml * chore(docs): remove auto-sync aspects * chore: revert auto-sync feature * fix: charm name in custom-action-updatelogfile/task.yaml * chore(docs): update spread test for updatelogfile action * chore(docs): update spread test and howto for updatelogfile * chore(docs): update spread test and howto for updatelogfile * fix: name of charm in updatelogfile test * chore: revert changes to charmcraft/extensions/app.py * chore: revert the newline change too --------- Signed-off-by: Alex Lowe <alex.lowe@canonical.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alex Lowe <alex.lowe@canonical.com>
canonical#2712) --------- Signed-off-by: Tony Meyer <tony.meyer@gmail.com> Co-authored-by: Michael DuBelko <michael.dubelko@canonical.com> Co-authored-by: Michael DuBelko <michael.dubelko@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…onical#2748) --------- Signed-off-by: Michael DuBelko <michael.dubelko@gmail.com> Co-authored-by: Michael DuBelko <michael.dubelko@gmail.com>
…nical#2764) Updates craft-providers to >=3.7.1 to resolve Ubuntu 25.10 spread test failures. Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
The bug was in craft-parts so I've updated the patch release in uv.lock. --------- Signed-off-by: Alex Lowe <alex.lowe@canonical.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Use microk8s 1.34-strict/stable instead 1.31-strict/stable. Microk8s 1.31 is EOL, and it does not work correctly in Ubuntu 26.04.
…al#2718) Promotes Python warnings to errors in `tox -e unit` for both the machine and kubernetes init profiles so charmers catch deprecated-API and resource-cleanup bugs before they bite in production. Validated by an internal Charm Tech baseline (clean after operator#2506/canonical#2507/canonical#2509 land) and a 145-charm downstream baseline (~40% projected pass rate post-operator-fix; residual clusters are all filterable per-repo). Gate PRs merged 2026-06-02; see canonical-work-queue roadmap/26.10/w-error/DECISION.md. * docs: add 4.3 release notes entry for unit-profile warnings-as-errors * docs: Apply suggestion from @tonyandrewmeyer Signed-off-by: Tony Meyer <tony.meyer@gmail.com> * docs: Update docs/release-notes/charmcraft-4.3.rst Co-authored-by: JJ Coldiron <jj.coldiron@canonical.com> Signed-off-by: Tony Meyer <tony.meyer@gmail.com> * docs: Update docs/release-notes/charmcraft-4.3.rst Co-authored-by: JJ Coldiron <jj.coldiron@canonical.com> Signed-off-by: Tony Meyer <tony.meyer@gmail.com> --------- Signed-off-by: Tony Meyer <tony.meyer@gmail.com> Co-authored-by: JJ Coldiron <jj.coldiron@canonical.com> Co-authored-by: Michael DuBelko <michael.dubelko@canonical.com>
Replaces canonical#2765 with the same fix pattern as starbase canonical#573. --------- Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Set Renovate ignorePaths to docs/** so dependency updates under docs are not proposed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…2769) Co-authored-by: Alex Lowe <alex.lowe@canonical.com>
Replicate canonical/snapcraft#6352. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Switches from candid to Ubuntu One for authentication. (CHARMCRAFT-667)
Signed-off-by: JJ Coldiron <jj.coldiron@canonical.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…nical#2786) The README's "Weekly Spread" badge and link pointed to .github/workflows/spread-large.yaml, which no longer exists in the repository. Fixes canonical#2755 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
--------- Signed-off-by: Alex Lowe <alex.lowe@canonical.com> Co-authored-by: Sam Kosh <samkosh@Sams-MacBook-Pro.local> Co-authored-by: Alex Lowe <alex.lowe@canonical.com> Co-authored-by: Michael DuBelko <michael.dubelko@gmail.com>
* Feat: extension dispatch for 12-factor extensions. * chore: cleanup * chore: addback the resolute invalid * chore: revert fmt * chore: create get_project_bases back * chore: cleanup * chore: Bring back old init templates and version the new ones * chore: set 26.04 and 26.10 as experimental for charm plugin * chore: apply comments * chore: use pascalcase for class * chore: doc links * chore: apply comments * fix: experimental * fix: default to v2 and rename v1 frameworks * docs: Update docs for v2 12-factor extensions. * docs: add linting and testing dependencies to project templates * fix(templates): organize imports in new templates * fix(tox): enable tests path in tox.ini templates for various frameworks * fix(docs): standardize tab indentation for Kubernetes log commands in use-web-app-charm.rst * fix(docs): correct indentation and formatting in manage-extensions.rst * fix(docs): update paas-charm library version information and standardize container names in logs * Apply suggestions from code review Co-authored-by: Erin Conley <erin.conley@canonical.com> Signed-off-by: Ali UĞUR <39213991+alithethird@users.noreply.github.com> * docs: update extension management guidance for Ubuntu versions * docs: remove outdated extension behavior notes for Ubuntu versions * docs: improve formatting and consistency in manage-extensions guide * retrigger CI --------- Signed-off-by: Ali UĞUR <39213991+alithethird@users.noreply.github.com> Co-authored-by: David Wilding <david.wilding@canonical.com> Co-authored-by: Erin Conley <erin.conley@canonical.com> Co-authored-by: Michael DuBelko <michael.dubelko@canonical.com>
Switches spread backend from google to openstack
The captions for settings.py and the project urls.py were missing the inner django_hello_world package directory that django-admin startproject creates. Correct them to match the actual layout used by the tutorial's task.yaml spread test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Charmcraft 4.4 release notes updates. Release notes preview: https://canonical-charmcraft--2801.com.readthedocs.build/2801/release-notes/charmcraft-4.4/ CHARMCRAFT-711
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…boards Add MetricsEndpointProvider, LogForwarder, and GrafanaDashboardProvider to the kubernetes profile scaffold so that `charmcraft init --profile=kubernetes` produces a charm pre-wired for Canonical Observability Stack integration. - charmcraft.yaml: declare charm-libs (prometheus_scrape v0, loki_push v1, grafana_dashboard v0), provides: metrics-endpoint + grafana-dashboard, requires: logging - src/charm.py: import and instantiate all three providers in __init__ with comments pointing developers to the scrape port and fetch-libs step
Add src/grafana_dashboards/overview.json.j2 to the kubernetes profile. GrafanaDashboardProvider discovers and ships JSON files from this directory automatically via the grafana-dashboard relation. The starter dashboard includes an 'up' stat panel (Prometheus scrape health) and a markdown panel with getting-started guidance.
Unit tests (ops.testing.Context): - test_metrics_endpoint_relation_joined: verifies MetricsEndpointProvider writes scrape_jobs (port 8080) into app relation data on relation-joined - test_grafana_dashboard_relation_joined: verifies GrafanaDashboardProvider writes dashboard data into app relation data - test_logging_relation_joined: verifies LogForwarder handles relation-joined without error on the requirer side Integration tests (jubilant, @pytest.mark.skip): - Skipped stubs for metrics collection, dashboard registration, and log forwarding that show the jubilant + COS integration pattern; include instructions for enabling against a real COS lite stack.
Add COSAgentProvider to the machine profile scaffold so that `charmcraft init --profile=machine` produces a charm pre-wired for Canonical Observability Stack integration via the grafana-agent machine charm. COSAgentProvider bundles metrics scraping, log forwarding, and dashboard distribution through a single 'cos-agent' relation to grafana-agent. - charmcraft.yaml: declare cos_agent charm-lib v0, provides: cos-agent - src/charm.py: import and instantiate COSAgentProvider with a configured metrics endpoint (port 8080) and dashboard directory
Add src/grafana_dashboards/overview.json.j2 to the machine profile. COSAgentProvider reads JSON files from this directory and ships them to Grafana via grafana-agent and the COS stack. Mirrors the kubernetes profile dashboard structure and guidance.
Unit tests (ops.testing.Context): - test_cos_agent_relation_joined: verifies COSAgentProvider writes 'config' into unit relation data, and that metrics_scrape_jobs contains the port-8080 endpoint declared in charm.__init__ - test_cos_agent_relation_joined_dashboard_registered: verifies the dashboard directory is included in the COS agent config Integration tests (jubilant, @pytest.mark.skip): - Skipped stubs for cos-agent relation and metrics scraping; include comments explaining how to enable against a real grafana-agent + COS stack.
The observability profile adds src/grafana_dashboards/overview.json to both the kubernetes and machine scaffolds, so BASIC_INIT_FILES has to list it.
tonyandrewmeyer
force-pushed
the
claude/profile-observability
branch
from
July 27, 2026 07:40
8da1e5c to
abeb07a
Compare
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.
What this does
Extends both the
kubernetesandmachineprofiles so thatcharmcraft initproduces a charm pre-wired for Canonical Observability Stack (COS) integration.
Each profile is independent; six logical commits cover the work.
Kubernetes profile (
--profile=kubernetes)Charm-libs declared in
charmcraft.yaml(runcharmcraft fetch-libsafter init):prometheus_k8s.prometheus_scrapev0loki_k8s.loki_pushv1grafana_k8s.grafana_dashboardv0Relations added to
charmcraft.yaml:src/charm.py— three providers instantiated in__init__:src/grafana_dashboards/overview.json— starter dashboard with:upstat panel (prometheus scrape health) driven by$juju_applicationUnit tests (
ops.testing.Context):test_metrics_endpoint_relation_joined— verifiesscrape_jobswith port 8080 is written to app datatest_grafana_dashboard_relation_joined— verifiesdashboardskey is populated in app datatest_logging_relation_joined— verifiesLogForwarderhandles the requirer-side event without errorIntegration tests: skipped stubs showing the jubilant + COS pattern for each relation.
Machine profile (
--profile=machine)Charm-lib declared in
charmcraft.yaml:cos_agent.cos_agentv0Relation added:
src/charm.py— single provider that bundles metrics, logs, and dashboards:src/grafana_dashboards/overview.json— identical structure to the kubernetes starter dashboard (grafana-agent picks this up via thecos-agentrelation and ships it to Grafana).Unit tests (
ops.testing.Context):test_cos_agent_relation_joined— verifiesconfigkey withmetrics_scrape_jobsis written to unit datatest_cos_agent_relation_joined_dashboard_registered— verifies dashboards are included in configIntegration tests: skipped stubs covering the
grafana-agentco-deployment pattern.How to activate (post-init)
To activate COS monitoring after deploying:
Kubernetes:
Machine:
COS integration test limitation
Full COS integration tests (marked
@pytest.mark.skip) require a live COS litestack and (for machine) the
grafana-agentmachine charm. These are documentedin-template with setup instructions. The skipped stubs show the expected jubilant
pattern; developers can enable them once their environment has COS deployed.
Out of scope
opentelemetry_sdklib but not included here)prometheus_alert_rules/,loki_alert_rules/) — developers add these as neededtest-*overlaysGenerated by Claude Code