Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import with __input variable as constant type does not work in queries #29802

Open
italux opened this issue Dec 13, 2020 · 2 comments
Open

Import with __input variable as constant type does not work in queries #29802

italux opened this issue Dec 13, 2020 · 2 comments
Labels
area/dashboard/import prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. type/feature-request

Comments

@italux
Copy link

italux commented Dec 13, 2020

What happened:
I'm building a dashboard template that will be shared with other people and due to limitations of the datasource I'm using (aka grafana-mongodb-atlas-datasource) I can't use template variables. As an attempt to solve this I'm trying to use __inputs variables to allow people to create their own dashboard by inputting specific data using "type": "constant" to replace some partial values inside queries but the replace only work if the query value is exactly matched with the __inputs constant name

This is the __inputs values example

  "__inputs": [
    {
      "name": "MONGODB_ATLAS_DS",
      "label": "MongoDB Atlas Datasource",
      "description": "",
      "type": "datasource",
      "pluginId": "grafana-mongodb-atlas-datasource",
      "pluginName": "grafana-mongodb-atlas-datasource"
    },
    {
      "name": "MONGO_ID",
      "label": "MongoDB ID",
      "description": "",
      "type": "constant"
    }
]

This is the query with partial values that should be replaced

"targets": [
        {
          "alias": "",
          "clusterId": "${CLUSTER_ID}", # This works fine
          "clusterName": "${CLUSTER_NAME}", # This works fine
          "database": "${DATABASE_NAME}", # This works fine
          "dimensionId": "CONNECTIONS",
          "dimensionName": "Connections",
          "disk": "",
          "metricId": "process_measurements",
          "metricName": "Process Measurements",
          "mongoId": "atlas-${MONGO_ID}-shard-00-00.${DNS_PREFIX}:27017",  # This DOESN'T work
          "mongoName": "atlas-${MONGO_ID}-shard-00-00.${DNS_PREFIX}",  # This DOESN'T work
          "projectId": "${PROJECT_ID}", # This works fine
          "projectName": "${PROJECT_NAME}", # This works fine
          "refId": "B"
        },

After import the dashboard we face the query like below:
image

What you expected to happen:
Be able to replace __inputs values inside queries text strings as shown above

How to reproduce it (as minimally and precisely as possible):
Create a simple dashboard template using the same template example above and try to import replacing constant values inside queries

Anything else we need to know?:
This is the same issue reported in #8923

Environment:

  • Grafana version: Grafana v7.0.5 (efbcbb8)
  • Data source type & version: grafana-mongodb-atlas-datasource v1.0.0
  • OS Grafana is installed on: CentOS Linux release 7.6.1810 (Core)
  • User OS & Browser: Mac OS Chrome
  • Grafana plugins:
  • Others:
@italux italux changed the title Import with __input variable as constant type does not work in querie Import with __input variable as constant type does not work in queries Dec 13, 2020
@hugohaggmark hugohaggmark added this to Needs triage in Platform Backlog via automation Dec 14, 2020
@hugohaggmark hugohaggmark moved this from Needs triage to Feature requests in Platform Backlog Dec 14, 2020
@hugohaggmark hugohaggmark added the prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. label Dec 14, 2020
Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

@github-actions github-actions bot added the stale Issue with no recent activity label Jan 22, 2024
@italux
Copy link
Author

italux commented Jan 22, 2024

Remove stale

@github-actions github-actions bot removed the stale Issue with no recent activity label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard/import prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. type/feature-request
Projects
None yet
Development

No branches or pull requests

3 participants