Skip to content

Dashboard Variables: Populate list based on attributes automatically #1826

@mpaluch92

Description

@mpaluch92

Question

Hi there,

first of all, a big thank you for your amazing tools ❤️
I've been working with a dashboard in Logfire and have a quick question about variables. I've added a shop_id attribute to some of my metrics, like this:

search_requests_counter = logfire.metric_counter(
    "search.requests",
    unit="1",
    description="Total number of search requests",
)

search_requests_counter.add(1, attributes={"shop_id": "example_shop_id"})

I've created visualizations based on these metrics, and now I want to add a variable to filter by shop ID. Currently, I've set it up as a text variable, which works fine. However, I'm curious: if I switch the variable type to a list, can I automatically populate it with the available shop IDs that have been captured as attributes?

In the variable editing window, I noticed a field called Capturing Regexp Filter. Is that the right tool for this? If so, could you point me to the correct regex pattern to use? I’ve looked through the documentation and couldn not find any examples for this specific use case.

Any guidance would be hugely appreciated. :)

Metadata

Metadata

Assignees

Labels

QuestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions