Skip to content

Conversation

@SpencerTorres
Copy link
Collaborator

Fixes a regression from #1369 (reported in #1434) by allowing users to configure per-dashboard whether their OTel labels are Map or JSON type. Basically reverting the AdHoc filter changes and making them opt-in.

TL;DR: To "opt in" to JSON AdHoc filters, add clickhouse_adhoc_use_json as a constant variable (the value doesn't matter) to your dashboard.

Details

For OTel data, we merge and flatten ResourceAttributes, LogAttributes, and ScopeAttributes into a single labels field. The labels field then has values such as ResourceAttributes.host.name.

This means for JSON type, we can use the ResourceAttributes.host.name syntax directly, while for the Map type we must change the syntax to ResourceAttributes['host.name'].

example adhoc filter

Because the above Ad-Hoc filter doesn't specify type, we must add a way to configure this syntax to interpret as JSON or Map. We can't add it at the top level config, since it may be different per dashboard. So instead a user can simply add clickhouse_adhoc_use_json to enable the JSON syntax. If this is not present then it will default to Map.

Let me know if you have any thoughts on how we might improve this solution.

Copy link
Contributor

@aangelisc aangelisc left a comment

Choose a reason for hiding this comment

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

The changes LGTM but I'm uncertain on the enablement mechanism. I'd prefer updating the AdHocVariableForm in Grafana core to allow plugins to provide additional config 🤔

@adamyeats adamyeats moved this from Incoming to Needs Review in Partner Datasources Dec 5, 2025
@adamyeats adamyeats moved this from Needs Review to Waiting in Partner Datasources Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Waiting

Development

Successfully merging this pull request may close these issues.

2 participants