E2C: Reduce UI poll interval and make configurable (#91386)
* E2C: Reduce UI poll interval and make configurable * fix default
This commit is contained in:
@@ -1969,4 +1969,6 @@ domain = grafana.net
|
|||||||
snapshot_folder = ""
|
snapshot_folder = ""
|
||||||
# Link to form to give feedback on the feature
|
# Link to form to give feedback on the feature
|
||||||
feedback_url = https://docs.google.com/forms/d/e/1FAIpQLSeEE33vhbSpR8A8S1A1ocZ1ByVRRwiRl1GZr2FSrEer_tSa8w/viewform?usp=sf_link
|
feedback_url = https://docs.google.com/forms/d/e/1FAIpQLSeEE33vhbSpR8A8S1A1ocZ1ByVRRwiRl1GZr2FSrEer_tSa8w/viewform?usp=sf_link
|
||||||
|
# How frequently should the frontend UI poll for changes while resources are migrating
|
||||||
|
frontend_poll_interval = 2s
|
||||||
|
|
||||||
|
|||||||
@@ -1900,3 +1900,5 @@ timeout = 30s
|
|||||||
;snapshot_folder = ""
|
;snapshot_folder = ""
|
||||||
# Link to form to give feedback on the feature
|
# Link to form to give feedback on the feature
|
||||||
;feedback_url = ""
|
;feedback_url = ""
|
||||||
|
# How frequently should the frontend UI poll for changes while resources are migrating
|
||||||
|
;frontend_poll_interval = 2s
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
localFileSystemAvailable: boolean | undefined;
|
localFileSystemAvailable: boolean | undefined;
|
||||||
cloudMigrationIsTarget: boolean | undefined;
|
cloudMigrationIsTarget: boolean | undefined;
|
||||||
cloudMigrationFeedbackURL = '';
|
cloudMigrationFeedbackURL = '';
|
||||||
|
cloudMigrationPollIntervalMs = 2000;
|
||||||
reportingStaticContext?: Record<string, string>;
|
reportingStaticContext?: Record<string, string>;
|
||||||
exploreDefaultTimeOffset = '1h';
|
exploreDefaultTimeOffset = '1h';
|
||||||
|
|
||||||
|
|||||||
@@ -257,8 +257,9 @@ type FrontendSettingsDTO struct {
|
|||||||
PublicDashboardAccessToken string `json:"publicDashboardAccessToken"`
|
PublicDashboardAccessToken string `json:"publicDashboardAccessToken"`
|
||||||
PublicDashboardsEnabled bool `json:"publicDashboardsEnabled"`
|
PublicDashboardsEnabled bool `json:"publicDashboardsEnabled"`
|
||||||
|
|
||||||
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
|
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
|
||||||
CloudMigrationFeedbackURL string `json:"cloudMigrationFeedbackURL"`
|
CloudMigrationFeedbackURL string `json:"cloudMigrationFeedbackURL"`
|
||||||
|
CloudMigrationPollIntervalMs int `json:"cloudMigrationPollIntervalMs"`
|
||||||
|
|
||||||
DateFormats setting.DateFormats `json:"dateFormats,omitempty"`
|
DateFormats setting.DateFormats `json:"dateFormats,omitempty"`
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
|
|||||||
PublicDashboardsEnabled: hs.Cfg.PublicDashboardsEnabled,
|
PublicDashboardsEnabled: hs.Cfg.PublicDashboardsEnabled,
|
||||||
CloudMigrationIsTarget: isCloudMigrationTarget,
|
CloudMigrationIsTarget: isCloudMigrationTarget,
|
||||||
CloudMigrationFeedbackURL: hs.Cfg.CloudMigration.FeedbackURL,
|
CloudMigrationFeedbackURL: hs.Cfg.CloudMigration.FeedbackURL,
|
||||||
|
CloudMigrationPollIntervalMs: int(hs.Cfg.CloudMigration.FrontendPollInterval.Milliseconds()),
|
||||||
SharedWithMeFolderUID: folder.SharedWithMeFolderUID,
|
SharedWithMeFolderUID: folder.SharedWithMeFolderUID,
|
||||||
RootFolderUID: accesscontrol.GeneralFolderUID,
|
RootFolderUID: accesscontrol.GeneralFolderUID,
|
||||||
LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable,
|
LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ type CloudMigrationSettings struct {
|
|||||||
DeleteTokenTimeout time.Duration
|
DeleteTokenTimeout time.Duration
|
||||||
TokenExpiresAfter time.Duration
|
TokenExpiresAfter time.Duration
|
||||||
FeedbackURL string
|
FeedbackURL string
|
||||||
|
FrontendPollInterval time.Duration
|
||||||
|
|
||||||
IsDeveloperMode bool
|
IsDeveloperMode bool
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,7 @@ func (cfg *Cfg) readCloudMigrationSettings() {
|
|||||||
cfg.CloudMigration.TokenExpiresAfter = cloudMigration.Key("token_expires_after").MustDuration(7 * 24 * time.Hour)
|
cfg.CloudMigration.TokenExpiresAfter = cloudMigration.Key("token_expires_after").MustDuration(7 * 24 * time.Hour)
|
||||||
cfg.CloudMigration.IsDeveloperMode = cloudMigration.Key("developer_mode").MustBool(false)
|
cfg.CloudMigration.IsDeveloperMode = cloudMigration.Key("developer_mode").MustBool(false)
|
||||||
cfg.CloudMigration.FeedbackURL = cloudMigration.Key("feedback_url").MustString("")
|
cfg.CloudMigration.FeedbackURL = cloudMigration.Key("feedback_url").MustString("")
|
||||||
|
cfg.CloudMigration.FrontendPollInterval = cloudMigration.Key("frontend_poll_interval").MustDuration(2 * time.Second)
|
||||||
|
|
||||||
if cfg.CloudMigration.SnapshotFolder == "" {
|
if cfg.CloudMigration.SnapshotFolder == "" {
|
||||||
cfg.CloudMigration.SnapshotFolder = filepath.Join(cfg.DataPath, "cloud_migration")
|
cfg.CloudMigration.SnapshotFolder = filepath.Join(cfg.DataPath, "cloud_migration")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { skipToken } from '@reduxjs/toolkit/query/react';
|
import { skipToken } from '@reduxjs/toolkit/query/react';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { AlertVariant, Box, Stack, Text } from '@grafana/ui';
|
import { AlertVariant, Box, Stack, Text } from '@grafana/ui';
|
||||||
import { Trans, t } from 'app/core/internationalization';
|
import { Trans, t } from 'app/core/internationalization';
|
||||||
|
|
||||||
@@ -62,8 +63,6 @@ const SNAPSHOT_REBUILD_STATUSES: Array<SnapshotDto['status']> = ['PENDING_UPLOAD
|
|||||||
const SNAPSHOT_BUILDING_STATUSES: Array<SnapshotDto['status']> = ['INITIALIZING', 'CREATING'];
|
const SNAPSHOT_BUILDING_STATUSES: Array<SnapshotDto['status']> = ['INITIALIZING', 'CREATING'];
|
||||||
const SNAPSHOT_UPLOADING_STATUSES: Array<SnapshotDto['status']> = ['UPLOADING', 'PENDING_PROCESSING', 'PROCESSING'];
|
const SNAPSHOT_UPLOADING_STATUSES: Array<SnapshotDto['status']> = ['UPLOADING', 'PENDING_PROCESSING', 'PROCESSING'];
|
||||||
|
|
||||||
const STATUS_POLL_INTERVAL = 5 * 1000;
|
|
||||||
|
|
||||||
const PAGE_SIZE = 50;
|
const PAGE_SIZE = 50;
|
||||||
|
|
||||||
function useGetLatestSnapshot(sessionUid?: string, page = 1) {
|
function useGetLatestSnapshot(sessionUid?: string, page = 1) {
|
||||||
@@ -78,7 +77,7 @@ function useGetLatestSnapshot(sessionUid?: string, page = 1) {
|
|||||||
: skipToken;
|
: skipToken;
|
||||||
|
|
||||||
const snapshotResult = useGetSnapshotQuery(getSnapshotQueryArgs, {
|
const snapshotResult = useGetSnapshotQuery(getSnapshotQueryArgs, {
|
||||||
pollingInterval: shouldPoll ? STATUS_POLL_INTERVAL : 0,
|
pollingInterval: shouldPoll ? config.cloudMigrationPollIntervalMs : 0,
|
||||||
skipPollingIfUnfocused: true,
|
skipPollingIfUnfocused: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user