Remove some Date Filter

Can we remove these filters?

Today, This week, This month, This year, This fiscal quarter, This fiscal year?

it’s colliding not too well on my avg_over_time query

(avg_over_time(up[$__range]) or (avg_over_time(up[$__interval])

returns NO DATA

Data Source: Mimir
Format: Table
Type: Instant

You can search for them (i.e. for text “This fiscal quarter”) in *.js files in public/build folder, and remove items that you don’t need.

Array with date filters looks like this:

const t = [{
    from: "now-5m",
    to: "now",
    display: "Last 5 minutes"
}, {
    from: "now-15m",
    to: "now",
    display: "Last 15 minutes"
}, {
    from: "now-30m",
    to: "now",
    display: "Last 30 minutes"
}, {
    from: "now-1h",
    to: "now",
    display: "Last 1 hour"
}, {
    from: "now-3h",
    to: "now",
    display: "Last 3 hours"
}, {
    from: "now-6h",
    to: "now",
    display: "Last 6 hours"
}, {
    from: "now-12h",
    to: "now",
    display: "Last 12 hours"
}, {
    from: "now-24h",
    to: "now",
    display: "Last 24 hours"
}, {
    from: "now-2d",
    to: "now",
    display: "Last 2 days"
}, {
    from: "now-7d",
    to: "now",
    display: "Last 7 days"
}, {
    from: "now-30d",
    to: "now",
    display: "Last 30 days"
}, {
    from: "now-90d",
    to: "now",
    display: "Last 90 days"
}, {
    from: "now-6M",
    to: "now",
    display: "Last 6 months"
}, {
    from: "now-1y",
    to: "now",
    display: "Last 1 year"
}, {
    from: "now-2y",
    to: "now",
    display: "Last 2 years"
}, {
    from: "now-5y",
    to: "now",
    display: "Last 5 years"
}, {
    from: "now-1d/d",
    to: "now-1d/d",
    display: "Yesterday"
}, {
    from: "now-2d/d",
    to: "now-2d/d",
    display: "Day before yesterday"
}, {
    from: "now-7d/d",
    to: "now-7d/d",
    display: "This day last week"
}, {
    from: "now-1w/w",
    to: "now-1w/w",
    display: "Previous week"
}, {
    from: "now-1M/M",
    to: "now-1M/M",
    display: "Previous month"
}, {
    from: "now-1Q/fQ",
    to: "now-1Q/fQ",
    display: "Previous fiscal quarter"
}, {
    from: "now-1y/y",
    to: "now-1y/y",
    display: "Previous year"
}, {
    from: "now-1y/fy",
    to: "now-1y/fy",
    display: "Previous fiscal year"
}, {
    from: "now/d",
    to: "now/d",
    display: "Today"
}, {
    from: "now/d",
    to: "now",
    display: "Today so far"
}, {
    from: "now/w",
    to: "now/w",
    display: "This week"
}, {
    from: "now/w",
    to: "now",
    display: "This week so far"
}, {
    from: "now/M",
    to: "now/M",
    display: "This month"
}, {
    from: "now/M",
    to: "now",
    display: "This month so far"
}, {
    from: "now/y",
    to: "now/y",
    display: "This year"
}, {
    from: "now/y",
    to: "now",
    display: "This year so far"
}, {
    from: "now/fQ",
    to: "now",
    display: "This fiscal quarter so far"
}, {
    from: "now/fQ",
    to: "now/fQ",
    display: "This fiscal quarter"
}, {
    from: "now/fy",
    to: "now",
    display: "This fiscal year so far"
}, {
    from: "now/fy",
    to: "now/fy",
    display: "This fiscal year"
}]

Of course, this should be done again in case of Grafana updgrade…

2 Likes

wonderful. thanks @ebabeshko I’ll have a look and let you know

Thanks so much @ebabeshko . This answered another question I have in mind.

@ebabeshko I’m using Grafana11.3.1-1 on CentOS 7.9. I’ve already removed the instance of {from:"now/fy",to:"now",display:"This fiscal year so far"} in these files:

  • 322.5df7dbfcd22d85fc7794.js
  • 322.5df7dbfcd22d85fc7794.js.map
  • 3719.c065b2e146c4c8347d51.js
  • 3719.c065b2e146c4c8347d51.js.map

I had installed Grafana using RPM. Restarted Grafana server AND rebooted the whole VM - but no luck.
I’ve also tried misspelling “fiscal” to “fiscall” and restarted the grafana server but these changes just don’t take affect.

Am I missing something?

Did you try to clear browser cache / open Grafana in another browser?

@ebabeshko yup. Already tried that. Any ideas? Also tried it on Windows env and deleted the instances like “last fiscal year” and restarted my computer but no luck.

@ebabeshko nevermind! I didn’t clear the cache properly. Clearing cache, history of the browser fixed it. Thanks!