canonical / tempo-k8s-operator

This charmed operator automates the operational procedures of running Grafana Tempo, an open-source tracing backend.
https://charmhub.io/tempo-k8s
Apache License 2.0
5 stars 3 forks source link

[WIP] snapshot lib POC #79

Closed PietroPasotti closed 3 months ago

PietroPasotti commented 4 months ago

This PR adds a charm library that offers a charm the possibility to snapshot its own state. State here refers to scenario's State data structure.

Internally it uses a ripoff of the jhack scenario snapshot functionality.

Goal is to offer charms the possibility to add state snapshots to traces as event datapoints for troubleshooting.

This PR also updates charm_tracing.py to expose API to hook up snapshotting automatically from the @trace_charm decorator as one would expect:

from charms.tempo_k8s.v0.snapshot import get_state
@trace_charm(
        tracing_endpoint="something",
        state="state",
)
class MyCharm(CharmBase):
    @property
    def state(self) -> scenario.State:
        return get_state()

(that will be split out to a separate PR once the design is validated)

Result: scenario.States attached to the "charm_exec" root span in grafana!

image

PietroPasotti commented 3 months ago

this requires some further speccing