canonical / grafana-agent-k8s-operator

https://charmhub.io/grafana-agent-k8s
Apache License 2.0
8 stars 18 forks source link

Charm installs a snap version that is not working #229

Closed gustavosr98 closed 1 year ago

gustavosr98 commented 1 year ago

Bug Description

Charm installs by default latest/stable snap version even on charm channel latest/edge This snap version (latest/stable 0.29.0) is not starting its services

To Reproduce

I deployed Charm latest/edge version:

juju deploy ubuntu maas-one --series jammy --to 0
juju deploy grafana-agent --series jammy --channel latest/edge
juju add-relation maas-one grafana-agent

Environment

Charm version: grafana-agent: latest/edge (rev 11) Grafana-agent snap version

Relevant log output

# It installed a version of grafana-agent snap (latest/stable) that seems broken:
$ juju ssh maas-one/0

$ snap info grafana-agent
name:      grafana-agent
summary:   Telemetry Agent
publisher: Simon Aronsson (0x12b)
store-url: https://snapcraft.io/grafana-agent
license:   Apache-2.0
description: |
  Grafana Agent is a telemetry collector for sending metrics, logs, and trace data to the
  opinionated Grafana observability stack
services:
  grafana-agent: simple, enabled, inactive
snap-id:      T1u01xKcraA4IpWHpIGNU2nAOom9qG7i
tracking:     latest/stable
refresh-date: yesterday at 20:48 UTC
channels:
  latest/stable:    0.29.0 2023-03-23 (11) 230MB -
  latest/candidate: 0.29.0 2023-03-23 (11) 230MB -
  latest/beta:      0.29.0 2023-03-23 (11) 230MB -
  latest/edge:      0.34.3 2023-07-13 (13) 264MB -
installed:          0.29.0            (11) 230MB -

$ systemctl status snap.grafana-agent.grafana-agent.service
× snap.grafana-agent.grafana-agent.service - Service for snap application grafana-agent.grafana-agent
     Loaded: loaded (/etc/systemd/system/snap.grafana-agent.grafana-agent.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-07-14 16:56:09 UTC; 3h 3min ago
    Process: 6510 ExecStart=/usr/bin/snap run grafana-agent (code=exited, status=1/FAILURE)
   Main PID: 6510 (code=exited, status=1/FAILURE)

# Tried restarting service. Still broken.

# Logs:
$ grep grafana-agent /var/log/syslog
# [..]
Jul 14 20:00:11 maas-1 grafana-agent.grafana-agent[24573]: 2023/07/14 20:00:11 error loading config file /etc/grafana-agent.yaml: failed to unmarshal integration "node_exporter": yaml: unmarshal errors:
Jul 14 20:00:11 maas-1 grafana-agent.grafana-agent[24573]:   line 31: field sysctl_include not found
Jul 14 20:00:11 maas-1 systemd[1]: snap.grafana-agent.grafana-agent.service: Main process exited, code=exited, status=1/FAILURE
Jul 14 20:00:11 maas-1 systemd[1]: snap.grafana-agent.grafana-agent.service: Failed with result 'exit-code'.
Jul 14 20:00:12 maas-1 systemd[1]: snap.grafana-agent.grafana-agent.service: Scheduled restart job, restart counter is at 5.
Jul 14 20:00:12 maas-1 systemd[1]: Stopped Service for snap application grafana-agent.grafana-agent.
Jul 14 20:00:12 maas-1 systemd[1]: snap.grafana-agent.grafana-agent.service: Start request repeated too quickly.
Jul 14 20:00:12 maas-1 systemd[1]: snap.grafana-agent.grafana-agent.service: Failed with result 'exit-code'.
Jul 14 20:00:12 maas-1 systemd[1]: Failed to start Service for snap application grafana-agent.grafana-agent.

Additional context

Upgrading the snap version to latest/edge makes it work

I believe there are two issues:

  1. Grafana-agent snap latest/stable 0.29.0 broken
  2. I would expect charm channel version to match snap channel version
sed-i commented 1 year ago

Fixed in https://github.com/simskij/grafana-agent/pull/21.

$ snap info grafana-agent
--snip--
channels:
  latest/stable:    0.34.3 2023-07-19 (13) 264MB -
  latest/candidate: 0.34.3 2023-07-19 (13) 264MB -
  latest/beta:      0.34.3 2023-07-19 (13) 264MB -
  latest/edge:      0.34.3 2023-07-13 (13) 264MB -