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

Add cos-agent support #40

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Add cos-agent support #40

merged 3 commits into from
Jan 10, 2025

Conversation

michaeldmitry
Copy link
Contributor

@michaeldmitry michaeldmitry commented Jan 10, 2025

Fixes #38
Fixes #30

Adds metrics scraping and charm tracing to parca-agent through cos_agent.

Context

Currently, the parca-agent snap doesn't expose a slot to access its logs.
parca-dev/parca-agent#3017

Testing Instructions

In a K8s model:
Deploy this bundle ((make sure to run juju run s3-integrator/leader sync-s3-credentials access-key=accesskey secret-key=mysoverysecretkey))

bundle: kubernetes
saas:
  remote-03c0779dfcc14a8587603554100dce99: {}
  remote-0d97fdf0fd1840548cfade97f254ca96: {}
applications:
  grafana:
    charm: grafana-k8s
    channel: latest/edge
    revision: 128
    base: [email protected]/stable
    resources:
      grafana-image: 70
      litestream-image: 45
    scale: 1
    constraints: arch=amd64
    storage:
      database: kubernetes,1,1024M
    trust: true
  loki:
    charm: loki-k8s
    channel: latest/edge
    revision: 184
    base: [email protected]/stable
    resources:
      loki-image: 100
      node-exporter-image: 3
    scale: 1
    constraints: arch=amd64
    storage:
      active-index-directory: kubernetes,1,1024M
      loki-chunks: kubernetes,1,1024M
    trust: true
  minio:
    charm: minio
    channel: ckf-1.9/edge
    revision: 383
    base: [email protected]/stable
    resources:
      oci-image: 545
    scale: 1
    options:
      access-key: accesskey
      secret-key: mysoverysecretkey
    constraints: arch=amd64
    storage:
      minio-data: kubernetes,1,10240M
    trust: true
  parca:
    charm: local:parca-k8s-1
    scale: 1
    constraints: arch=amd64
    storage:
      profiles: kubernetes,1,1024M
    trust: true
  prometheus:
    charm: prometheus-k8s
    channel: latest/edge
    revision: 226
    base: [email protected]/stable
    resources:
      prometheus-image: 151
    scale: 1
    constraints: arch=amd64
    storage:
      database: kubernetes,1,1024M
    trust: true
  s3-integrator:
    charm: s3-integrator
    channel: latest/edge
    revision: 97
    base: [email protected]/stable
    scale: 1
    options:
      bucket: tempo
      endpoint: minio-0.minio-endpoints.test.svc.cluster.local:9000
    constraints: arch=amd64
    trust: true
  tempo:
    charm: tempo-coordinator-k8s
    channel: latest/edge
    revision: 53
    base: [email protected]/stable
    resources:
      nginx-image: 5
      nginx-prometheus-exporter-image: 3
    scale: 1
    constraints: arch=amd64
    storage:
      data: kubernetes,1,1024M
    trust: true
  tempo-worker:
    charm: tempo-worker-k8s
    channel: latest/edge
    revision: 43
    base: [email protected]/stable
    resources:
      tempo-image: 4
    scale: 1
    constraints: arch=amd64
    storage:
      data: kubernetes,1,1024M
    trust: true
  traefik:
    charm: traefik-k8s
    channel: latest/edge
    revision: 226
    base: [email protected]/stable
    resources:
      traefik-image: 161
    scale: 1
    constraints: arch=amd64
    storage:
      configurations: kubernetes,1,1024M
    trust: true
relations:
- - tempo:s3
  - s3-integrator:s3-credentials
- - tempo:tempo-cluster
  - tempo-worker:tempo-cluster
- - tempo:ingress
  - traefik:traefik-route
- - loki:ingress
  - traefik:ingress-per-unit
- - prometheus:ingress
  - traefik:ingress-per-unit
- - grafana:ingress
  - traefik:traefik-route
- - grafana:grafana-source
  - loki:grafana-source
- - grafana:grafana-source
  - tempo:grafana-source
- - grafana:grafana-source
  - prometheus:grafana-source
- - parca:ingress
  - traefik:ingress
- - loki:logging
  - remote-03c0779dfcc14a8587603554100dce99:logging-consumer
- - prometheus:receive-remote-write
  - remote-03c0779dfcc14a8587603554100dce99:send-remote-write
- - tempo:tracing
  - remote-03c0779dfcc14a8587603554100dce99:tracing
- - parca:parca-store-endpoint
  - remote-0d97fdf0fd1840548cfade97f254ca96:parca-store-endpoint
--- # overlay.yaml
applications:
  loki:
    offers:
      loki:
        endpoints:
        - logging
        acl:
          admin: admin
  parca:
    offers:
      parca:
        endpoints:
        - parca-store-endpoint
        acl:
          admin: admin
  prometheus:
    offers:
      prometheus:
        endpoints:
        - receive-remote-write
        acl:
          admin: admin
  tempo:
    offers:
      tempo:
        endpoints:
        - tracing
        acl:
          admin: admin

In a machine model:
Deploy this bundle:

default-base: [email protected]/stable
saas:
  loki:
    url: micro:admin/test.loki
  parca:
    url: micro:admin/test.parca
  prometheus:
    url: micro:admin/test.prometheus
  tempo:
    url: micro:admin/test.tempo
applications:
  grafana-agent:
    charm: local:grafana-agent-2
    base: [email protected]/stable
  parca-agent:
    charm: local:parca-agent-8
    base: [email protected]/stable
  ubuntu:
    charm: ubuntu
    channel: latest/stable
    revision: 25
    num_units: 1
    to:
    - "2"
    constraints: arch=amd64
    storage:
      block: loop,100M
      files: rootfs,100M
machines:
  "2":
    constraints: virt-type=virtual-machine
relations:
- - ubuntu:juju-info
  - grafana-agent:juju-info
- - loki:logging
  - grafana-agent:logging-consumer
- - prometheus:receive-remote-write
  - grafana-agent:send-remote-write
- - tempo:tracing
  - grafana-agent:tracing
- - ubuntu:juju-info
  - parca-agent:juju-info
- - parca-agent:cos-agent
  - grafana-agent:cos-agent
- - parca-agent:parca-store-endpoint
  - parca:parca-store-endpoint

Then, open the grafana dashboard, you should see parca-agent metrics and charm traces in the prometheus and tempo DS.

src/charm.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mmkay mmkay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, otherwise it looks fine :)

@michaeldmitry michaeldmitry merged commit 561bc3c into main Jan 10, 2025
10 of 11 checks passed
@michaeldmitry michaeldmitry deleted the TAP-107 branch January 10, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cos-agent integration Cleanup charm init and map event handlers to events one to one
2 participants