how do i disable Disable time range filter in grafana enterprise version

Anonymous
2025-09-01T09:50:11.7133333+00:00

IN my cosmos db there is data but when that source is connected to azure grafana enterprise verson for building dashborads for every query i keep seeing no data as output

Azure Managed Grafana
Azure Managed Grafana
An Azure service used to deploy Grafana dashboards for analytics and monitoring solutions.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Rohikar 3,035 Reputation points Microsoft External Staff Moderator
    2025-09-01T11:11:23.5566667+00:00

    Hello Namratha D, Thanks for reaching out on Microsoft Q&A and really appreciate your patience while we looked into this.

    When using Azure Grafana Enterprise to build dashboards from a Cosmos DB data source, encountering a "no data" message is a common issue. This typically occurs because every query in Grafana, by default, respects the dashboard's time range filter. If your Cosmos DB data has timestamps that fall outside this filter (e.g., it is older than the last 6 hours), no results will be returned. To resolve this, you need to either remove the time filter from your query or adjust the dashboard's time range to include your data.

    • Disable the Time Range Filter in the Query The most direct way to get all your data, regardless of its age, is to remove the time filter macro from the query itself.
    1. Open the dashboard that is showing "no data."
    2. Click on the three-dot menu on the affected panel and select Edit.
    3. In the query editor, locate the $__timeFilter() macro. This macro is what applies the time-based filtering to your query.
    4. Remove the entire macro from your query.
      Before: SELECT * FROM c WHERE $__timeFilter(c._ts)
      After: SELECT * FROM c
    5. After removing the macro, the query will now return all data from your Cosmos DB container, bypassing the dashboard's time filter.
      Note: The $__timeFilter() macro typically relies on a specific timestamp column in your Cosmos DB data, such as _ts (the default timestamp created by Cosmos DB) or a custom datetime field you've defined. If you use a custom field, your original query would look like $__timeFilter(c.myCustomTimestamp).
    • Adjust the Dashboard's Global Time Range If you want to view your data within a specific time frame, you can simply adjust the dashboard's global time range to include the period where your data exists.
      1. Navigate to the top-right corner of the Grafana dashboard.
      2. Click on the time picker (e.g., "Last 6 hours").
      3. Select a wider time range, such as "Last 30 days" or "Last 90 days." You can also set a custom time range if you know the exact period your data was created.
    • Other Troubleshooting Steps
      If the above solutions don't work, consider these additional points:
      • Query Syntax Errors: Double-check your query for any typos or syntax mistakes.
      • Correct Time Column: Ensure that your Cosmos DB documents have a valid timestamp field and that your query is referencing it correctly.
      • Data Source Permissions: Verify that the connection to your Cosmos DB data source has the necessary read permissions on the database and container.
    • Documentation and Resources:
    1. How to manage data sources in Azure Managed Grafana
    2. Grafana Time range controls documentation
    3. Azure Cosmos DB with Grafana
      Disclaimer: This document is not maintained by Microsoft. It is being shared solely for your convenience.

    Hope this helps! If you have any further question, please let us know. Thanks.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.