How to do dynamic label mapping/adding metadata?

I would like to map certain labels that I set in my sources, based on a lookup from one value to another. For example mapping an identifier to a more friendly name, or mapping a value to that of a parent.

I could probably do this in my source, or at time of ingestion, but I’d rather not add more labels than I have to, and these labels aren’t needed for querying, just for fancy displaying on dashboards.

Some hacks that I know of is to add a metadata series with a constant 1 counter, then doing group_left with that. This has issues with historical data and cases where no join is possible. For Loki I have tried with a mixed query with more success.

I can join my metadata on template variables with little issue. It would just be great to map my values in a more general way, or just before it is presented in a view.

What can I do?

1 Like