---
title: Charmhub | Deploy Parca using Charmhub - The Open Operator Collection
description: Deploy the latest version of Parca as a Kubernetes Operator on any cloud.
url: https://charmhub.io/parca-k8s/libraries/parca_store
---

# Parca

[Canonical Observability](https://charmhub.io/publisher/observability "View all packages from Canonical Observability")

* [Canonical Observability](https://charmhub.io/publisher/observability "View all packages from Canonical Observability")

Platform:

0.27/stable rev389-5-g748063c

```
juju deploy parca-k8s --channel 0.27/stable
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/parca-k8s/libraries/parca_store#drawer)

## charms.parca\_k8s.v0.parca\_store

* [*Docstrings*Docstrings](https://charmhub.io/parca-k8s/libraries/parca_store)
  [*Code*Source code](https://charmhub.io/parca-k8s/libraries/parca_store/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.parca_k8s.v0.parca_store
    ```

    [Download parca\_store.py](https://charmhub.io/parca-k8s/libraries/parca_store/download)
  + *Last updated* 23 Apr 2025
  + *Revision* Library version 0.4

#### Overview.

This document explains how to integrate with the Parca charm where you wish to use Parca
as a store for profiles that are sent from a Parca Agent.

##### Requirer Library usage

In this mode, your charm will be an application that needs to receive store configuration over the
relation in order that the workload can be configured to use a remote store for profiles.

To begin, start by importing the library and subscribing to some events:

```
from charms.parca_k8s.v0.parca_store import (ParcaStoreEndpointRequirer, RemoveStoreEvent)

def __init__(self, *args):
    super().__init__(*args)
    # ...
    self.store_requirer = ParcaStoreEndpointRequirer(
        self, relation_name="external-parca-store-endpoint"
    )
    self.framework.observe(self.store_requirer.on.endpoints_changed, self._configure_store)
    self.framework.observe(self.store_requirer.on.remove_store, self._configure_store)
    # ...

def _configure_store(self, event):
    store_config = {} if isinstance(event, RemoveStoreEvent) else event.store_config
    self.application.configure(store_config=store_config)
    # ...
```

You can also fetch the store config at any time by using `self.store_requirer.config`.

##### Provider library usage

In this mode, your charm will be the charm that provides the store capability. In order to use the
library, you must first import it, and initialise it in your charm's constructor:

```
from charms.parca_k8s.v0.parca_store import ParcaStoreEndpointProvider

def __init__(self, *args):
    super().__init__(*args)
    # ...
    self.parca_store_endpoint = ParcaStoreEndpointProvider(
        charm = self,
        port = 7070,
        insecure = True
    )
    # ...
```

This will ensure that any client wishing to send profiles will be sent the application
address, along with the instruction to not use TLS for the connection.

If your store integrates with an ingress (such as Traefik), you will also need to pass
the `external_url` parameter:

```
from charms.parca_k8s.v0.parca_store import ParcaStoreEndpointProvider

def __init__(self, *args):
    super().__init__(*args)
    # ...
    self.parca_store_endpoint = ParcaStoreEndpointProvider(
        charm = self,
        external_url = self._external_url(),
        port = 443,
        insecure = False
    )
    # ...
```

If your Parca store requires authentication with a bearer token, you can provide a method
that can be called for generating tokens on a per-relation basis:

```
from charms.parca_k8s.v0.parca_store import ParcaStoreEndpointProvider

def __init__(self, *args):
    super().__init__(*args)
    # ...
    self.parca_store_endpoint = ParcaStoreEndpointProvider(
        charm = self,
        token_generator = self._bearer_token_generator
    )
    # ...
```

Where `self._bearer_token_generator` can be any `Callable` that returns a string.

---

Index

* [class ParcaStoreEndpointProvider](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    port,
    insecure,
    external\_url,
    token\_generator,
    relation\_name)](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointprovider-__init__)
* + [def set\_remote\_store\_connection\_data(
    self,
    \_)](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointprovider-set_remote_store_connection_data)
* [class StoreEndpointsChangedEvent](https://charmhub.io/parca-k8s/libraries/parca_store#storeendpointschangedevent)
* + [def \_\_init\_\_(
    self,
    handle,
    relation\_id,
    remote\_store\_address,
    remote\_store\_bearer\_token,
    remote\_store\_insecure)](https://charmhub.io/parca-k8s/libraries/parca_store#storeendpointschangedevent-__init__)
* + [def snapshot(
    self)](https://charmhub.io/parca-k8s/libraries/parca_store#storeendpointschangedevent-snapshot)
* + [def restore(
    self,
    snapshot)](https://charmhub.io/parca-k8s/libraries/parca_store#storeendpointschangedevent-restore)
* [class RemoveStoreEvent](https://charmhub.io/parca-k8s/libraries/parca_store#removestoreevent)
* + [def \_\_init\_\_(
    self,
    handle,
    relation\_id)](https://charmhub.io/parca-k8s/libraries/parca_store#removestoreevent-__init__)
* + [def snapshot(
    self)](https://charmhub.io/parca-k8s/libraries/parca_store#removestoreevent-snapshot)
* + [def restore(
    self,
    snapshot)](https://charmhub.io/parca-k8s/libraries/parca_store#removestoreevent-restore)
* [class ParcaStoreEvents](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreevents)
* [class ParcaStoreEndpointRequirer](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointrequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointrequirer-__init__)
* + [def config(
    self)](https://charmhub.io/parca-k8s/libraries/parca_store#parcastoreendpointrequirer-config)

#### class ParcaStoreEndpointProvider

Description

Profiling endpoint for Parca. None

Methods

ParcaStoreEndpointProvider.
\_\_init\_\_(

*self*

,
charm

,
port: int

,
insecure: bool

,
external\_url

,
token\_generator: Callable

,
relation\_name: str
)

Construct a Parca profile store provider.

Arguments

charm

a `ops.CharmBase` object that manages this
`ParcaStoreEndpointProvider` object. Typically, this is `self` in the instantiating
class.

port

an optional integer that represents the port on which the Parca Store listens.

insecure

an optional boolean that instructs clients whether to use TLS when
connecting to the endpoint provided. Defaults to False, implying that by default
TLS should be used.

external\_url

an optional string that represents the URL at which the Parca Store
endpoint can be reached. Useful when the Parca Store implementation is behind
an ingress or reverse proxy. Should NOT include the grpc(s):// scheme.

token\_generator

an optional method or lambda that can generate valid bearer tokens
for the Parca Store. Defaults to a lambda that returns an empty string.

relation\_name

an optional string that denotes the name of the relation endpoint.

Description

If your charm exposes a Parca Store endpoint, the `ParcaStoreEndpointProvider` object
enables your charm to easily communicate how to reach that endpoint.

ParcaStoreEndpointProvider.
set\_remote\_store\_connection\_data(

*self*

,
\_
)

Set relation data for each relation providing store connection details.

Description

Each time a profiling provider charm container is restarted it updates its own host address
in the unit relation data for the Parca charm. The only argument specified is an event and
it is ignored.

#### class StoreEndpointsChangedEvent

Description

Event emitted when Parca store endpoints change. None

Methods

StoreEndpointsChangedEvent.
\_\_init\_\_(

*self*

,
handle

,
relation\_id

,
remote\_store\_address

,
remote\_store\_bearer\_token

,
remote\_store\_insecure
)

StoreEndpointsChangedEvent.
snapshot(

*self*
)

Description

Save store relation information. None

StoreEndpointsChangedEvent.
restore(

*self*

,
snapshot
)

Description

Restore store relation information. None

#### class RemoveStoreEvent

Description

Event emitted when Parca store config should be removed. None

Methods

RemoveStoreEvent.
\_\_init\_\_(

*self*

,
handle

,
relation\_id
)

RemoveStoreEvent.
snapshot(

*self*
)

Description

Save store relation information. None

RemoveStoreEvent.
restore(

*self*

,
snapshot
)

Description

Restore store relation information. None

#### class ParcaStoreEvents

Description

Event descriptor for events raised by `ParcaStoreEndpointRequirer`. None

#### class ParcaStoreEndpointRequirer

Description

Provide an interface for apps that need to send data to a Parca Store. None

Methods

ParcaStoreEndpointRequirer.
\_\_init\_\_(

*self*

,
charm

,
relation\_name: str
)

Construct a Parca profile store requirer.

Arguments

charm

a `ops.CharmBase` object that manages this
`ParcaStoreEndpointRequirer` object. Typically this is `self` in the instantiating
class.

relation\_name

an optional string that denotes the name of the relation endpoint.

ParcaStoreEndpointRequirer.
config(

*self*
)

Description

Return the store config for a given requirer if the relation is formed. None
