diff --git a/.gitignore b/.gitignore index 5107685692..080a49ae37 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ e2e/.auth # go vendor/ **/main/** +__debug_bin** # git-town .git-branches.toml diff --git a/conf/example.yaml b/conf/example.yaml index fbda035d8d..7c9f285da5 100644 --- a/conf/example.yaml +++ b/conf/example.yaml @@ -207,3 +207,11 @@ emailing: key_file_path: # The path to the certificate file. cert_file_path: + +##################### Sharder (experimental) ##################### +sharder: + # Specifies the sharder provider to use. + provider: noop + single: + # The org id to which this instance belongs to. + org_id: org_id diff --git a/deploy/docker-swarm/docker-compose.ha.yaml b/deploy/docker-swarm/docker-compose.ha.yaml index 13cad71701..0cc33f9fd1 100644 --- a/deploy/docker-swarm/docker-compose.ha.yaml +++ b/deploy/docker-swarm/docker-compose.ha.yaml @@ -174,7 +174,7 @@ services: # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml signoz: !!merge <<: *db-depend - image: signoz/signoz:v0.85.2 + image: signoz/signoz:v0.85.3 command: - --config=/root/config/prometheus.yml ports: diff --git a/deploy/docker-swarm/docker-compose.yaml b/deploy/docker-swarm/docker-compose.yaml index 0d26fb0069..be0ad76206 100644 --- a/deploy/docker-swarm/docker-compose.yaml +++ b/deploy/docker-swarm/docker-compose.yaml @@ -110,7 +110,7 @@ services: # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml signoz: !!merge <<: *db-depend - image: signoz/signoz:v0.85.2 + image: signoz/signoz:v0.85.3 command: - --config=/root/config/prometheus.yml ports: diff --git a/deploy/docker/docker-compose.ha.yaml b/deploy/docker/docker-compose.ha.yaml index fb06f54313..10de62b504 100644 --- a/deploy/docker/docker-compose.ha.yaml +++ b/deploy/docker/docker-compose.ha.yaml @@ -177,7 +177,7 @@ services: # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml signoz: !!merge <<: *db-depend - image: signoz/signoz:${VERSION:-v0.85.2} + image: signoz/signoz:${VERSION:-v0.85.3} container_name: signoz command: - --config=/root/config/prometheus.yml diff --git a/deploy/docker/docker-compose.yaml b/deploy/docker/docker-compose.yaml index d1b15a921e..24e9956ebc 100644 --- a/deploy/docker/docker-compose.yaml +++ b/deploy/docker/docker-compose.yaml @@ -110,7 +110,7 @@ services: # - ../common/clickhouse/storage.xml:/etc/clickhouse-server/config.d/storage.xml signoz: !!merge <<: *db-depend - image: signoz/signoz:${VERSION:-v0.85.2} + image: signoz/signoz:${VERSION:-v0.85.3} container_name: signoz command: - --config=/root/config/prometheus.yml diff --git a/ee/licensing/httplicensing/provider.go b/ee/licensing/httplicensing/provider.go index 0c63ff295b..1cfdad4d37 100644 --- a/ee/licensing/httplicensing/provider.go +++ b/ee/licensing/httplicensing/provider.go @@ -5,10 +5,13 @@ import ( "encoding/json" "time" + "github.com/SigNoz/signoz/ee/query-service/constants" + "github.com/SigNoz/signoz/ee/licensing/licensingstore/sqllicensingstore" "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/licensing" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types/featuretypes" "github.com/SigNoz/signoz/pkg/types/licensetypes" @@ -18,23 +21,31 @@ import ( ) type provider struct { - store licensetypes.Store - zeus zeus.Zeus - config licensing.Config - settings factory.ScopedProviderSettings - stopChan chan struct{} + store licensetypes.Store + zeus zeus.Zeus + config licensing.Config + settings factory.ScopedProviderSettings + orgGetter organization.Getter + stopChan chan struct{} } -func NewProviderFactory(store sqlstore.SQLStore, zeus zeus.Zeus) factory.ProviderFactory[licensing.Licensing, licensing.Config] { +func NewProviderFactory(store sqlstore.SQLStore, zeus zeus.Zeus, orgGetter organization.Getter) factory.ProviderFactory[licensing.Licensing, licensing.Config] { return factory.NewProviderFactory(factory.MustNewName("http"), func(ctx context.Context, providerSettings factory.ProviderSettings, config licensing.Config) (licensing.Licensing, error) { - return New(ctx, providerSettings, config, store, zeus) + return New(ctx, providerSettings, config, store, zeus, orgGetter) }) } -func New(ctx context.Context, ps factory.ProviderSettings, config licensing.Config, sqlstore sqlstore.SQLStore, zeus zeus.Zeus) (licensing.Licensing, error) { +func New(ctx context.Context, ps factory.ProviderSettings, config licensing.Config, sqlstore sqlstore.SQLStore, zeus zeus.Zeus, orgGetter organization.Getter) (licensing.Licensing, error) { settings := factory.NewScopedProviderSettings(ps, "github.com/SigNoz/signoz/ee/licensing/httplicensing") licensestore := sqllicensingstore.New(sqlstore) - return &provider{store: licensestore, zeus: zeus, config: config, settings: settings, stopChan: make(chan struct{})}, nil + return &provider{ + store: licensestore, + zeus: zeus, + config: config, + settings: settings, + orgGetter: orgGetter, + stopChan: make(chan struct{}), + }, nil } func (provider *provider) Start(ctx context.Context) error { @@ -66,13 +77,13 @@ func (provider *provider) Stop(ctx context.Context) error { } func (provider *provider) Validate(ctx context.Context) error { - organizations, err := provider.store.ListOrganizations(ctx) + organizations, err := provider.orgGetter.ListByOwnedKeyRange(ctx) if err != nil { return err } - for _, organizationID := range organizations { - err := provider.Refresh(ctx, organizationID) + for _, organization := range organizations { + err := provider.Refresh(ctx, organization.ID) if err != nil { return err } @@ -167,6 +178,11 @@ func (provider *provider) Refresh(ctx context.Context, organizationID valuer.UUI return err } + err = provider.InitFeatures(ctx, activeLicense.Features) + if err != nil { + return err + } + return nil } @@ -251,6 +267,13 @@ func (provider *provider) GetFeatureFlags(ctx context.Context) ([]*featuretypes. } } + if constants.IsDotMetricsEnabled { + gettableFeatures = append(gettableFeatures, &featuretypes.GettableFeature{ + Name: featuretypes.DotMetricsEnabled, + Active: true, + }) + } + return gettableFeatures, nil } diff --git a/ee/licensing/licensingstore/sqllicensingstore/store.go b/ee/licensing/licensingstore/sqllicensingstore/store.go index 5167a5fc00..9e8ea19d71 100644 --- a/ee/licensing/licensingstore/sqllicensingstore/store.go +++ b/ee/licensing/licensingstore/sqllicensingstore/store.go @@ -5,7 +5,6 @@ import ( "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/featuretypes" "github.com/SigNoz/signoz/pkg/types/licensetypes" "github.com/SigNoz/signoz/pkg/valuer" @@ -82,31 +81,6 @@ func (store *store) Update(ctx context.Context, organizationID valuer.UUID, stor return nil } -func (store *store) ListOrganizations(ctx context.Context) ([]valuer.UUID, error) { - orgIDStrs := make([]string, 0) - err := store.sqlstore. - BunDB(). - NewSelect(). - Model(new(types.Organization)). - Column("id"). - Scan(ctx, &orgIDStrs) - if err != nil { - return nil, err - } - - orgIDs := make([]valuer.UUID, len(orgIDStrs)) - for idx, orgIDStr := range orgIDStrs { - orgID, err := valuer.NewUUID(orgIDStr) - if err != nil { - return nil, err - } - orgIDs[idx] = orgID - } - - return orgIDs, nil - -} - func (store *store) CreateFeature(ctx context.Context, storableFeature *featuretypes.StorableFeature) error { _, err := store. sqlstore. diff --git a/ee/query-service/app/api/api.go b/ee/query-service/app/api/api.go index 40a28944da..15042a4d95 100644 --- a/ee/query-service/app/api/api.go +++ b/ee/query-service/app/api/api.go @@ -96,13 +96,7 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) { // note: add ee override methods first // routes available only in ee version - router.HandleFunc("/api/v1/featureFlags", am.OpenAccess(ah.getFeatureFlags)).Methods(http.MethodGet) - router.HandleFunc("/api/v1/loginPrecheck", am.OpenAccess(ah.Signoz.Handlers.User.LoginPrecheck)).Methods(http.MethodGet) - - // invite - router.HandleFunc("/api/v1/invite/{token}", am.OpenAccess(ah.Signoz.Handlers.User.GetInvite)).Methods(http.MethodGet) - router.HandleFunc("/api/v1/invite/accept", am.OpenAccess(ah.Signoz.Handlers.User.AcceptInvite)).Methods(http.MethodPost) // paid plans specific routes router.HandleFunc("/api/v1/complete/saml", am.OpenAccess(ah.receiveSAML)).Methods(http.MethodPost) @@ -114,9 +108,6 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) { router.HandleFunc("/api/v1/billing", am.AdminAccess(ah.getBilling)).Methods(http.MethodGet) router.HandleFunc("/api/v1/portal", am.AdminAccess(ah.LicensingAPI.Portal)).Methods(http.MethodPost) - router.HandleFunc("/api/v1/dashboards/{uuid}/lock", am.EditAccess(ah.lockDashboard)).Methods(http.MethodPut) - router.HandleFunc("/api/v1/dashboards/{uuid}/unlock", am.EditAccess(ah.unlockDashboard)).Methods(http.MethodPut) - // v3 router.HandleFunc("/api/v3/licenses", am.AdminAccess(ah.LicensingAPI.Activate)).Methods(http.MethodPost) router.HandleFunc("/api/v3/licenses", am.AdminAccess(ah.LicensingAPI.Refresh)).Methods(http.MethodPut) diff --git a/ee/query-service/app/api/dashboard.go b/ee/query-service/app/api/dashboard.go deleted file mode 100644 index a0e30ecf8c..0000000000 --- a/ee/query-service/app/api/dashboard.go +++ /dev/null @@ -1,62 +0,0 @@ -package api - -import ( - "net/http" - "strings" - - "github.com/SigNoz/signoz/pkg/errors" - "github.com/SigNoz/signoz/pkg/http/render" - "github.com/SigNoz/signoz/pkg/types/authtypes" - "github.com/gorilla/mux" -) - -func (ah *APIHandler) lockDashboard(w http.ResponseWriter, r *http.Request) { - ah.lockUnlockDashboard(w, r, true) -} - -func (ah *APIHandler) unlockDashboard(w http.ResponseWriter, r *http.Request) { - ah.lockUnlockDashboard(w, r, false) -} - -func (ah *APIHandler) lockUnlockDashboard(w http.ResponseWriter, r *http.Request, lock bool) { - // Locking can only be done by the owner of the dashboard - // or an admin - - // - Fetch the dashboard - // - Check if the user is the owner or an admin - // - If yes, lock/unlock the dashboard - // - If no, return 403 - - // Get the dashboard UUID from the request - uuid := mux.Vars(r)["uuid"] - if strings.HasPrefix(uuid, "integration") { - render.Error(w, errors.Newf(errors.TypeForbidden, errors.CodeForbidden, "dashboards created by integrations cannot be modified")) - return - } - - claims, err := authtypes.ClaimsFromContext(r.Context()) - if err != nil { - render.Error(w, errors.Newf(errors.TypeUnauthenticated, errors.CodeUnauthenticated, "unauthenticated")) - return - } - - dashboard, err := ah.Signoz.Modules.Dashboard.Get(r.Context(), claims.OrgID, uuid) - if err != nil { - render.Error(w, err) - return - } - - if err := claims.IsAdmin(); err != nil && (dashboard.CreatedBy != claims.Email) { - render.Error(w, errors.Newf(errors.TypeForbidden, errors.CodeForbidden, "You are not authorized to lock/unlock this dashboard")) - return - } - - // Lock/Unlock the dashboard - err = ah.Signoz.Modules.Dashboard.LockUnlock(r.Context(), claims.OrgID, uuid, lock) - if err != nil { - render.Error(w, err) - return - } - - ah.Respond(w, "Dashboard updated successfully") -} diff --git a/ee/query-service/app/server.go b/ee/query-service/app/server.go index 84f3f4a7f4..2b4d3754c6 100644 --- a/ee/query-service/app/server.go +++ b/ee/query-service/app/server.go @@ -20,6 +20,7 @@ import ( "github.com/SigNoz/signoz/pkg/alertmanager" "github.com/SigNoz/signoz/pkg/cache" "github.com/SigNoz/signoz/pkg/http/middleware" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/prometheus" "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/sqlstore" @@ -113,6 +114,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { serverOptions.SigNoz.SQLStore, serverOptions.SigNoz.TelemetryStore, serverOptions.SigNoz.Prometheus, + serverOptions.SigNoz.Modules.OrgGetter, ) if err != nil { @@ -157,7 +159,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { } // start the usagemanager - usageManager, err := usage.New(serverOptions.SigNoz.Licensing, serverOptions.SigNoz.TelemetryStore.ClickhouseDB(), serverOptions.SigNoz.Zeus, serverOptions.SigNoz.Modules.Organization) + usageManager, err := usage.New(serverOptions.SigNoz.Licensing, serverOptions.SigNoz.TelemetryStore.ClickhouseDB(), serverOptions.SigNoz.Zeus, serverOptions.SigNoz.Modules.OrgGetter) if err != nil { return nil, err } @@ -225,7 +227,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { &opAmpModel.AllAgents, agentConfMgr, ) - orgs, err := apiHandler.Signoz.Modules.Organization.GetAll(context.Background()) + orgs, err := apiHandler.Signoz.Modules.OrgGetter.ListByOwnedKeyRange(context.Background()) if err != nil { return nil, err } @@ -240,11 +242,10 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { } func (s *Server) createPrivateServer(apiHandler *api.APIHandler) (*http.Server, error) { - r := baseapp.NewRouter() - r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) - r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, s.serverOptions.SigNoz.Sharder, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.SigNoz.Sharder).Wrap) r.Use(middleware.NewTimeout(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Timeout.ExcludedRoutes, s.serverOptions.Config.APIServer.Timeout.Default, @@ -275,8 +276,8 @@ func (s *Server) createPublicServer(apiHandler *api.APIHandler, web web.Web) (*h r := baseapp.NewRouter() am := middleware.NewAuthZ(s.serverOptions.SigNoz.Instrumentation.Logger()) - r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) - r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, s.serverOptions.SigNoz.Sharder, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.SigNoz.Sharder).Wrap) r.Use(middleware.NewTimeout(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Timeout.ExcludedRoutes, s.serverOptions.Config.APIServer.Timeout.Default, @@ -297,6 +298,7 @@ func (s *Server) createPublicServer(apiHandler *api.APIHandler, web web.Web) (*h apiHandler.RegisterMessagingQueuesRoutes(r, am) apiHandler.RegisterThirdPartyApiRoutes(r, am) apiHandler.MetricExplorerRoutes(r, am) + apiHandler.RegisterTraceFunnelsRoutes(r, am) c := cors.New(cors.Options{ AllowedOrigins: []string{"*"}, @@ -450,6 +452,7 @@ func makeRulesManager( sqlstore sqlstore.SQLStore, telemetryStore telemetrystore.TelemetryStore, prometheus prometheus.Prometheus, + orgGetter organization.Getter, ) (*baserules.Manager, error) { // create manager opts managerOpts := &baserules.ManagerOptions{ @@ -465,6 +468,7 @@ func makeRulesManager( PrepareTestRuleFunc: rules.TestNotification, Alertmanager: alertmanager, SQLStore: sqlstore, + OrgGetter: orgGetter, } // create Manager diff --git a/ee/query-service/constants/constants.go b/ee/query-service/constants/constants.go index ff04ff0246..c2d77252ff 100644 --- a/ee/query-service/constants/constants.go +++ b/ee/query-service/constants/constants.go @@ -4,6 +4,10 @@ import ( "os" ) +const ( + DefaultSiteURL = "https://localhost:8080" +) + var LicenseSignozIo = "https://license.signoz.io/api/v1" var LicenseAPIKey = GetOrDefaultEnv("SIGNOZ_LICENSE_API_KEY", "") var SaasSegmentKey = GetOrDefaultEnv("SIGNOZ_SAAS_SEGMENT_KEY", "") @@ -20,3 +24,22 @@ func GetOrDefaultEnv(key string, fallback string) string { } return v } + +// constant functions that override env vars + +// GetDefaultSiteURL returns default site url, primarily +// used to send saml request and allowing backend to +// handle http redirect +func GetDefaultSiteURL() string { + return GetOrDefaultEnv("SIGNOZ_SITE_URL", DefaultSiteURL) +} + +const DotMetricsEnabled = "DOT_METRICS_ENABLED" + +var IsDotMetricsEnabled = false + +func init() { + if GetOrDefaultEnv(DotMetricsEnabled, "false") == "true" { + IsDotMetricsEnabled = true + } +} diff --git a/ee/query-service/main.go b/ee/query-service/main.go index 996b2ac0eb..6d9c3eeaf4 100644 --- a/ee/query-service/main.go +++ b/ee/query-service/main.go @@ -17,6 +17,7 @@ import ( "github.com/SigNoz/signoz/pkg/config/fileprovider" "github.com/SigNoz/signoz/pkg/factory" pkglicensing "github.com/SigNoz/signoz/pkg/licensing" + "github.com/SigNoz/signoz/pkg/modules/organization" baseconst "github.com/SigNoz/signoz/pkg/query-service/constants" "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/sqlstore" @@ -133,8 +134,8 @@ func main() { zeus.Config(), httpzeus.NewProviderFactory(), licensing.Config(24*time.Hour, 3), - func(sqlstore sqlstore.SQLStore, zeus pkgzeus.Zeus) factory.ProviderFactory[pkglicensing.Licensing, pkglicensing.Config] { - return httplicensing.NewProviderFactory(sqlstore, zeus) + func(sqlstore sqlstore.SQLStore, zeus pkgzeus.Zeus, orgGetter organization.Getter) factory.ProviderFactory[pkglicensing.Licensing, pkglicensing.Config] { + return httplicensing.NewProviderFactory(sqlstore, zeus, orgGetter) }, signoz.NewEmailingProviderFactories(), signoz.NewCacheProviderFactories(), diff --git a/ee/query-service/usage/manager.go b/ee/query-service/usage/manager.go index c7ab151f80..ad8c8ec4ba 100644 --- a/ee/query-service/usage/manager.go +++ b/ee/query-service/usage/manager.go @@ -41,16 +41,16 @@ type Manager struct { zeus zeus.Zeus - organizationModule organization.Module + orgGetter organization.Getter } -func New(licenseService licensing.Licensing, clickhouseConn clickhouse.Conn, zeus zeus.Zeus, organizationModule organization.Module) (*Manager, error) { +func New(licenseService licensing.Licensing, clickhouseConn clickhouse.Conn, zeus zeus.Zeus, orgGetter organization.Getter) (*Manager, error) { m := &Manager{ - clickhouseConn: clickhouseConn, - licenseService: licenseService, - scheduler: gocron.NewScheduler(time.UTC).Every(1).Day().At("00:00"), // send usage every at 00:00 UTC - zeus: zeus, - organizationModule: organizationModule, + clickhouseConn: clickhouseConn, + licenseService: licenseService, + scheduler: gocron.NewScheduler(time.UTC).Every(1).Day().At("00:00"), // send usage every at 00:00 UTC + zeus: zeus, + orgGetter: orgGetter, } return m, nil } @@ -74,8 +74,7 @@ func (lm *Manager) Start(ctx context.Context) error { return nil } func (lm *Manager) UploadUsage(ctx context.Context) { - - organizations, err := lm.organizationModule.GetAll(context.Background()) + organizations, err := lm.orgGetter.ListByOwnedKeyRange(ctx) if err != nil { zap.L().Error("failed to get organizations", zap.Error(err)) return diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index a97fd7e933..32ccafa838 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -28,6 +28,7 @@ import { QueryBuilderProvider } from 'providers/QueryBuilder'; import { Suspense, useCallback, useEffect, useState } from 'react'; import { Route, Router, Switch } from 'react-router-dom'; import { CompatRouter } from 'react-router-dom-v5-compat'; +import { LicenseStatus } from 'types/api/licensesV3/getActive'; import { Userpilot } from 'userpilot'; import { extractDomain } from 'utils/app'; @@ -171,11 +172,13 @@ function App(): JSX.Element { user && !!user.email ) { + // either the active API returns error with 404 or 501 and if it returns a terminated license means it's on basic plan const isOnBasicPlan = - activeLicenseFetchError && - [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes( - activeLicenseFetchError?.getHttpStatusCode(), - ); + (activeLicenseFetchError && + [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes( + activeLicenseFetchError?.getHttpStatusCode(), + )) || + (activeLicense?.status && activeLicense.status === LicenseStatus.INVALID); const isIdentifiedUser = getLocalStorageApi(LOCALSTORAGE.IS_IDENTIFIED_USER); if (isLoggedInState && user && user.id && user.email && !isIdentifiedUser) { @@ -190,6 +193,10 @@ function App(): JSX.Element { updatedRoutes = updatedRoutes.filter( (route) => route?.path !== ROUTES.BILLING, ); + + if (isEnterpriseSelfHostedUser) { + updatedRoutes.push(LIST_LICENSES); + } } // always add support route for cloud users updatedRoutes = [...updatedRoutes, SUPPORT_ROUTE]; diff --git a/frontend/src/api/dashboard/create.ts b/frontend/src/api/dashboard/create.ts deleted file mode 100644 index bf5458ac40..0000000000 --- a/frontend/src/api/dashboard/create.ts +++ /dev/null @@ -1,27 +0,0 @@ -import axios from 'api'; -import { ErrorResponseHandler } from 'api/ErrorResponseHandler'; -import { AxiosError } from 'axios'; -import { ErrorResponse, SuccessResponse } from 'types/api'; -import { PayloadProps, Props } from 'types/api/dashboard/create'; - -const createDashboard = async ( - props: Props, -): Promise | ErrorResponse> => { - const url = props.uploadedGrafana ? '/dashboards/grafana' : '/dashboards'; - try { - const response = await axios.post(url, { - ...props, - }); - - return { - statusCode: 200, - error: null, - message: response.data.status, - payload: response.data.data, - }; - } catch (error) { - return ErrorResponseHandler(error as AxiosError); - } -}; - -export default createDashboard; diff --git a/frontend/src/api/dashboard/delete.ts b/frontend/src/api/dashboard/delete.ts deleted file mode 100644 index 8faf711383..0000000000 --- a/frontend/src/api/dashboard/delete.ts +++ /dev/null @@ -1,9 +0,0 @@ -import axios from 'api'; -import { PayloadProps, Props } from 'types/api/dashboard/delete'; - -const deleteDashboard = (props: Props): Promise => - axios - .delete(`/dashboards/${props.uuid}`) - .then((response) => response.data); - -export default deleteDashboard; diff --git a/frontend/src/api/dashboard/get.ts b/frontend/src/api/dashboard/get.ts deleted file mode 100644 index 01e04c6c0f..0000000000 --- a/frontend/src/api/dashboard/get.ts +++ /dev/null @@ -1,11 +0,0 @@ -import axios from 'api'; -import { ApiResponse } from 'types/api'; -import { Props } from 'types/api/dashboard/get'; -import { Dashboard } from 'types/api/dashboard/getAll'; - -const getDashboard = (props: Props): Promise => - axios - .get>(`/dashboards/${props.uuid}`) - .then((res) => res.data.data); - -export default getDashboard; diff --git a/frontend/src/api/dashboard/getAll.ts b/frontend/src/api/dashboard/getAll.ts deleted file mode 100644 index aafe44b3ed..0000000000 --- a/frontend/src/api/dashboard/getAll.ts +++ /dev/null @@ -1,8 +0,0 @@ -import axios from 'api'; -import { ApiResponse } from 'types/api'; -import { Dashboard } from 'types/api/dashboard/getAll'; - -export const getAllDashboardList = (): Promise => - axios - .get>('/dashboards') - .then((res) => res.data.data); diff --git a/frontend/src/api/dashboard/lockDashboard.ts b/frontend/src/api/dashboard/lockDashboard.ts deleted file mode 100644 index 3393de8fa3..0000000000 --- a/frontend/src/api/dashboard/lockDashboard.ts +++ /dev/null @@ -1,11 +0,0 @@ -import axios from 'api'; -import { AxiosResponse } from 'axios'; - -interface LockDashboardProps { - uuid: string; -} - -const lockDashboard = (props: LockDashboardProps): Promise => - axios.put(`/dashboards/${props.uuid}/lock`); - -export default lockDashboard; diff --git a/frontend/src/api/dashboard/unlockDashboard.ts b/frontend/src/api/dashboard/unlockDashboard.ts deleted file mode 100644 index fd4ffbe41a..0000000000 --- a/frontend/src/api/dashboard/unlockDashboard.ts +++ /dev/null @@ -1,11 +0,0 @@ -import axios from 'api'; -import { AxiosResponse } from 'axios'; - -interface UnlockDashboardProps { - uuid: string; -} - -const unlockDashboard = (props: UnlockDashboardProps): Promise => - axios.put(`/dashboards/${props.uuid}/unlock`); - -export default unlockDashboard; diff --git a/frontend/src/api/dashboard/update.ts b/frontend/src/api/dashboard/update.ts deleted file mode 100644 index 21216e051f..0000000000 --- a/frontend/src/api/dashboard/update.ts +++ /dev/null @@ -1,20 +0,0 @@ -import axios from 'api'; -import { ErrorResponse, SuccessResponse } from 'types/api'; -import { PayloadProps, Props } from 'types/api/dashboard/update'; - -const updateDashboard = async ( - props: Props, -): Promise | ErrorResponse> => { - const response = await axios.put(`/dashboards/${props.uuid}`, { - ...props.data, - }); - - return { - statusCode: 200, - error: null, - message: response.data.status, - payload: response.data.data, - }; -}; - -export default updateDashboard; diff --git a/frontend/src/api/infraMonitoring/getK8sClustersList.ts b/frontend/src/api/infraMonitoring/getK8sClustersList.ts index 2da1b214b3..b08090ed2a 100644 --- a/frontend/src/api/infraMonitoring/getK8sClustersList.ts +++ b/frontend/src/api/infraMonitoring/getK8sClustersList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sClustersListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -40,23 +42,80 @@ export interface K8sClustersListResponse { }; } +export const clustersMetaMap = [ + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, + { dot: 'k8s.cluster.uid', under: 'k8s_cluster_uid' }, +] as const; + +export function mapClustersMeta( + raw: Record, +): K8sClustersData['meta'] { + const out: Record = { ...raw }; + clustersMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sClustersData['meta']; +} + export const getK8sClustersList = async ( props: K8sClustersListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/clusters/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/clusters/list', requestProps, { signal, headers, }); + const payload: K8sClustersListResponse = response.data; + + // one-liner meta mapping + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapClustersMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts b/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts index c09de10580..a35f8871ec 100644 --- a/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts +++ b/frontend/src/api/infraMonitoring/getK8sDaemonSetsList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sDaemonSetsListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -46,23 +48,82 @@ export interface K8sDaemonSetsListResponse { }; } +export const daemonSetsMetaMap = [ + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, + { dot: 'k8s.daemonset.name', under: 'k8s_daemonset_name' }, + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, +] as const; + +export function mapDaemonSetsMeta( + raw: Record, +): K8sDaemonSetsData['meta'] { + const out: Record = { ...raw }; + daemonSetsMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sDaemonSetsData['meta']; +} + export const getK8sDaemonSetsList = async ( props: K8sDaemonSetsListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/daemonsets/list', props, { + // filter prep (unchanged)… + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/daemonsets/list', requestProps, { signal, headers, }); + const payload: K8sDaemonSetsListResponse = response.data; + + // single-line meta mapping + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapDaemonSetsMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts index b991ce22e7..f39c62c88b 100644 --- a/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts +++ b/frontend/src/api/infraMonitoring/getK8sDeploymentsList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sDeploymentsListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -46,23 +48,81 @@ export interface K8sDeploymentsListResponse { }; } +export const deploymentsMetaMap = [ + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, + { dot: 'k8s.deployment.name', under: 'k8s_deployment_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, +] as const; + +export function mapDeploymentsMeta( + raw: Record, +): K8sDeploymentsData['meta'] { + const out: Record = { ...raw }; + deploymentsMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sDeploymentsData['meta']; +} + export const getK8sDeploymentsList = async ( props: K8sDeploymentsListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/deployments/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/deployments/list', requestProps, { signal, headers, }); + const payload: K8sDeploymentsListResponse = response.data; + + // single-line mapping + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapDeploymentsMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sJobsList.ts b/frontend/src/api/infraMonitoring/getK8sJobsList.ts index 36a6bb973d..828e42a79d 100644 --- a/frontend/src/api/infraMonitoring/getK8sJobsList.ts +++ b/frontend/src/api/infraMonitoring/getK8sJobsList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sJobsListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -48,23 +50,79 @@ export interface K8sJobsListResponse { }; } +export const jobsMetaMap = [ + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, + { dot: 'k8s.job.name', under: 'k8s_job_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, +] as const; + +export function mapJobsMeta(raw: Record): K8sJobsData['meta'] { + const out: Record = { ...raw }; + jobsMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sJobsData['meta']; +} + export const getK8sJobsList = async ( props: K8sJobsListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/jobs/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/jobs/list', requestProps, { signal, headers, }); + const payload: K8sJobsListResponse = response.data; + + // one-liner meta mapping + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapJobsMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts index bba2249f4e..a492aac045 100644 --- a/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts +++ b/frontend/src/api/infraMonitoring/getK8sNamespacesList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sNamespacesListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -38,23 +40,79 @@ export interface K8sNamespacesListResponse { }; } +export const namespacesMetaMap = [ + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, +] as const; + +export function mapNamespacesMeta( + raw: Record, +): K8sNamespacesData['meta'] { + const out: Record = { ...raw }; + namespacesMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sNamespacesData['meta']; +} + export const getK8sNamespacesList = async ( props: K8sNamespacesListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/namespaces/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/namespaces/list', requestProps, { signal, headers, }); + const payload: K8sNamespacesListResponse = response.data; + + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapNamespacesMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sNodesList.ts b/frontend/src/api/infraMonitoring/getK8sNodesList.ts index 71228b030b..d0045f4820 100644 --- a/frontend/src/api/infraMonitoring/getK8sNodesList.ts +++ b/frontend/src/api/infraMonitoring/getK8sNodesList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sNodesListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -41,23 +43,81 @@ export interface K8sNodesListResponse { }; } +export const nodesMetaMap = [ + { dot: 'k8s.node.name', under: 'k8s_node_name' }, + { dot: 'k8s.node.uid', under: 'k8s_node_uid' }, + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, +] as const; + +export function mapNodesMeta( + raw: Record, +): K8sNodesData['meta'] { + const out: Record = { ...raw }; + nodesMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sNodesData['meta']; +} + export const getK8sNodesList = async ( props: K8sNodesListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/nodes/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/nodes/list', requestProps, { signal, headers, }); + const payload: K8sNodesListResponse = response.data; + + // one-liner to map dot→underscore + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapNodesMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sPodsList.ts b/frontend/src/api/infraMonitoring/getK8sPodsList.ts index 05258ef166..560788285f 100644 --- a/frontend/src/api/infraMonitoring/getK8sPodsList.ts +++ b/frontend/src/api/infraMonitoring/getK8sPodsList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sPodsListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -69,23 +71,87 @@ export interface K8sPodsListResponse { }; } +export const podsMetaMap = [ + { dot: 'k8s.cronjob.name', under: 'k8s_cronjob_name' }, + { dot: 'k8s.daemonset.name', under: 'k8s_daemonset_name' }, + { dot: 'k8s.deployment.name', under: 'k8s_deployment_name' }, + { dot: 'k8s.job.name', under: 'k8s_job_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, + { dot: 'k8s.node.name', under: 'k8s_node_name' }, + { dot: 'k8s.pod.name', under: 'k8s_pod_name' }, + { dot: 'k8s.pod.uid', under: 'k8s_pod_uid' }, + { dot: 'k8s.statefulset.name', under: 'k8s_statefulset_name' }, + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, +] as const; + +export function mapPodsMeta(raw: Record): K8sPodsData['meta'] { + // clone everything + const out: Record = { ...raw }; + // overlay only the dot→under mappings + podsMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sPodsData['meta']; +} + +// getK8sPodsList export const getK8sPodsList = async ( props: K8sPodsListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/pods/list', props, { + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ + ...item, + key: { ...item.key, key: mappedKey }, + }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/pods/list', requestProps, { signal, headers, }); + const payload: K8sPodsListResponse = response.data; + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapPodsMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getK8sVolumesList.ts b/frontend/src/api/infraMonitoring/getK8sVolumesList.ts index ea825ba05d..2089e5cd59 100644 --- a/frontend/src/api/infraMonitoring/getK8sVolumesList.ts +++ b/frontend/src/api/infraMonitoring/getK8sVolumesList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sVolumesListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -47,23 +49,92 @@ export interface K8sVolumesListResponse { }; } +export const volumesMetaMap: Array<{ + dot: keyof Record; + under: keyof K8sVolumesData['meta']; +}> = [ + { dot: 'k8s.cluster.name', under: 'k8s_cluster_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, + { dot: 'k8s.node.name', under: 'k8s_node_name' }, + { + dot: 'k8s.persistentvolumeclaim.name', + under: 'k8s_persistentvolumeclaim_name', + }, + { dot: 'k8s.pod.name', under: 'k8s_pod_name' }, + { dot: 'k8s.pod.uid', under: 'k8s_pod_uid' }, + { dot: 'k8s.statefulset.name', under: 'k8s_statefulset_name' }, +]; + +export function mapVolumesMeta( + rawMeta: Record, +): K8sVolumesData['meta'] { + // start with everything that was already there + const out: Record = { ...rawMeta }; + + // for each dot→under rule, if the raw has the dot, overwrite the underscore + volumesMetaMap.forEach(({ dot, under }) => { + if (dot in rawMeta) { + const val = rawMeta[dot]; + out[under] = typeof val === 'string' ? val : rawMeta[under]; + } + }); + + return out as K8sVolumesData['meta']; +} + export const getK8sVolumesList = async ( props: K8sVolumesListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/pvcs/list', props, { + // Prepare filters + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ ...item, key: { ...item.key, key: mappedKey } }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/pvcs/list', requestProps, { signal, headers, }); + const payload: K8sVolumesListResponse = response.data; + + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapVolumesMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts b/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts index 191ec069c3..2544c0cfe3 100644 --- a/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts +++ b/frontend/src/api/infraMonitoring/getsK8sStatefulSetsList.ts @@ -5,6 +5,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { TagFilter } from 'types/api/queryBuilder/queryBuilderData'; +import { UnderscoreToDotMap } from '../utils'; + export interface K8sStatefulSetsListPayload { filters: TagFilter; groupBy?: BaseAutocompleteData[]; @@ -45,23 +47,78 @@ export interface K8sStatefulSetsListResponse { }; } +export const statefulSetsMetaMap = [ + { dot: 'k8s.statefulset.name', under: 'k8s_statefulset_name' }, + { dot: 'k8s.namespace.name', under: 'k8s_namespace_name' }, +] as const; + +export function mapStatefulSetsMeta( + raw: Record, +): K8sStatefulSetsData['meta'] { + const out: Record = { ...raw }; + statefulSetsMetaMap.forEach(({ dot, under }) => { + if (dot in raw) { + const v = raw[dot]; + out[under] = typeof v === 'string' ? v : raw[under]; + } + }); + return out as K8sStatefulSetsData['meta']; +} + export const getK8sStatefulSetsList = async ( props: K8sStatefulSetsListPayload, signal?: AbortSignal, headers?: Record, + dotMetricsEnabled = false, ): Promise | ErrorResponse> => { try { - const response = await axios.post('/statefulsets/list', props, { + // Prepare filters + const requestProps = + dotMetricsEnabled && Array.isArray(props.filters?.items) + ? { + ...props, + filters: { + ...props.filters, + items: props.filters.items.reduce( + (acc, item) => { + if (item.value === undefined) return acc; + if ( + item.key && + typeof item.key === 'object' && + 'key' in item.key && + typeof item.key.key === 'string' + ) { + const mappedKey = UnderscoreToDotMap[item.key.key] ?? item.key.key; + acc.push({ ...item, key: { ...item.key, key: mappedKey } }); + } else { + acc.push(item); + } + return acc; + }, + [] as typeof props.filters.items, + ), + }, + } + : props; + + const response = await axios.post('/statefulsets/list', requestProps, { signal, headers, }); + const payload: K8sStatefulSetsListResponse = response.data; + + // apply our helper + payload.data.records = payload.data.records.map((record) => ({ + ...record, + meta: mapStatefulSetsMeta(record.meta as Record), + })); return { statusCode: 200, error: null, message: 'Success', - payload: response.data, - params: props, + payload, + params: requestProps, }; } catch (error) { return ErrorResponseHandler(error as AxiosError); diff --git a/frontend/src/api/utils.ts b/frontend/src/api/utils.ts index 95dfceb457..731b8e859a 100644 --- a/frontend/src/api/utils.ts +++ b/frontend/src/api/utils.ts @@ -17,3 +17,19 @@ export const Logout = (): void => { history.push(ROUTES.LOGIN); }; + +export const UnderscoreToDotMap: Record = { + k8s_cluster_name: 'k8s.cluster.name', + k8s_cluster_uid: 'k8s.cluster.uid', + k8s_namespace_name: 'k8s.namespace.name', + k8s_node_name: 'k8s.node.name', + k8s_node_uid: 'k8s.node.uid', + k8s_pod_name: 'k8s.pod.name', + k8s_pod_uid: 'k8s.pod.uid', + k8s_deployment_name: 'k8s.deployment.name', + k8s_daemonset_name: 'k8s.daemonset.name', + k8s_statefulset_name: 'k8s.statefulset.name', + k8s_cronjob_name: 'k8s.cronjob.name', + k8s_job_name: 'k8s.job.name', + k8s_persistentvolumeclaim_name: 'k8s.persistentvolumeclaim.name', +}; diff --git a/frontend/src/api/v1/dashboards/create.ts b/frontend/src/api/v1/dashboards/create.ts new file mode 100644 index 0000000000..1eb7bdc12e --- /dev/null +++ b/frontend/src/api/v1/dashboards/create.ts @@ -0,0 +1,23 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { PayloadProps, Props } from 'types/api/dashboard/create'; +import { Dashboard } from 'types/api/dashboard/getAll'; + +const create = async (props: Props): Promise> => { + try { + const response = await axios.post('/dashboards', { + ...props, + }); + + return { + httpStatusCode: response.status, + data: response.data.data, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default create; diff --git a/frontend/src/api/v1/dashboards/getAll.ts b/frontend/src/api/v1/dashboards/getAll.ts new file mode 100644 index 0000000000..7d89ef94f0 --- /dev/null +++ b/frontend/src/api/v1/dashboards/getAll.ts @@ -0,0 +1,19 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { Dashboard, PayloadProps } from 'types/api/dashboard/getAll'; + +const getAll = async (): Promise> => { + try { + const response = await axios.get('/dashboards'); + return { + httpStatusCode: response.status, + data: response.data.data, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default getAll; diff --git a/frontend/src/api/v1/dashboards/id/delete.ts b/frontend/src/api/v1/dashboards/id/delete.ts new file mode 100644 index 0000000000..e6c974df02 --- /dev/null +++ b/frontend/src/api/v1/dashboards/id/delete.ts @@ -0,0 +1,21 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { PayloadProps, Props } from 'types/api/dashboard/delete'; + +const deleteDashboard = async ( + props: Props, +): Promise> => { + try { + const response = await axios.delete(`/dashboards/${props.id}`); + return { + httpStatusCode: response.status, + data: null, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default deleteDashboard; diff --git a/frontend/src/api/v1/dashboards/id/get.ts b/frontend/src/api/v1/dashboards/id/get.ts new file mode 100644 index 0000000000..dfde573342 --- /dev/null +++ b/frontend/src/api/v1/dashboards/id/get.ts @@ -0,0 +1,20 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { PayloadProps, Props } from 'types/api/dashboard/get'; +import { Dashboard } from 'types/api/dashboard/getAll'; + +const get = async (props: Props): Promise> => { + try { + const response = await axios.get(`/dashboards/${props.id}`); + return { + httpStatusCode: response.status, + data: response.data.data, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default get; diff --git a/frontend/src/api/v1/dashboards/id/lock.ts b/frontend/src/api/v1/dashboards/id/lock.ts new file mode 100644 index 0000000000..289a4ddc99 --- /dev/null +++ b/frontend/src/api/v1/dashboards/id/lock.ts @@ -0,0 +1,23 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { PayloadProps, Props } from 'types/api/dashboard/lockUnlock'; + +const lock = async (props: Props): Promise> => { + try { + const response = await axios.put( + `/dashboards/${props.id}/lock`, + { lock: props.lock }, + ); + + return { + httpStatusCode: response.status, + data: response.data.data, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default lock; diff --git a/frontend/src/api/v1/dashboards/id/update.ts b/frontend/src/api/v1/dashboards/id/update.ts new file mode 100644 index 0000000000..82e98039bc --- /dev/null +++ b/frontend/src/api/v1/dashboards/id/update.ts @@ -0,0 +1,23 @@ +import axios from 'api'; +import { ErrorResponseHandlerV2 } from 'api/ErrorResponseHandlerV2'; +import { AxiosError } from 'axios'; +import { ErrorV2Resp, SuccessResponseV2 } from 'types/api'; +import { Dashboard } from 'types/api/dashboard/getAll'; +import { PayloadProps, Props } from 'types/api/dashboard/update'; + +const update = async (props: Props): Promise> => { + try { + const response = await axios.put(`/dashboards/${props.id}`, { + ...props.data, + }); + + return { + httpStatusCode: response.status, + data: response.data.data, + }; + } catch (error) { + ErrorResponseHandlerV2(error as AxiosError); + } +}; + +export default update; diff --git a/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx b/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx index cba11cdaa2..f7142ebb20 100644 --- a/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx +++ b/frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx @@ -23,6 +23,9 @@ import { useQueries, UseQueryResult } from 'react-query'; import { SuccessResponse } from 'types/api'; import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; + interface MetricsTabProps { timeRange: { startTime: number; @@ -45,9 +48,20 @@ function Metrics({ handleTimeChange, isModalTimeSelection, }: MetricsTabProps): JSX.Element { + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const queryPayloads = useMemo( - () => getHostQueryPayload(hostName, timeRange.startTime, timeRange.endTime), - [hostName, timeRange.startTime, timeRange.endTime], + () => + getHostQueryPayload( + hostName, + timeRange.startTime, + timeRange.endTime, + dotMetricsEnabled, + ), + [hostName, timeRange.startTime, timeRange.endTime, dotMetricsEnabled], ); const queries = useQueries( diff --git a/frontend/src/components/LogDetail/index.tsx b/frontend/src/components/LogDetail/index.tsx index b818823b5a..f6b5da802c 100644 --- a/frontend/src/components/LogDetail/index.tsx +++ b/frontend/src/components/LogDetail/index.tsx @@ -16,6 +16,7 @@ import JSONView from 'container/LogDetailedView/JsonView'; import Overview from 'container/LogDetailedView/Overview'; import { aggregateAttributesResourcesToString, + escapeHtml, removeEscapeCharacters, unescapeString, } from 'container/LogDetailedView/utils'; @@ -118,7 +119,7 @@ function LogDetail({ const htmlBody = useMemo( () => ({ __html: convert.toHtml( - dompurify.sanitize(unescapeString(log?.body || ''), { + dompurify.sanitize(unescapeString(escapeHtml(log?.body || '')), { FORBID_TAGS: [...FORBID_DOM_PURIFY_TAGS], }), ), diff --git a/frontend/src/components/Logs/ListLogView/index.tsx b/frontend/src/components/Logs/ListLogView/index.tsx index b30353696f..8526ce0be8 100644 --- a/frontend/src/components/Logs/ListLogView/index.tsx +++ b/frontend/src/components/Logs/ListLogView/index.tsx @@ -7,7 +7,7 @@ import cx from 'classnames'; import LogDetail from 'components/LogDetail'; import { VIEW_TYPES } from 'components/LogDetail/constants'; import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats'; -import { unescapeString } from 'container/LogDetailedView/utils'; +import { escapeHtml, unescapeString } from 'container/LogDetailedView/utils'; import { FontSize } from 'container/OptionsMenu/types'; import dompurify from 'dompurify'; import { useActiveLog } from 'hooks/logs/useActiveLog'; @@ -58,7 +58,7 @@ function LogGeneralField({ const html = useMemo( () => ({ __html: convert.toHtml( - dompurify.sanitize(unescapeString(fieldValue), { + dompurify.sanitize(unescapeString(escapeHtml(fieldValue)), { FORBID_TAGS: [...FORBID_DOM_PURIFY_TAGS], }), ), diff --git a/frontend/src/components/Logs/RawLogView/index.tsx b/frontend/src/components/Logs/RawLogView/index.tsx index 897dbe98a7..9a305904a6 100644 --- a/frontend/src/components/Logs/RawLogView/index.tsx +++ b/frontend/src/components/Logs/RawLogView/index.tsx @@ -5,7 +5,7 @@ import { DrawerProps } from 'antd'; import LogDetail from 'components/LogDetail'; import { VIEW_TYPES, VIEWS } from 'components/LogDetail/constants'; import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats'; -import { unescapeString } from 'container/LogDetailedView/utils'; +import { escapeHtml, unescapeString } from 'container/LogDetailedView/utils'; import LogsExplorerContext from 'container/LogsExplorerContext'; import dompurify from 'dompurify'; import { useActiveLog } from 'hooks/logs/useActiveLog'; @@ -177,7 +177,7 @@ function RawLogView({ const html = useMemo( () => ({ __html: convert.toHtml( - dompurify.sanitize(unescapeString(text), { + dompurify.sanitize(unescapeString(escapeHtml(text)), { FORBID_TAGS: [...FORBID_DOM_PURIFY_TAGS], }), ), diff --git a/frontend/src/constants/features.ts b/frontend/src/constants/features.ts index 0a80a9789b..f1e486ee91 100644 --- a/frontend/src/constants/features.ts +++ b/frontend/src/constants/features.ts @@ -10,4 +10,5 @@ export enum FeatureKeys { ONBOARDING_V3 = 'ONBOARDING_V3', THIRD_PARTY_API = 'THIRD_PARTY_API', TRACE_FUNNELS = 'TRACE_FUNNELS', + DOT_METRICS_ENABLED = 'DOT_METRICS_ENABLED', } diff --git a/frontend/src/container/AllError/index.tsx b/frontend/src/container/AllError/index.tsx index 96415daec6..aabd36ee2d 100644 --- a/frontend/src/container/AllError/index.tsx +++ b/frontend/src/container/AllError/index.tsx @@ -21,7 +21,10 @@ import ROUTES from 'constants/routes'; import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam'; import { useNotifications } from 'hooks/useNotifications'; import useResourceAttribute from 'hooks/useResourceAttribute'; -import { convertCompositeQueryToTraceSelectedTags } from 'hooks/useResourceAttribute/utils'; +import { + convertCompositeQueryToTraceSelectedTags, + getResourceDeploymentKeys, +} from 'hooks/useResourceAttribute/utils'; import { TimestampInput } from 'hooks/useTimezoneFormatter/useTimezoneFormatter'; import useUrlQuery from 'hooks/useUrlQuery'; import createQueryParams from 'lib/createQueryParams'; @@ -38,6 +41,8 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { Exception, PayloadProps } from 'types/api/errors/getAll'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../constants/features'; +import { useAppContext } from '../../providers/App/App'; import { FilterDropdownExtendsProps } from './types'; import { extractFilterValues, @@ -405,6 +410,11 @@ function AllErrors(): JSX.Element { }, ]; + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const onChangeHandler: TableProps['onChange'] = useCallback( ( paginations: TablePaginationConfig, @@ -438,7 +448,7 @@ function AllErrors(): JSX.Element { useEffect(() => { if (!isUndefined(errorCountResponse.data?.payload)) { const selectedEnvironments = queries.find( - (val) => val.tagKey === 'resource_deployment_environment', + (val) => val.tagKey === getResourceDeploymentKeys(dotMetricsEnabled), )?.tagValue; logEvent('Exception: List page visited', { diff --git a/frontend/src/container/AllError/tests/AllError.test.tsx b/frontend/src/container/AllError/tests/AllError.test.tsx index 812786a5c1..25124edac0 100644 --- a/frontend/src/container/AllError/tests/AllError.test.tsx +++ b/frontend/src/container/AllError/tests/AllError.test.tsx @@ -10,6 +10,8 @@ import { Provider, useSelector } from 'react-redux'; import { MemoryRouter } from 'react-router-dom'; import store from 'store'; +import * as appContextHooks from '../../../providers/App/App'; +import { LicenseEvent } from '../../../types/api/licensesV3/getActive'; import AllErrors from '../index'; import { INIT_URL_WITH_COMMON_QUERY, @@ -28,6 +30,30 @@ jest.mock('react-redux', () => ({ useSelector: jest.fn(), })); +jest.spyOn(appContextHooks, 'useAppContext').mockReturnValue({ + user: { + role: 'admin', + }, + activeLicenseV3: { + event_queue: { + created_at: '0', + event: LicenseEvent.NO_EVENT, + scheduled_at: '0', + status: '', + updated_at: '0', + }, + license: { + license_key: 'test-license-key', + license_type: 'trial', + org_id: 'test-org-id', + plan_id: 'test-plan-id', + plan_name: 'test-plan-name', + plan_type: 'trial', + plan_version: 'test-plan-version', + }, + }, +} as any); + function Exceptions({ initUrl }: { initUrl?: string[] }): JSX.Element { return ( diff --git a/frontend/src/container/ExportPanel/ExportPanelContainer.tsx b/frontend/src/container/ExportPanel/ExportPanelContainer.tsx index a0927e3692..6a1c3f6c2e 100644 --- a/frontend/src/container/ExportPanel/ExportPanelContainer.tsx +++ b/frontend/src/container/ExportPanel/ExportPanelContainer.tsx @@ -1,11 +1,12 @@ import { Button, Typography } from 'antd'; -import createDashboard from 'api/dashboard/create'; +import createDashboard from 'api/v1/dashboards/create'; import { ENTITY_VERSION_V4 } from 'constants/app'; import { useGetAllDashboard } from 'hooks/dashboard/useGetAllDashboard'; -import useAxiosError from 'hooks/useAxiosError'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useMutation } from 'react-query'; +import APIError from 'types/api/error'; import { ExportPanelProps } from '.'; import { @@ -33,26 +34,28 @@ function ExportPanelContainer({ refetch, } = useGetAllDashboard(); - const handleError = useAxiosError(); + const { showErrorModal } = useErrorModal(); const { mutate: createNewDashboard, isLoading: createDashboardLoading, } = useMutation(createDashboard, { onSuccess: (data) => { - if (data.payload) { - onExport(data?.payload, true); + if (data.data) { + onExport(data?.data, true); } refetch(); }, - onError: handleError, + onError: (error) => { + showErrorModal(error as APIError); + }, }); - const options = useMemo(() => getSelectOptions(data || []), [data]); + const options = useMemo(() => getSelectOptions(data?.data || []), [data]); const handleExportClick = useCallback((): void => { - const currentSelectedDashboard = data?.find( - ({ uuid }) => uuid === selectedDashboardId, + const currentSelectedDashboard = data?.data?.find( + ({ id }) => id === selectedDashboardId, ); onExport(currentSelectedDashboard || null, false); @@ -66,14 +69,18 @@ function ExportPanelContainer({ ); const handleNewDashboard = useCallback(async () => { - createNewDashboard({ - title: t('new_dashboard_title', { - ns: 'dashboard', - }), - uploadedGrafana: false, - version: ENTITY_VERSION_V4, - }); - }, [t, createNewDashboard]); + try { + await createNewDashboard({ + title: t('new_dashboard_title', { + ns: 'dashboard', + }), + uploadedGrafana: false, + version: ENTITY_VERSION_V4, + }); + } catch (error) { + showErrorModal(error as APIError); + } + }, [createNewDashboard, t, showErrorModal]); const isDashboardLoading = isAllDashboardsLoading || createDashboardLoading; diff --git a/frontend/src/container/ExportPanel/utils.ts b/frontend/src/container/ExportPanel/utils.ts index f2d36a278b..7f3a45d753 100644 --- a/frontend/src/container/ExportPanel/utils.ts +++ b/frontend/src/container/ExportPanel/utils.ts @@ -1,12 +1,10 @@ import { SelectProps } from 'antd'; -import { PayloadProps as AllDashboardsData } from 'types/api/dashboard/getAll'; +import { Dashboard } from 'types/api/dashboard/getAll'; -export const getSelectOptions = ( - data: AllDashboardsData, -): SelectProps['options'] => - data.map(({ uuid, data }) => ({ +export const getSelectOptions = (data: Dashboard[]): SelectProps['options'] => + data.map(({ id, data }) => ({ label: data.title, - value: uuid, + value: id, })); export const filterOptions: SelectProps['filterOption'] = ( diff --git a/frontend/src/container/GridCardLayout/DashboardEmptyState/DashboardEmptyState.tsx b/frontend/src/container/GridCardLayout/DashboardEmptyState/DashboardEmptyState.tsx index 9c5566be0f..76c7dda0ad 100644 --- a/frontend/src/container/GridCardLayout/DashboardEmptyState/DashboardEmptyState.tsx +++ b/frontend/src/container/GridCardLayout/DashboardEmptyState/DashboardEmptyState.tsx @@ -38,7 +38,7 @@ export default function DashboardEmptyState(): JSX.Element { setSelectedRowWidgetId(null); handleToggleDashboardSlider(true); logEvent('Dashboard Detail: Add new panel clicked', { - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, dashboardName: selectedDashboard?.data.title, numberOfPanels: selectedDashboard?.data.widgets?.length, }); diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.test.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.test.tsx index deb92aa4f5..e812088545 100644 --- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.test.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.test.tsx @@ -2,6 +2,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { PANEL_TYPES } from 'constants/queryBuilder'; import ROUTES from 'constants/routes'; import { AppProvider } from 'providers/App/App'; +import { ErrorModalProvider } from 'providers/ErrorModalProvider'; import MockQueryClientProvider from 'providers/test/MockQueryClientProvider'; import { Provider } from 'react-redux'; import store from 'store'; @@ -189,24 +190,26 @@ describe('WidgetGraphComponent', () => { it('should show correct menu items when hovering over more options while loading', async () => { const { getByTestId, findByRole, getByText, container } = render( - - - - - + + + + + + + , ); diff --git a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx index d39fe0c080..6020705d62 100644 --- a/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/WidgetGraphComponent.tsx @@ -4,7 +4,6 @@ import { Skeleton, Tooltip, Typography } from 'antd'; import cx from 'classnames'; import { useNavigateToExplorer } from 'components/CeleryTask/useNavigateToExplorer'; import { ToggleGraphProps } from 'components/Graph/types'; -import { SOMETHING_WENT_WRONG } from 'constants/api'; import { QueryParams } from 'constants/query'; import { PANEL_TYPES } from 'constants/queryBuilder'; import { placeWidgetAtBottom } from 'container/NewWidget/utils'; @@ -31,7 +30,7 @@ import { useState, } from 'react'; import { useLocation } from 'react-router-dom'; -import { Dashboard } from 'types/api/dashboard/getAll'; +import { Props } from 'types/api/dashboard/update'; import { DataSource } from 'types/common/queryBuilder'; import { v4 } from 'uuid'; @@ -119,29 +118,23 @@ function WidgetGraphComponent({ const updatedLayout = selectedDashboard.data.layout?.filter((e) => e.i !== widget.id) || []; - const updatedSelectedDashboard: Dashboard = { - ...selectedDashboard, + const updatedSelectedDashboard: Props = { data: { ...selectedDashboard.data, widgets: updatedWidgets, layout: updatedLayout, }, - uuid: selectedDashboard.uuid, + id: selectedDashboard.id, }; updateDashboardMutation.mutateAsync(updatedSelectedDashboard, { onSuccess: (updatedDashboard) => { - if (setLayouts) setLayouts(updatedDashboard.payload?.data?.layout || []); - if (setSelectedDashboard && updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []); + if (setSelectedDashboard && updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); } setDeleteModal(false); }, - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, }); }; @@ -166,7 +159,8 @@ function WidgetGraphComponent({ updateDashboardMutation.mutateAsync( { - ...selectedDashboard, + id: selectedDashboard.id, + data: { ...selectedDashboard.data, layout, @@ -183,9 +177,9 @@ function WidgetGraphComponent({ }, { onSuccess: (updatedDashboard) => { - if (setLayouts) setLayouts(updatedDashboard.payload?.data?.layout || []); - if (setSelectedDashboard && updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []); + if (setSelectedDashboard && updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); } notifications.success({ message: 'Panel cloned successfully, redirecting to new copy.', diff --git a/frontend/src/container/GridCardLayout/GridCardLayout.tsx b/frontend/src/container/GridCardLayout/GridCardLayout.tsx index ae6d3a1543..93f3c4e49c 100644 --- a/frontend/src/container/GridCardLayout/GridCardLayout.tsx +++ b/frontend/src/container/GridCardLayout/GridCardLayout.tsx @@ -6,7 +6,6 @@ import { Button, Form, Input, Modal, Typography } from 'antd'; import { useForm } from 'antd/es/form/Form'; import logEvent from 'api/common/logEvent'; import cx from 'classnames'; -import { SOMETHING_WENT_WRONG } from 'constants/api'; import { QueryParams } from 'constants/query'; import { PANEL_GROUP_TYPES, PANEL_TYPES } from 'constants/queryBuilder'; import { themeColors } from 'constants/theme'; @@ -14,7 +13,6 @@ import { DEFAULT_ROW_NAME } from 'container/NewDashboard/DashboardDescription/ut import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; import useComponentPermission from 'hooks/useComponentPermission'; import { useIsDarkMode } from 'hooks/useDarkMode'; -import { useNotifications } from 'hooks/useNotifications'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import useUrlQuery from 'hooks/useUrlQuery'; import { defaultTo, isUndefined } from 'lodash-es'; @@ -36,7 +34,8 @@ import { ItemCallback, Layout } from 'react-grid-layout'; import { useDispatch } from 'react-redux'; import { useLocation } from 'react-router-dom'; import { UpdateTimeInterval } from 'store/actions'; -import { Dashboard, Widgets } from 'types/api/dashboard/getAll'; +import { Widgets } from 'types/api/dashboard/getAll'; +import { Props } from 'types/api/dashboard/update'; import { ROLES, USER_ROLES } from 'types/roles'; import { ComponentTypes } from 'utils/permission'; @@ -107,7 +106,6 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element { const updateDashboardMutation = useUpdateDashboard(); - const { notifications } = useNotifications(); const urlQuery = useUrlQuery(); let permissions: ComponentTypes[] = ['save_layout', 'add_panel']; @@ -158,20 +156,20 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element { useEffect(() => { if (!logEventCalledRef.current && !isUndefined(data)) { logEvent('Dashboard Detail: Opened', { - dashboardId: data.uuid, + dashboardId: selectedDashboard?.id, dashboardName: data.title, numberOfPanels: data.widgets?.length, numberOfVariables: Object.keys(data?.variables || {}).length || 0, }); logEventCalledRef.current = true; } - }, [data]); + }, [data, selectedDashboard?.id]); const onSaveHandler = (): void => { if (!selectedDashboard) return; - const updatedDashboard: Dashboard = { - ...selectedDashboard, + const updatedDashboard: Props = { + id: selectedDashboard.id, data: { ...selectedDashboard.data, panelMap: { ...currentPanelMap }, @@ -186,24 +184,18 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element { return widget; }), }, - uuid: selectedDashboard.uuid, }; updateDashboardMutation.mutate(updatedDashboard, { onSuccess: (updatedDashboard) => { setSelectedRowWidgetId(null); - if (updatedDashboard.payload) { - if (updatedDashboard.payload.data.layout) - setLayouts(sortLayout(updatedDashboard.payload.data.layout)); - setSelectedDashboard(updatedDashboard.payload); - setPanelMap(updatedDashboard.payload?.data?.panelMap || {}); + if (updatedDashboard.data) { + if (updatedDashboard.data.data.layout) + setLayouts(sortLayout(updatedDashboard.data.data.layout)); + setSelectedDashboard(updatedDashboard.data); + setPanelMap(updatedDashboard.data?.data?.panelMap || {}); } }, - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, }); }; @@ -286,33 +278,25 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element { updatedWidgets?.push(currentWidget); - const updatedSelectedDashboard: Dashboard = { - ...selectedDashboard, + const updatedSelectedDashboard: Props = { + id: selectedDashboard.id, data: { ...selectedDashboard.data, widgets: updatedWidgets, }, - uuid: selectedDashboard.uuid, }; updateDashboardMutation.mutateAsync(updatedSelectedDashboard, { onSuccess: (updatedDashboard) => { - if (setLayouts) setLayouts(updatedDashboard.payload?.data?.layout || []); - if (setSelectedDashboard && updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []); + if (setSelectedDashboard && updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); } - if (setPanelMap) - setPanelMap(updatedDashboard.payload?.data?.panelMap || {}); + if (setPanelMap) setPanelMap(updatedDashboard.data?.data?.panelMap || {}); form.setFieldValue('title', ''); setIsSettingsModalOpen(false); setCurrentSelectRowId(null); }, - // eslint-disable-next-line sonarjs/no-identical-functions - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, }); }; @@ -447,34 +431,26 @@ function GraphLayout(props: GraphLayoutProps): JSX.Element { const updatedPanelMap = { ...currentPanelMap }; delete updatedPanelMap[currentSelectRowId]; - const updatedSelectedDashboard: Dashboard = { - ...selectedDashboard, + const updatedSelectedDashboard: Props = { + id: selectedDashboard.id, data: { ...selectedDashboard.data, widgets: updatedWidgets, layout: updatedLayout, panelMap: updatedPanelMap, }, - uuid: selectedDashboard.uuid, }; updateDashboardMutation.mutateAsync(updatedSelectedDashboard, { onSuccess: (updatedDashboard) => { - if (setLayouts) setLayouts(updatedDashboard.payload?.data?.layout || []); - if (setSelectedDashboard && updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (setLayouts) setLayouts(updatedDashboard.data?.data?.layout || []); + if (setSelectedDashboard && updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); } - if (setPanelMap) - setPanelMap(updatedDashboard.payload?.data?.panelMap || {}); + if (setPanelMap) setPanelMap(updatedDashboard.data?.data?.panelMap || {}); setIsDeleteModalOpen(false); setCurrentSelectRowId(null); }, - // eslint-disable-next-line sonarjs/no-identical-functions - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, }); }; const isDashboardEmpty = useMemo( diff --git a/frontend/src/container/Home/Dashboards/Dashboards.tsx b/frontend/src/container/Home/Dashboards/Dashboards.tsx index 4e10a42df4..b08b6f6e06 100644 --- a/frontend/src/container/Home/Dashboards/Dashboards.tsx +++ b/frontend/src/container/Home/Dashboards/Dashboards.tsx @@ -33,7 +33,7 @@ export default function Dashboards({ useEffect(() => { if (!dashboardsList) return; - const sortedDashboards = dashboardsList.sort((a, b) => { + const sortedDashboards = dashboardsList.data.sort((a, b) => { const aUpdateAt = new Date(a.updatedAt).getTime(); const bUpdateAt = new Date(b.updatedAt).getTime(); return bUpdateAt - aUpdateAt; @@ -103,7 +103,7 @@ export default function Dashboards({
{sortedDashboards.slice(0, 5).map((dashboard) => { - const getLink = (): string => `${ROUTES.ALL_DASHBOARD}/${dashboard.uuid}`; + const getLink = (): string => `${ROUTES.ALL_DASHBOARD}/${dashboard.id}`; const onClickHandler = (event: React.MouseEvent): void => { event.stopPropagation(); @@ -134,7 +134,7 @@ export default function Dashboards({
flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + + const { data: k8sPodsData } = useGetK8sPodsList( + query as K8sPodsListPayload, + { + queryKey: ['K8sPodsList', query], + enabled: !!query, + }, + undefined, + dotMetricsEnabled, + ); const [isLogsIngestionActive, setIsLogsIngestionActive] = useState(false); const [isTracesIngestionActive, setIsTracesIngestionActive] = useState(false); diff --git a/frontend/src/container/Home/Services/ServiceMetrics.tsx b/frontend/src/container/Home/Services/ServiceMetrics.tsx index d588f9d65d..6abbf2d046 100644 --- a/frontend/src/container/Home/Services/ServiceMetrics.tsx +++ b/frontend/src/container/Home/Services/ServiceMetrics.tsx @@ -30,6 +30,7 @@ import { GlobalReducer } from 'types/reducer/globalTime'; import { Tags } from 'types/reducer/trace'; import { USER_ROLES } from 'types/roles'; +import { FeatureKeys } from '../../../constants/features'; import { DOCS_LINKS } from '../constants'; import { columns, TIME_PICKER_OPTIONS } from './constants'; @@ -210,6 +211,11 @@ function ServiceMetrics({ const topLevelOperations = useMemo(() => Object.entries(data || {}), [data]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const queryRangeRequestData = useMemo( () => getQueryRangeRequestData({ @@ -217,12 +223,14 @@ function ServiceMetrics({ minTime: timeRange.startTime * 1e6, maxTime: timeRange.endTime * 1e6, globalSelectedInterval, + dotMetricsEnabled, }), [ globalSelectedInterval, timeRange.endTime, timeRange.startTime, topLevelOperations, + dotMetricsEnabled, ], ); diff --git a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx index f4dac3f9eb..f67b47c7f7 100644 --- a/frontend/src/container/InfraMonitoringHosts/HostsList.tsx +++ b/frontend/src/container/InfraMonitoringHosts/HostsList.tsx @@ -25,9 +25,11 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery, Query } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../constants/features'; +import { useAppContext } from '../../providers/App/App'; import HostsListControls from './HostsListControls'; import HostsListTable from './HostsListTable'; -import { getHostListsQuery, HostsQuickFiltersConfig } from './utils'; +import { getHostListsQuery, GetHostsQuickFiltersConfig } from './utils'; // eslint-disable-next-line sonarjs/cognitive-complexity function HostsList(): JSX.Element { const { maxTime, minTime } = useSelector( @@ -114,6 +116,11 @@ function HostsList(): JSX.Element { entityVersion: '', }); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const handleFiltersChange = useCallback( (value: IBuilderQuery['filters']): void => { const isNewFilterAdded = value.items.length !== filters.items.length; @@ -182,7 +189,7 @@ function HostsList(): JSX.Element {
diff --git a/frontend/src/container/InfraMonitoringHosts/utils.tsx b/frontend/src/container/InfraMonitoringHosts/utils.tsx index b6778ff22d..4e9bbd4ba2 100644 --- a/frontend/src/container/InfraMonitoringHosts/utils.tsx +++ b/frontend/src/container/InfraMonitoringHosts/utils.tsx @@ -198,3 +198,48 @@ export const HostsQuickFiltersConfig: IQuickFiltersConfig[] = [ defaultOpen: true, }, ]; + +export function GetHostsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + // These keys don’t change with dotMetricsEnabled + const hostNameKey = dotMetricsEnabled ? 'host.name' : 'host_name'; + const osTypeKey = dotMetricsEnabled ? 'os.type' : 'os_type'; + // This metric stays the same regardless of notation + const metricName = dotMetricsEnabled + ? 'system.cpu.load_average.15m' + : 'system_cpu_load_average_15m'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Host Name', + attributeKey: { + key: hostNameKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'OS Type', + attributeKey: { + key: osTypeKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts index 9d60aca7a4..2a84e83ca3 100644 --- a/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Clusters/ClusterDetails/constants.ts @@ -46,1485 +46,1981 @@ export const getClusterMetricsQueryPayload = ( cluster: K8sClustersData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '0224c582', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const getKey = (dotKey: string, underscoreKey: string): string => + dotMetricsEnabled ? dotKey : underscoreKey; + const k8sPodCpuUtilizationKey = getKey( + 'k8s.pod.cpu.utilization', + 'k8s_pod_cpu_utilization', + ); + const k8sNodeAllocatableCpuKey = getKey( + 'k8s.node.allocatable_cpu', + 'k8s_node_allocatable_cpu', + ); + const k8sPodMemoryUsageKey = getKey( + 'k8s.pod.memory.usage', + 'k8s_pod_memory_usage', + ); + const k8sNodeAllocatableMemoryKey = getKey( + 'k8s.node.allocatable_memory', + 'k8s_node_allocatable_memory', + ); + const k8sNodeConditionReadyKey = getKey( + 'k8s.node.condition_ready', + 'k8s_node_condition_ready', + ); + const k8sDeploymentAvailableKey = getKey( + 'k8s.deployment.available', + 'k8s_deployment_available', + ); + const k8sDeploymentDesiredKey = getKey( + 'k8s.deployment.desired', + 'k8s_deployment_desired', + ); + const k8sStatefulsetCurrentPodsKey = getKey( + 'k8s.statefulset.current_pods', + 'k8s_statefulset_current_pods', + ); + const k8sStatefulsetDesiredPodsKey = getKey( + 'k8s.statefulset.desired_pods', + 'k8s_statefulset_desired_pods', + ); + const k8sStatefulsetReadyPodsKey = getKey( + 'k8s.statefulset.ready_pods', + 'k8s_statefulset_ready_pods', + ); + const k8sStatefulsetUpdatedPodsKey = getKey( + 'k8s.statefulset.updated_pods', + 'k8s_statefulset_updated_pods', + ); + const k8sDaemonsetCurrentScheduledNodesKey = getKey( + 'k8s.daemonset.current_scheduled_nodes', + 'k8s_daemonset_current_scheduled_nodes', + ); + const k8sDaemonsetDesiredScheduledNodesKey = getKey( + 'k8s.daemonset.desired_scheduled_nodes', + 'k8s_daemonset_desired_scheduled_nodes', + ); + const k8sDaemonsetReadyNodesKey = getKey( + 'k8s.daemonset.ready_nodes', + 'k8s_daemonset_ready_nodes', + ); + const k8sJobActivePodsKey = getKey( + 'k8s.job.active_pods', + 'k8s_job_active_pods', + ); + const k8sJobSuccessfulPodsKey = getKey( + 'k8s.job.successful_pods', + 'k8s_job_successful_pods', + ); + const k8sJobFailedPodsKey = getKey( + 'k8s.job.failed_pods', + 'k8s_job_failed_pods', + ); + const k8sJobDesiredSuccessfulPodsKey = getKey( + 'k8s.job.desired_successful_pods', + 'k8s_job_desired_successful_pods', + ); + const k8sClusterNameKey = getKey('k8s.cluster.name', 'k8s_cluster_name'); + const k8sNodeNameKey = getKey('k8s.node.name', 'k8s_node_name'); + const k8sDeploymentNameKey = getKey( + 'k8s.deployment.name', + 'k8s_deployment_name', + ); + const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name'); + const k8sStatefulsetNameKey = getKey( + 'k8s.statefulset.name', + 'k8s_statefulset_name', + ); + const k8sDaemonsetNameKey = getKey('k8s.daemonset.name', 'k8s_daemonset_name'); + const k8sJobNameKey = getKey('k8s.job.name', 'k8s_job_name'); + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '0224c582', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'a0e11f0c', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'a0e11f0c', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (min)', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (min)', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'c775629c', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'c775629c', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (max)', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (max)', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_cpu--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_cpu', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '31f6c43a', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_cpu--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocatableCpuKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '31f6c43a', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '61a3c55e', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '834a887f', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (min)', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '9b002160', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (max)', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_memory--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_memory', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '02a9a67e', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_condition_ready--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_condition_ready', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'd7779183', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_node_name', - type: 'tag', + key: k8sPodMemoryUsageKey, + type: 'Gauge', }, - ], - having: [ - { - columnName: 'MAX(k8s_node_condition_ready)', - op: '=', - value: 1, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '61a3c55e', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', }, - ], - legend: '{{k8s_node_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + functions: [], + groupBy: [], + having: [], + legend: 'usage (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '834a887f', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (min)', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '9b002160', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (max)', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_memory--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocatableMemoryKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '02a9a67e', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_condition_ready--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_condition_ready', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'd7779183', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - ], - having: [ - { - columnName: 'MAX(k8s_node_condition_ready)', - op: '=', - value: 0, - }, - ], - legend: '{{k8s_node_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_deployment_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_deployment_available', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'a7da59c7', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_condition_ready--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeConditionReadyKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'available', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_deployment_desired--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_deployment_desired', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ + having: [ { - id: '55110885', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, + columnName: `MAX(${k8sNodeConditionReadyKey})`, op: '=', - value: cluster.meta.k8s_cluster_name, + value: 1, }, ], - op: 'AND', + legend: `{{${k8sNodeNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_current_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_current_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '3c57b4d1', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'current', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_desired_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_desired_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '0f49fe64', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_ready_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_ready_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '0bebf625', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'ready', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_updated_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_updated_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '1ddacbbe', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'updated', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_current_scheduled_nodes--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_current_scheduled_nodes', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e0bea554', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_condition_ready--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeConditionReadyKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, }, - op: '=', - value: cluster.meta.k8s_cluster_name, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - ], - having: [], - legend: 'current_nodes', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_desired_scheduled_nodes--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_desired_scheduled_nodes', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ + having: [ { - id: '741052f7', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, + columnName: `MAX(${k8sNodeConditionReadyKey})`, op: '=', - value: cluster.meta.k8s_cluster_name, + value: 0, }, ], - op: 'AND', + legend: `{{${k8sNodeNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - ], - having: [], - legend: 'desired_nodes', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_ready_nodes--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_ready_nodes', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'f23759f2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - ], - having: [], - legend: 'ready_nodes', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'last', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_job_active_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_job_active_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'fd485d85', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'running', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_job_successful_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_job_successful_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'fc1beb81', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'successful', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_job_failed_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_job_failed_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '97773348', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'failed', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_job_desired_successful_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_job_desired_successful_pods', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '5911618b', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: cluster.meta.k8s_cluster_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - ], - having: [], - legend: 'desired successful', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'last', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_deployment_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sDeploymentAvailableKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sDeploymentNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_deployment_desired--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sDeploymentDesiredKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sDeploymentNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_statefulset_current_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sStatefulsetCurrentPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_statefulset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sStatefulsetNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_statefulset_desired_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sStatefulsetDesiredPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_statefulset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sStatefulsetNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_statefulset_ready_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sStatefulsetReadyPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_statefulset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sStatefulsetNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_statefulset_updated_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sStatefulsetUpdatedPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_statefulset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sStatefulsetNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + { + disabled: false, + legend: '', + name: 'D', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + { + disabled: false, + legend: '', + name: 'D', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_daemonset_current_scheduled_nodes--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sDaemonsetCurrentScheduledNodesKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sDaemonsetNameKey}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_daemonset_desired_scheduled_nodes--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sDaemonsetDesiredScheduledNodesKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sDaemonsetNameKey}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_daemonset_ready_nodes--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sDaemonsetReadyNodesKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sDaemonsetNameKey}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_active_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobActivePodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sJobNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_successful_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobSuccessfulPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sJobNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_failed_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobFailedPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sJobNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_desired_successful_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobDesiredSuccessfulPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'd7779183', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sJobNameKey}}} ({{${k8sNamespaceNameKey}})`, + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + { + disabled: false, + legend: '', + name: 'D', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + { + disabled: false, + legend: '', + name: 'B', + query: '', + }, + { + disabled: false, + legend: '', + name: 'C', + query: '', + }, + { + disabled: false, + legend: '', + name: 'D', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TABLE, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_active_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobActivePodsKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'fd485d85', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_cluster_name', + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: 'running', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'last', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_successful_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobSuccessfulPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'fc1beb81', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_cluster_name', + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: 'successful', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'last', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_failed_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobFailedPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '97773348', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_cluster_name', + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: 'failed', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'last', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_job_desired_successful_pods--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sJobDesiredSuccessfulPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '5911618b', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: 'k8s_cluster_name', + type: 'tag', + }, + op: '=', + value: cluster.meta.k8s_cluster_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + ], + having: [], + legend: 'desired successful', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'last', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: true, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx index aef7bb491a..9fe85939aa 100644 --- a/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Clusters/K8sClustersList.tsx @@ -28,11 +28,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -135,6 +137,11 @@ function K8sClustersList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sClustersRowData, groupBy: IBuilderQuery['groupBy'], @@ -194,6 +201,8 @@ function K8sClustersList({ queryKey: ['clusterList', fetchGroupedByRowDataQuery], enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, }, + undefined, + dotMetricsEnabled, ); const { @@ -202,8 +211,10 @@ function K8sClustersList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: - K8sEntityToAggregateAttributeMapping[K8sCategory.CLUSTERS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.CLUSTERS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -249,6 +260,8 @@ function K8sClustersList({ queryKey: ['clusterList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const clustersData = useMemo(() => data?.payload?.data?.records || [], [data]); diff --git a/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx index f03804537e..7dfc0e23d7 100644 --- a/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Clusters/utils.tsx @@ -136,6 +136,11 @@ export const getK8sClustersListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.cluster.name': 'k8s_cluster_name', + 'k8s.cluster.uid': 'k8s_cluster_uid', +}; + const getGroupByEle = ( cluster: K8sClustersData, groupBy: IBuilderQuery['groupBy'], @@ -143,7 +148,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(cluster.meta[group.key as keyof typeof cluster.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof cluster.meta; + const value = cluster.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/constants.ts index 1b9ea26033..b207c4ccc1 100644 --- a/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/DaemonSets/DaemonSetDetails/constants.ts @@ -30,619 +30,664 @@ export const getDaemonSetMetricsQueryPayload = ( daemonSet: K8sDaemonSetsData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sPodCpuUtilizationKey = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + const k8sContainerCpuRequestKey = dotMetricsEnabled + ? 'k8s.container.cpu_request' + : 'k8s_container_cpu_request'; + + const k8sContainerCpuLimitKey = dotMetricsEnabled + ? 'k8s.container.cpu_limit' + : 'k8s_container_cpu_limit'; + + const k8sPodMemoryUsageKey = dotMetricsEnabled + ? 'k8s.pod.memory.usage' + : 'k8s_pod_memory_usage'; + + const k8sContainerMemoryRequestKey = dotMetricsEnabled + ? 'k8s.container.memory_request' + : 'k8s_container_memory_request'; + + const k8sContainerMemoryLimitKey = dotMetricsEnabled + ? 'k8s.container.memory_limit' + : 'k8s_container_memory_limit'; + + const k8sPodNetworkIoKey = dotMetricsEnabled + ? 'k8s.pod.network.io' + : 'k8s_pod_network_io'; + + const k8sPodNetworkErrorsKey = dotMetricsEnabled + ? 'k8s.pod.network.errors' + : 'k8s_pod_network_errors'; + + const k8sDaemonSetNameKey = dotMetricsEnabled + ? 'k8s.daemonset.name' + : 'k8s_daemonset_name'; + + const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name'; + + const k8sNamespaceNameKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '745a486f', + key: { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonSetNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '148dffa7', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'd420a02b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '745a486f', - key: { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '148dffa7', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_limit', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'd420a02b', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6d3283ce', - key: { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'a334f5c2', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_limit', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'fde3c631', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '6d3283ce', + key: { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonSetNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'a334f5c2', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'fde3c631', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'ccbdbd6a', - key: { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '581a85fb', - key: { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_daemonset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: daemonSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'ccbdbd6a', + key: { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonSetNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '581a85fb', + key: { + dataType: DataTypes.String, + id: 'k8s_daemonset_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDaemonSetNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_daemonset_name, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: daemonSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx b/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx index 767b175347..7084c4ba09 100644 --- a/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/DaemonSets/K8sDaemonSetsList.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -137,6 +139,11 @@ function K8sDaemonSetsList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sDaemonSetsRowData, groupBy: IBuilderQuery['groupBy'], @@ -196,6 +203,8 @@ function K8sDaemonSetsList({ queryKey: ['daemonSetList', fetchGroupedByRowDataQuery], enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, }, + undefined, + dotMetricsEnabled, ); const { @@ -204,8 +213,10 @@ function K8sDaemonSetsList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: - K8sEntityToAggregateAttributeMapping[K8sCategory.DAEMONSETS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.DAEMONSETS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -246,6 +257,8 @@ function K8sDaemonSetsList({ queryKey: ['daemonSetList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const daemonSetsData = useMemo(() => data?.payload?.data?.records || [], [ diff --git a/frontend/src/container/InfraMonitoringK8s/DaemonSets/utils.tsx b/frontend/src/container/InfraMonitoringK8s/DaemonSets/utils.tsx index e7d39d81de..5a3be3a741 100644 --- a/frontend/src/container/InfraMonitoringK8s/DaemonSets/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/DaemonSets/utils.tsx @@ -236,6 +236,12 @@ export const getK8sDaemonSetsListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.daemonset.name': 'k8s_daemonset_name', + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.cluster.name': 'k8s_cluster_name', +}; + const getGroupByEle = ( daemonSet: K8sDaemonSetsData, groupBy: IBuilderQuery['groupBy'], @@ -243,7 +249,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(daemonSet.meta[group.key as keyof typeof daemonSet.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof daemonSet.meta; + const value = daemonSet.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts index c6481481b1..f334f4ada9 100644 --- a/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Deployments/DeploymentDetails/constants.ts @@ -30,515 +30,556 @@ export const getDeploymentMetricsQueryPayload = ( deployment: K8sDeploymentsData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'aec60cba', - key: { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sPodCpuUtilizationKey = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + const k8sContainerCpuRequestKey = dotMetricsEnabled + ? 'k8s.container.cpu_request' + : 'k8s_container_cpu_request'; + + const k8sContainerCpuLimitKey = dotMetricsEnabled + ? 'k8s.container.cpu_limit' + : 'k8s_container_cpu_limit'; + + const k8sPodMemoryUsageKey = dotMetricsEnabled + ? 'k8s.pod.memory.usage' + : 'k8s_pod_memory_usage'; + + const k8sContainerMemoryRequestKey = dotMetricsEnabled + ? 'k8s.container.memory_request' + : 'k8s_container_memory_request'; + + const k8sContainerMemoryLimitKey = dotMetricsEnabled + ? 'k8s.container.memory_limit' + : 'k8s_container_memory_limit'; + + const k8sPodNetworkIoKey = dotMetricsEnabled + ? 'k8s.pod.network.io' + : 'k8s_pod_network_io'; + + const k8sPodNetworkErrorsKey = dotMetricsEnabled + ? 'k8s.pod.network.errors' + : 'k8s_pod_network_errors'; + + const k8sDeploymentNameKey = dotMetricsEnabled + ? 'k8s.deployment.name' + : 'k8s_deployment_name'; + + const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'aec60cba', + key: { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + op: '=', + value: deployment.meta.k8s_deployment_name, }, - op: '=', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'd047ec14', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'd047ec14', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: deployment.meta.k8s_deployment_name, }, - op: 'contains', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_limit', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '750b7856', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '750b7856', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: deployment.meta.k8s_deployment_name, }, - op: 'contains', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '768c2f47', - key: { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', - }, - op: '=', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '1a96fa81', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_limit', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'e69a2b7e', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '8b550f6d', - key: { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '768c2f47', + key: { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + op: '=', + value: deployment.meta.k8s_deployment_name, }, - op: '=', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'direction', - type: 'tag', + key: k8sContainerMemoryRequestKey, + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '1a96fa81', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: deployment.meta.k8s_deployment_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_limit--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'interface', - type: 'tag', + key: k8sContainerMemoryLimitKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'e69a2b7e', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: deployment.meta.k8s_deployment_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e16c1e4a', - key: { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', - }, - op: '=', - value: deployment.meta.k8s_deployment_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '8b550f6d', + key: { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + op: '=', + value: deployment.meta.k8s_deployment_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e16c1e4a', + key: { + dataType: DataTypes.String, + id: 'k8s_deployment_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', + }, + op: '=', + value: deployment.meta.k8s_deployment_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx index 1bbb58bb1a..215842b897 100644 --- a/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Deployments/K8sDeploymentsList.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -138,6 +140,11 @@ function K8sDeploymentsList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sDeploymentsRowData, groupBy: IBuilderQuery['groupBy'], @@ -197,6 +204,8 @@ function K8sDeploymentsList({ queryKey: ['deploymentList', fetchGroupedByRowDataQuery], enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, }, + undefined, + dotMetricsEnabled, ); const { @@ -205,8 +214,10 @@ function K8sDeploymentsList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: - K8sEntityToAggregateAttributeMapping[K8sCategory.DEPLOYMENTS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.DEPLOYMENTS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -247,6 +258,8 @@ function K8sDeploymentsList({ queryKey: ['deploymentList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const deploymentsData = useMemo(() => data?.payload?.data?.records || [], [ diff --git a/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx index 779b9b4bf5..b64845eb9c 100644 --- a/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Deployments/utils.tsx @@ -226,6 +226,12 @@ export const getK8sDeploymentsListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.deployment.name': 'k8s_deployment_name', + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.cluster.name': 'k8s_cluster_name', +}; + const getGroupByEle = ( deployment: K8sDeploymentsData, groupBy: IBuilderQuery['groupBy'], @@ -233,9 +239,14 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push( - deployment.meta[group.key as keyof typeof deployment.meta], - ); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? + rawKey) as keyof typeof deployment.meta; + const value = deployment.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx index 1fda22df75..d90ad708e0 100644 --- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx +++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityMetrics/EntityMetrics.tsx @@ -29,6 +29,9 @@ import { SuccessResponse } from 'types/api'; import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange'; import { Options } from 'uplot'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; + interface EntityMetricsProps { timeRange: { startTime: number; @@ -49,6 +52,7 @@ interface EntityMetricsProps { node: T, start: number, end: number, + dotMetricsEnabled: boolean, ) => GetQueryResultsProps[]; queryKey: string; category: K8sCategory; @@ -65,9 +69,25 @@ function EntityMetrics({ queryKey, category, }: EntityMetricsProps): JSX.Element { + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; const queryPayloads = useMemo( - () => getEntityQueryPayload(entity, timeRange.startTime, timeRange.endTime), - [getEntityQueryPayload, entity, timeRange.startTime, timeRange.endTime], + () => + getEntityQueryPayload( + entity, + timeRange.startTime, + timeRange.endTime, + dotMetricsEnabled, + ), + [ + getEntityQueryPayload, + entity, + timeRange.startTime, + timeRange.endTime, + dotMetricsEnabled, + ], ); const queries = useQueries( diff --git a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx index 9aa6ab6f33..a293f9cd5d 100644 --- a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx +++ b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx @@ -26,19 +26,21 @@ import { useState } from 'react'; import { useSearchParams } from 'react-router-dom-v5-compat'; import { Query } from 'types/api/queryBuilder/queryBuilderData'; +import { FeatureKeys } from '../../constants/features'; +import { useAppContext } from '../../providers/App/App'; import K8sClustersList from './Clusters/K8sClustersList'; import { - ClustersQuickFiltersConfig, - DaemonSetsQuickFiltersConfig, - DeploymentsQuickFiltersConfig, + GetClustersQuickFiltersConfig, + GetDaemonsetsQuickFiltersConfig, + GetDeploymentsQuickFiltersConfig, + GetJobsQuickFiltersConfig, + GetNamespaceQuickFiltersConfig, + GetNodesQuickFiltersConfig, + GetPodsQuickFiltersConfig, + GetStatefulsetsQuickFiltersConfig, + GetVolumesQuickFiltersConfig, INFRA_MONITORING_K8S_PARAMS_KEYS, - JobsQuickFiltersConfig, K8sCategories, - NamespaceQuickFiltersConfig, - NodesQuickFiltersConfig, - PodsQuickFiltersConfig, - StatefulsetsQuickFiltersConfig, - VolumesQuickFiltersConfig, } from './constants'; import K8sDaemonSetsList from './DaemonSets/K8sDaemonSetsList'; import K8sDeploymentsList from './Deployments/K8sDeploymentsList'; @@ -74,6 +76,11 @@ export default function InfraMonitoringK8s(): JSX.Element { entityVersion: '', }); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const handleFilterChange = (query: Query): void => { // update the current query with the new filters // in infra monitoring k8s, we are using only one query, hence updating the 0th index of queryData @@ -109,7 +116,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -129,7 +136,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -152,7 +159,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -172,7 +179,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -192,7 +199,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -212,7 +219,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -232,7 +239,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -255,7 +262,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( @@ -275,7 +282,7 @@ export default function InfraMonitoringK8s(): JSX.Element { children: ( diff --git a/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/constants.ts index e7ea02246d..e8bed7671b 100644 --- a/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Jobs/JobDetails/constants.ts @@ -30,395 +30,415 @@ export const getJobMetricsQueryPayload = ( job: K8sJobsData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sPodCpuUtilizationKey = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + const k8sPodMemoryUsageKey = dotMetricsEnabled + ? 'k8s.pod.memory.usage' + : 'k8s_pod_memory_usage'; + const k8sPodNetworkIoKey = dotMetricsEnabled + ? 'k8s.pod.network.io' + : 'k8s_pod_network_io'; + const k8sPodNetworkErrorsKey = dotMetricsEnabled + ? 'k8s.pod.network.errors' + : 'k8s_pod_network_errors'; + const k8sJobNameKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name'; + const k8sNamespaceNameKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '6b59b690', + key: { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + op: '=', + value: job.jobName, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: job.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6b59b690', - key: { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - op: '=', - value: job.jobName, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: job.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '8c217f4d', - key: { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - op: '=', - value: job.jobName, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: job.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '8c217f4d', + key: { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + op: '=', + value: job.jobName, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: job.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '2bbf9d0c', - key: { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - op: '=', - value: job.jobName, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: job.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '448e6cf7', - key: { - dataType: DataTypes.String, - id: 'k8s_job_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_job_name', - type: 'tag', - }, - op: '=', - value: job.jobName, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: job.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '2bbf9d0c', + key: { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + op: '=', + value: job.jobName, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: job.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '448e6cf7', + key: { + dataType: DataTypes.String, + id: 'k8s_job_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sJobNameKey, + type: 'tag', + }, + op: '=', + value: job.jobName, + }, + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: job.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx b/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx index 9c9563e55a..b413cb5363 100644 --- a/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Jobs/K8sJobsList.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -132,6 +134,11 @@ function K8sJobsList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sJobsRowData, groupBy: IBuilderQuery['groupBy'], @@ -185,10 +192,15 @@ function K8sJobsList({ isLoading: isLoadingGroupedByRowData, isError: isErrorGroupedByRowData, refetch: fetchGroupedByRowData, - } = useGetK8sJobsList(fetchGroupedByRowDataQuery as K8sJobsListPayload, { - queryKey: ['jobList', fetchGroupedByRowDataQuery], - enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, - }); + } = useGetK8sJobsList( + fetchGroupedByRowDataQuery as K8sJobsListPayload, + { + queryKey: ['jobList', fetchGroupedByRowDataQuery], + enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, + }, + undefined, + dotMetricsEnabled, + ); const { data: groupByFiltersData, @@ -196,7 +208,10 @@ function K8sJobsList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.JOBS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.JOBS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -242,6 +257,8 @@ function K8sJobsList({ queryKey: ['jobList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const jobsData = useMemo(() => data?.payload?.data?.records || [], [data]); diff --git a/frontend/src/container/InfraMonitoringK8s/Jobs/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Jobs/utils.tsx index 1cc7555b76..b580969e57 100644 --- a/frontend/src/container/InfraMonitoringK8s/Jobs/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Jobs/utils.tsx @@ -263,6 +263,12 @@ export const getK8sJobsListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.job.name': 'k8s_job_name', + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.cluster.name': 'k8s_cluster_name', +}; + const getGroupByEle = ( job: K8sJobsData, groupBy: IBuilderQuery['groupBy'], @@ -270,7 +276,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(job.meta[group.key as keyof typeof job.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof job.meta; + const value = job.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx index 4d2cc2a847..e1c1b6ecba 100644 --- a/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/K8sNamespacesList.tsx @@ -28,11 +28,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -136,6 +138,11 @@ function K8sNamespacesList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sNamespacesRowData, groupBy: IBuilderQuery['groupBy'], @@ -195,6 +202,8 @@ function K8sNamespacesList({ queryKey: ['namespaceList', fetchGroupedByRowDataQuery], enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, }, + undefined, + dotMetricsEnabled, ); const { @@ -203,8 +212,10 @@ function K8sNamespacesList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: - K8sEntityToAggregateAttributeMapping[K8sCategory.NAMESPACES], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.NAMESPACES, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -245,6 +256,8 @@ function K8sNamespacesList({ queryKey: ['namespaceList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const namespacesData = useMemo(() => data?.payload?.data?.records || [], [ diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts index f7b32c5e65..8c6f928e0f 100644 --- a/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/NamespaceDetails/constants.ts @@ -54,1580 +54,1671 @@ export const getNamespaceMetricsQueryPayload = ( namespace: K8sNamespacesData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const getKey = (dotKey: string, underscoreKey: string): string => + dotMetricsEnabled ? dotKey : underscoreKey; + const k8sPodCpuUtilizationKey = getKey( + 'k8s.pod.cpu.utilization', + 'k8s_pod_cpu_utilization', + ); + const k8sContainerCpuRequestKey = getKey( + 'k8s.container.cpu_request', + 'k8s_container_cpu_request', + ); + const k8sPodMemoryUsageKey = getKey( + 'k8s.pod.memory.usage', + 'k8s_pod_memory_usage', + ); + const k8sContainerMemoryRequestKey = getKey( + 'k8s.container.memory_request', + 'k8s_container_memory_request', + ); + const k8sPodMemoryWorkingSetKey = getKey( + 'k8s.pod.memory.working_set', + 'k8s_pod_memory_working_set', + ); + const k8sPodMemoryRssKey = getKey('k8s.pod.memory.rss', 'k8s_pod_memory_rss'); + const k8sPodNetworkIoKey = getKey('k8s.pod.network.io', 'k8s_pod_network_io'); + const k8sPodNetworkErrorsKey = getKey( + 'k8s.pod.network.errors', + 'k8s_pod_network_errors', + ); + const k8sStatefulsetCurrentPodsKey = getKey( + 'k8s.statefulset.current_pods', + 'k8s_statefulset_current_pods', + ); + const k8sStatefulsetDesiredPodsKey = getKey( + 'k8s.statefulset.desired_pods', + 'k8s_statefulset_desired_pods', + ); + const k8sStatefulsetUpdatedPodsKey = getKey( + 'k8s.statefulset.updated_pods', + 'k8s_statefulset_updated_pods', + ); + const k8sReplicasetDesiredKey = getKey( + 'k8s.replicaset.desired', + 'k8s_replicaset_desired', + ); + const k8sReplicasetAvailableKey = getKey( + 'k8s.replicaset.available', + 'k8s_replicaset_available', + ); + const k8sDaemonsetDesiredScheduledNamespacesKey = getKey( + 'k8s.daemonset.desired.scheduled.namespaces', + 'k8s_daemonset_desired_scheduled_namespaces', + ); + const k8sDaemonsetCurrentScheduledNamespacesKey = getKey( + 'k8s.daemonset.current.scheduled.namespaces', + 'k8s_daemonset_current_scheduled_namespaces', + ); + const k8sDaemonsetReadyNamespacesKey = getKey( + 'k8s.daemonset.ready.namespaces', + 'k8s_daemonset_ready_namespaces', + ); + const k8sDaemonsetMisscheduledNamespacesKey = getKey( + 'k8s.daemonset.misscheduled.namespaces', + 'k8s_daemonset_misscheduled_namespaces', + ); + const k8sDeploymentDesiredKey = getKey( + 'k8s.deployment.desired', + 'k8s_deployment_desired', + ); + const k8sDeploymentAvailableKey = getKey( + 'k8s.deployment.available', + 'k8s_deployment_available', + ); + const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name'); + const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name'); + const k8sStatefulsetNameKey = getKey( + 'k8s.statefulset.name', + 'k8s_statefulset_name', + ); + const k8sReplicasetNameKey = getKey( + 'k8s.replicaset.name', + 'k8s_replicaset_name', + ); + const k8sDaemonsetNameKey = getKey('k8s.daemonset.name', 'k8s_daemonset_name'); + const k8sDeploymentNameKey = getKey( + 'k8s.deployment.name', + 'k8s_deployment_name', + ); + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodCpuUtilizationKey, + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '47b3adae', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '93d2be5e', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sContainerCpuRequestKey, + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '93d2be5e', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '795eb679', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodCpuUtilizationKey, + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '795eb679', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (min)', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (min)', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '6792adbe', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodCpuUtilizationKey, + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '6792adbe', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (max)', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (max)', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '10011298', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryUsageKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '10011298', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'ea53b656', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sContainerMemoryRequestKey, + isColumn: true, + isJSON: false, + key: k8sContainerMemoryRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'ea53b656', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'request', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [], - having: [], - legend: 'request', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_working_set--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_working_set', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '674ace83', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryWorkingSetKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryWorkingSetKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '674ace83', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'working set', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'working set', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_rss--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_rss', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '187dbdb3', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryRssKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryRssKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '187dbdb3', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'rss', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'rss', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'E', - filters: { - items: [ - { - id: 'a3dbf468', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryUsageKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: 'a3dbf468', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (min)', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (min)', - limit: null, - orderBy: [], - queryName: 'E', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'F', - filters: { - items: [ - { - id: '4b2406c2', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryUsageKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: '4b2406c2', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage (max)', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', }, - functions: [], - groupBy: [], - having: [], - legend: 'usage (max)', - limit: null, - orderBy: [], - queryName: 'F', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'c3a73f0a', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodCpuUtilizationKey, + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c3a73f0a', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sPodNameKey, + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: `{{${k8sPodNameKey}}}`, + limit: 20, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: 20, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '5cad3379', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodMemoryUsageKey, + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '5cad3379', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sPodNameKey, + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: `{{${k8sPodNameKey}}}`, + limit: 10, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: 10, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '00f5c5e1', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sPodNetworkIoKey, + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '00f5c5e1', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'interface', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'direction', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.String, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '3aa8e064', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.String, + id: k8sPodNetworkErrorsKey, + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '3aa8e064', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'interface', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'direction', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_current_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_current_pods', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '5f2a55c5', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TABLE, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sStatefulsetCurrentPodsKey, + isColumn: true, + isJSON: false, + key: k8sStatefulsetCurrentPodsKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '5f2a55c5', + key: { + dataType: DataTypes.String, + id: k8sStatefulsetNameKey, + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sStatefulsetNameKey, + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'current', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sStatefulsetDesiredPodsKey, + isColumn: true, isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', + key: k8sStatefulsetDesiredPodsKey, + type: 'Gauge', }, - ], - having: [], - legend: 'current', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_desired_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_desired_pods', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '13bd7a1d', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '13bd7a1d', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sStatefulsetNameKey, + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'desired', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sStatefulsetUpdatedPodsKey, + isColumn: true, isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', + key: k8sStatefulsetUpdatedPodsKey, + type: 'Gauge', }, - ], - having: [], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_statefulset_updated_pods--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_statefulset_updated_pods', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '9d287c73', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '9d287c73', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sStatefulsetNameKey, + isColumn: false, + isJSON: false, + key: k8sStatefulsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'updated', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - ], - having: [], - legend: 'updated', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: true, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_replicaset_desired--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_replicaset_desired', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '0c1e655c', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TABLE, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sReplicasetDesiredKey, + isColumn: true, + isJSON: false, + key: k8sReplicasetDesiredKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '0c1e655c', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sReplicasetNameKey, + isColumn: false, + isJSON: false, + key: k8sReplicasetNameKey, + type: 'tag', }, ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_replicaset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_replicaset_name', - type: 'tag', - }, - ], - having: [ - { - columnName: 'MAX(k8s_replicaset_desired)', - op: '>', - value: 0, - }, - ], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_replicaset_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_replicaset_available', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ + having: [ { - id: 'b2296bdb', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: namespace.namespaceName, + columnName: `MAX(${k8sReplicasetDesiredKey})`, + op: '>', + value: 0, }, ], - op: 'AND', + legend: 'desired', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_replicaset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sReplicasetAvailableKey, + isColumn: true, isJSON: false, - key: 'k8s_replicaset_name', - type: 'tag', + key: k8sReplicasetAvailableKey, + type: 'Gauge', }, - ], - having: [ - { - columnName: 'MAX(k8s_replicaset_available)', - op: '>', - value: 0, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'b2296bdb', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, + }, + ], + op: 'AND', }, - ], - legend: 'available', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sReplicasetNameKey, + isColumn: false, + isJSON: false, + key: k8sReplicasetNameKey, + type: 'tag', + }, + ], + having: [ + { + columnName: `MAX(${k8sReplicasetDesiredKey})`, + op: '>', + value: 0, + }, + ], + legend: 'available', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: true, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_desired_scheduled_namespaces--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_desired_scheduled_namespaces', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '2964eb92', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TABLE, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDaemonsetDesiredScheduledNamespacesKey, + isColumn: true, + isJSON: false, + key: k8sDaemonsetDesiredScheduledNamespacesKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '2964eb92', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDaemonsetNameKey, + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'desired', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDaemonsetCurrentScheduledNamespacesKey, + isColumn: true, isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', + key: k8sDaemonsetCurrentScheduledNamespacesKey, + type: 'Gauge', }, - ], - having: [], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_current_scheduled_namespaces--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_current_scheduled_namespaces', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'cd324eff', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'cd324eff', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDaemonsetNameKey, + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'current', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDaemonsetReadyNamespacesKey, + isColumn: true, isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', + key: k8sDaemonsetReadyNamespacesKey, + type: 'Gauge', }, - ], - having: [], - legend: 'current', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_ready_namespaces--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_ready_namespaces', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '0416fa6f', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '0416fa6f', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDaemonsetNameKey, + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'ready', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDaemonsetMisscheduledNamespacesKey, + isColumn: true, isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', + key: k8sDaemonsetMisscheduledNamespacesKey, + type: 'Gauge', }, - ], - having: [], - legend: 'ready', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_daemonset_misscheduled_namespaces--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_daemonset_misscheduled_namespaces', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: 'c0a126d3', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'c0a126d3', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDaemonsetNameKey, + isColumn: false, + isJSON: false, + key: k8sDaemonsetNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'misscheduled', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_daemonset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_daemonset_name', - type: 'tag', - }, - ], - having: [], - legend: 'misscheduled', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: true, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TABLE, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_deployment_desired--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_deployment_desired', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '9bc659c1', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TABLE, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDeploymentDesiredKey, + isColumn: true, + isJSON: false, + key: k8sDeploymentDesiredKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '9bc659c1', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDeploymentNameKey, + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'desired', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: k8sDeploymentAvailableKey, + isColumn: true, isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', + key: k8sDeploymentAvailableKey, + type: 'Gauge', }, - ], - having: [], - legend: 'desired', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_deployment_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_deployment_available', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'e1696631', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'e1696631', + key: { + dataType: DataTypes.String, + id: k8sNamespaceNameKey, + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: namespace.namespaceName, }, - op: '=', - value: namespace.namespaceName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: k8sDeploymentNameKey, + isColumn: false, + isJSON: false, + key: k8sDeploymentNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: 'available', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'last', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_deployment_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_deployment_name', - type: 'tag', - }, - ], - having: [], - legend: 'available', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'last', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'util %', + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [ { disabled: false, - expression: 'A/B', - legend: 'util %', - queryName: 'F1', + legend: '', + name: 'A', + query: '', }, ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: true, + start, + end, }, - variables: {}, - formatForWeb: true, - start, - end, - }, -]; + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx index d566c86910..cf9e5cfb31 100644 --- a/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Namespaces/utils.tsx @@ -122,6 +122,11 @@ export const getK8sNamespacesListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.cluster.name': 'k8s_cluster_name', +}; + const getGroupByEle = ( namespace: K8sNamespacesData, groupBy: IBuilderQuery['groupBy'], @@ -129,7 +134,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(namespace.meta[group.key as keyof typeof namespace.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof namespace.meta; + const value = namespace.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx index 107a13454a..ca83a54e9b 100644 --- a/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx @@ -28,11 +28,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -130,6 +132,11 @@ function K8sNodesList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sNodesRowData, groupBy: IBuilderQuery['groupBy'], @@ -183,10 +190,15 @@ function K8sNodesList({ isLoading: isLoadingGroupedByRowData, isError: isErrorGroupedByRowData, refetch: fetchGroupedByRowData, - } = useGetK8sNodesList(fetchGroupedByRowDataQuery as K8sNodesListPayload, { - queryKey: ['nodeList', fetchGroupedByRowDataQuery], - enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, - }); + } = useGetK8sNodesList( + fetchGroupedByRowDataQuery as K8sNodesListPayload, + { + queryKey: ['nodeList', fetchGroupedByRowDataQuery], + enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, + }, + undefined, + dotMetricsEnabled, + ); const { data: groupByFiltersData, @@ -194,7 +206,10 @@ function K8sNodesList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.NODES], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.NODES, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -240,6 +255,8 @@ function K8sNodesList({ queryKey: ['nodeList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const nodesData = useMemo(() => data?.payload?.data?.records || [], [data]); diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts index e491d03d3c..659fb0110b 100644 --- a/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Nodes/NodeDetails/constants.ts @@ -54,1581 +54,1665 @@ export const getNodeMetricsQueryPayload = ( node: K8sNodesData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '441b62d7', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_cpu--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_cpu', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'b205b1a3', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '884c2bf3', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '98be9da1', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (max)', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'E', - filters: { - items: [ - { - id: 'ce97dd7b', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (min)', - limit: null, - orderBy: [], - queryName: 'E', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'fdffcbb2', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (avg)', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_memory--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_memory', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '9b79a8bd', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '3387fb4a', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: 'd1ad7ccb', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (max)', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'E', - filters: { - items: [ - { - id: '5e578329', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used (min)', - limit: null, - orderBy: [], - queryName: 'E', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_working_set--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_working_set', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'F', - filters: { - items: [ - { - id: '6ab3ec98', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'working set', - limit: null, - orderBy: [], - queryName: 'F', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_rss--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_rss', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'G', - filters: { - items: [ - { - id: '80c9a1db', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'rss', - limit: null, - orderBy: [], - queryName: 'G', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '752765ef', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_cpu--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_cpu', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: 'f0c5c1ed', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'C', - filters: { - items: [ - { - id: 'b952b389', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: 'used/allocatable', - queryName: 'F1', - }, - { - disabled: false, - expression: 'A/C', - legend: 'used/request', - queryName: 'F2', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'c2a2c926', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'used', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_memory--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_memory', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '20e6760c', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'allocatable', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'C', - filters: { - items: [ - { - id: 'fcc4d5e8', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: 'used/allocatable', - queryName: 'F1', - }, - { - disabled: false, - expression: 'A/C', - legend: 'used/request', - queryName: 'F2', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '88d38c06', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const getKey = (dotKey: string, underscoreKey: string): string => + dotMetricsEnabled ? dotKey : underscoreKey; + const k8sNodeCpuUtilizationKey = getKey( + 'k8s.node.cpu.utilization', + 'k8s_node_cpu_utilization', + ); + + const k8sNodeAllocatableCpuKey = getKey( + 'k8s.node.allocatable_cpu', + 'k8s_node_allocatable_cpu', + ); + + const k8sContainerCpuRequestKey = getKey( + 'k8s.container.cpu_request', + 'k8s_container_cpu_request', + ); + + const k8sNodeMemoryUsageKey = getKey( + 'k8s.node.memory.usage', + 'k8s_node_memory_usage', + ); + + const k8sNodeAllocatableMemoryKey = getKey( + 'k8s.node.allocatable_memory', + 'k8s_node_allocatable_memory', + ); + + const k8sContainerMemoryRequestKey = getKey( + 'k8s.container.memory_request', + 'k8s_container_memory_request', + ); + + const k8sNodeMemoryWorkingSetKey = getKey( + 'k8s.node.memory.working_set', + 'k8s_node_memory_working_set', + ); + + const k8sNodeMemoryRssKey = getKey( + 'k8s.node.memory.rss', + 'k8s_node_memory_rss', + ); + + const k8sPodCpuUtilizationKey = getKey( + 'k8s.pod.cpu.utilization', + 'k8s_pod_cpu_utilization', + ); + + const k8sPodMemoryUsageKey = getKey( + 'k8s.pod.memory.usage', + 'k8s_pod_memory_usage', + ); + + const k8sNodeNetworkErrorsKey = getKey( + 'k8s.node.network.errors', + 'k8s_node_network_errors', + ); + + const k8sNodeNetworkIoKey = getKey( + 'k8s.node.network.io', + 'k8s_node_network_io', + ); + + const k8sNodeFilesystemUsageKey = getKey( + 'k8s.node.filesystem.usage', + 'k8s_node_filesystem_usage', + ); + + const k8sNodeFilesystemCapacityKey = getKey( + 'k8s.node.filesystem.capacity', + 'k8s_node_filesystem_capacity', + ); + + const k8sNodeFilesystemAvailableKey = getKey( + 'k8s.node.filesystem.available', + 'k8s_node_filesystem_available', + ); + + const k8sNodeNameKey = getKey('k8s.node.name', 'k8s_node_name'); + + const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name'); + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + key: k8sNodeCpuUtilizationKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: 10, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '43033387', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '441b62d7', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_cpu--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + key: k8sNodeAllocatableCpuKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: 10, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e9ce8079', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'b205b1a3', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'direction', - type: 'tag', + key: k8sContainerCpuRequestKey, + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '884c2bf3', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'interface', - type: 'tag', + key: k8sNodeCpuUtilizationKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'd62d103f', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '98be9da1', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (max)', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'direction', - type: 'tag', + key: k8sNodeCpuUtilizationKey, + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: 'ce97dd7b', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (min)', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_usage--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'interface', - type: 'tag', + key: k8sNodeMemoryUsageKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'fdffcbb2', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (avg)', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_memory--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocatableMemoryKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '9b79a8bd', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '3387fb4a', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'd1ad7ccb', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (max)', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: '5e578329', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used (min)', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_working_set--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemoryWorkingSetKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: '6ab3ec98', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'working set', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_rss--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemoryRssKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'G', + filters: { + items: [ + { + id: '80c9a1db', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'rss', + limit: null, + orderBy: [], + queryName: 'G', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'b85d3580', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: '752765ef', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'used', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_capacity', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '23f502e1', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_cpu--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocatableCpuKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'f0c5c1ed', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [], - having: [], - legend: 'capacity', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_available', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'b80650ec', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'C', + filters: { + items: [ + { + id: 'b952b389', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [], - having: [], - legend: 'available', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'used/allocatable', + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: 'used/request', + queryName: 'F2', + }, + ], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'b85d3580', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'c2a2c926', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: 'used', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_capacity', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '23f502e1', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_node_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_memory--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocatableMemoryKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '20e6760c', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, }, - op: '=', - value: node.meta.k8s_node_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'allocatable', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', }, - functions: [], - groupBy: [], - having: [], - legend: 'capacity', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'C', + filters: { + items: [ + { + id: 'fcc4d5e8', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'used/allocatable', + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: 'used/request', + queryName: 'F2', + }, + ], + }, + clickhouse_sql: [ { disabled: false, - expression: 'A/B', - legend: 'util %', - queryName: 'F1', + legend: '', + name: 'A', + query: '', }, ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilizationKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '88d38c06', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sPodNameKey}}}`, + limit: 10, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemoryUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '43033387', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sPodNameKey}}}`, + limit: 10, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sNodeNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e9ce8079', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sNodeNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'd62d103f', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFilesystemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'b85d3580', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFilesystemCapacityKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '23f502e1', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'capacity', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFilesystemAvailableKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'b80650ec', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'available', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFilesystemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'b85d3580', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'used', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFilesystemCapacityKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '23f502e1', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: '=', + value: node.meta.k8s_node_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'capacity', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: 'util %', + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Nodes/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Nodes/utils.tsx index 361b42b7e2..96d475bd35 100644 --- a/frontend/src/container/InfraMonitoringK8s/Nodes/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Nodes/utils.tsx @@ -152,6 +152,12 @@ export const getK8sNodesListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.node.name': 'k8s_node_name', + 'k8s.cluster.name': 'k8s_cluster_name', + 'k8s.node.uid': 'k8s_node_uid', +}; + const getGroupByEle = ( node: K8sNodesData, groupBy: IBuilderQuery['groupBy'], @@ -159,7 +165,14 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(node.meta[group.key as keyof typeof node.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof node.meta; + + const value = node.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx index acbb003925..6173ffef77 100644 --- a/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -118,13 +120,21 @@ function K8sPodsList({ [currentQuery?.builder?.queryData], ); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const { data: groupByFiltersData, isLoading: isLoadingGroupByFilters, } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.PODS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.PODS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -201,6 +211,8 @@ function K8sPodsList({ queryKey: ['hostList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const createFiltersForSelectedRowData = ( @@ -255,10 +267,15 @@ function K8sPodsList({ isLoading: isLoadingGroupedByRowData, isError: isErrorGroupedByRowData, refetch: fetchGroupedByRowData, - } = useGetK8sPodsList(fetchGroupedByRowDataQuery as K8sPodsListPayload, { - queryKey: ['hostList', fetchGroupedByRowDataQuery], - enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, - }); + } = useGetK8sPodsList( + fetchGroupedByRowDataQuery as K8sPodsListPayload, + { + queryKey: ['hostList', fetchGroupedByRowDataQuery], + enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, + }, + undefined, + dotMetricsEnabled, + ); const podsData = useMemo(() => data?.payload?.data?.records || [], [data]); const totalCount = data?.payload?.data?.total || 0; diff --git a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts index 4f8579af71..ca825d14f1 100644 --- a/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Pods/PodDetails/constants.ts @@ -66,2607 +66,2721 @@ export const getPodMetricsQueryPayload = ( pod: K8sPodsData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e812bfd9', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - { - id: '067b2dc4', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Avg', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '37729a44', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - { - id: '379af416', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Max', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '481db9b1', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - { - id: '39ee0dbd', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Min', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '2ea54c80', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '755c8a9d', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Avg', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '7243d538', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '1e3d01ee', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Avg', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '3ec4e2b6', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '0c8b2662', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Max', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: 'abe996ed', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'e915da76', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Min', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'E', - filters: { - items: [ - { - id: '3addc70a', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '32c15c03', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Max', - limit: null, - orderBy: [], - queryName: 'E', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'F', - filters: { - items: [ - { - id: 'da9de2a8', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '703fced1', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Min', - limit: null, - orderBy: [], - queryName: 'F', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e6ca88fe', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '5418405c', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Avg', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'cd9de239', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '1ea5c602', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Max', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '952e535a', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'd7632974', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Min', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '65969a40', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '5a822bec', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Avg', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'bd3dcfd4', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '3362c603', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Avg', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '04f5aff6', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'ce88008b', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Max', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'D', - filters: { - items: [ - { - id: '8718a7d7', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '53fc92fd', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Max', - limit: null, - orderBy: [], - queryName: 'D', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'E', - filters: { - items: [ - { - id: '990f8296', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '61dfa9f6', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request util % - Min', - limit: null, - orderBy: [], - queryName: 'E', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'min', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'F', - filters: { - items: [ - { - id: '4c78ab5c', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '508cdf26', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util % - Min', - limit: null, - orderBy: [], - queryName: 'F', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'min', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_rss--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_rss', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'f66ff082', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '80528f79', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'RSS Memory', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_working_set--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_working_set', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '2cae58e7', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '780cc786', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Working Set Memory', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'B-A', - legend: 'Cache Memory', - queryName: 'F1', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_major_page_faults--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_major_page_faults', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '7ad40408', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '8b2a539b', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'major page faults', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'fdf017be', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '4b4382be', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const getKey = (dotKey: string, underscoreKey: string): string => + dotMetricsEnabled ? dotKey : underscoreKey; + const k8sContainerNameKey = getKey('k8s.container.name', 'k8s_container_name'); + + const k8sPodCpuUtilKey = getKey( + 'k8s.pod.cpu.utilization', + 'k8s_pod_cpu_utilization', + ); + + const k8sPodCpuReqUtilKey = getKey( + 'k8s.pod.cpu_request_utilization', + 'k8s_pod_cpu_request_utilization', + ); + + const k8sPodCpuLimitUtilKey = getKey( + 'k8s.pod.cpu_limit_utilization', + 'k8s_pod_cpu_limit_utilization', + ); + + const k8sPodMemUsageKey = getKey( + 'k8s.pod.memory.usage', + 'k8s_pod_memory_usage', + ); + + const k8sPodMemReqUtilKey = getKey( + 'k8s.pod.memory_request_utilization', + 'k8s_pod_memory_request_utilization', + ); + + const k8sPodMemLimitUtilKey = getKey( + 'k8s.pod.memory_limit_utilization', + 'k8s_pod_memory_limit_utilization', + ); + + const k8sPodMemRssKey = getKey('k8s.pod.memory.rss', 'k8s_pod_memory_rss'); + + const k8sPodMemWorkingSetKey = getKey( + 'k8s.pod.memory.working_set', + 'k8s_pod_memory_working_set', + ); + + const k8sPodMemMajorPFKey = getKey( + 'k8s.pod.memory.major_page_faults', + 'k8s_pod_memory_major_page_faults', + ); + + const containerCpuUtilKey = getKey( + 'container.cpu.utilization', + 'container_cpu_utilization', + ); + + const k8sContainerCpuRequestKey = getKey( + 'k8s.container.cpu_request', + 'k8s_container_cpu_request', + ); + + const k8sContainerCpuLimitKey = getKey( + 'k8s.container.cpu_limit', + 'k8s_container_cpu_limit', + ); + + const k8sContainerMemoryLimitKey = getKey( + 'k8s.container.memory_limit', + 'k8s_container_memory_limit', + ); + + const k8sContainerMemoryRequestKey = getKey( + 'k8s.container.memory_request', + 'k8s_container_memory_request', + ); + + const containerMemUsageKey = getKey( + 'container.memory.usage', + 'container_memory_usage', + ); + + const containerMemWorkingSetKey = getKey( + 'container.memory.working_set', + 'container_memory_working_set', + ); + + const containerMemRssKey = getKey( + 'container.memory.rss', + 'container_memory_rss', + ); + + const k8sPodNetworkIoKey = getKey('k8s.pod.network.io', 'k8s_pod_network_io'); + + const k8sPodNetworkErrorsKey = getKey( + 'k8s.pod.network.errors', + 'k8s_pod_network_errors', + ); + + const k8sPodFilesystemCapacityKey = getKey( + 'k8s.pod.filesystem.capacity', + 'k8s_pod_filesystem_capacity', + ); + + const k8sPodFilesystemAvailableKey = getKey( + 'k8s.pod.filesystem.available', + 'k8s_pod_filesystem_available', + ); + + const k8sPodFilesystemUsageKey = getKey( + 'k8s.pod.filesystem.usage', + 'k8s_pod_filesystem_usage', + ); + + const k8sPodNameKey = getKey('k8s.pod.name', 'k8s_pod_name'); + + const k8sNamespaceNameKey = getKey('k8s.namespace.name', 'k8s_namespace_name'); + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_container_name', - type: 'tag', + key: k8sPodCpuUtilKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{k8s_container_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'f0c71cba', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e812bfd9', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '9301d7c0', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + { + id: '067b2dc4', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_container_name', - type: 'tag', + key: k8sPodCpuUtilKey, + type: 'Gauge', }, - ], - having: [], + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '37729a44', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + { + id: '379af416', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Max', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '481db9b1', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + { + id: '39ee0dbd', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Min', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + name: 'A', + query: '', }, + ], + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '9b14868b', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '92b99374', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], + disabled: false, legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + name: 'A', + query: '', }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'C', - filters: { - items: [ - { - id: '1de8c8b9', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '1c7de95d', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_container_name', - type: 'tag', + key: k8sPodCpuReqUtilKey, + type: 'Gauge', }, - ], - having: [], + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '2ea54c80', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '755c8a9d', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '7243d538', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1e3d01ee', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Avg', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '3ec4e2b6', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '0c8b2662', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Max', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: 'abe996ed', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'e915da76', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Min', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: '3addc70a', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '32c15c03', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Max', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodCpuLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: 'da9de2a8', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '703fced1', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Min', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, legend: '', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + name: 'A', + query: '', }, ], - queryFormulas: [ + id: v4(), + promql: [ { disabled: false, - expression: 'A/B', - legend: 'Req % : {{k8s_container_name}} ', - queryName: 'F1', - }, - { - disabled: false, - expression: 'A/C', - legend: 'Limit % : {{k8s_container_name}} ', - queryName: 'F2', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'e8914a2d', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '964fd905', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], - legend: 'usage :: {{k8s_container_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_working_set--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_working_set', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'a2f69b5d', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '76a586be', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], - legend: 'working set :: {{k8s_container_name}}', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_rss--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_rss', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '95fc86d1', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '7c5f875b', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], - legend: 'rss :: {{k8s_container_name}}', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'c2d56c31', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '80216712', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + name: 'A', + query: '', }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: 'c04e7733', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '84b59a9f', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_container_name', - type: 'tag', + key: k8sPodMemUsageKey, + type: 'Gauge', }, - ], - having: [], + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e6ca88fe', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '5418405c', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'cd9de239', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1ea5c602', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Max', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '952e535a', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'd7632974', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Min', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', + name: 'A', + query: '', }, + ], + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'C', - filters: { - items: [ - { - id: 'd1549857', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'd649ad0c', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_container_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_container_name', - type: 'tag', - }, - ], - having: [], + disabled: false, legend: '', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'max', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: 'Req % : {{k8s_container_name}} ', - queryName: 'F1', - }, - { - disabled: false, - expression: 'A/C', - legend: 'Limit % : {{k8s_container_name}} ', - queryName: 'F2', + name: 'A', + query: '', }, ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '65969a40', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '5a822bec', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Avg', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'bd3dcfd4', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '3362c603', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Avg', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '04f5aff6', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'ce88008b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Max', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'D', + filters: { + items: [ + { + id: '8718a7d7', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '53fc92fd', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Max', + limit: null, + orderBy: [], + queryName: 'D', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'E', + filters: { + items: [ + { + id: '990f8296', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '61dfa9f6', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request util % - Min', + limit: null, + orderBy: [], + queryName: 'E', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'min', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'F', + filters: { + items: [ + { + id: '4c78ab5c', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '508cdf26', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util % - Min', + limit: null, + orderBy: [], + queryName: 'F', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'min', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '29bc6602', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'bc9c5cf3', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + id: v4(), + promql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '200e722b', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'b54a3d78', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_rss--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemRssKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f66ff082', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '80528f79', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'RSS Memory', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_working_set--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemWorkingSetKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: '2cae58e7', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '780cc786', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Working Set Memory', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'B-A', + legend: 'Cache Memory', + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [ { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_filesystem_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_filesystem_capacity', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '779f7a2e', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '1a97cb95', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Capacity', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_filesystem_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_filesystem_available', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'dd756bfe', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: 'ddfbd379', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Available', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_filesystem_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_filesystem_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: 'a5ac4705', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_namespace_name, - }, - { - id: '1963fc96', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: pod.meta.k8s_pod_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Uage', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', + legend: '', + name: 'A', + query: '', }, ], - queryFormulas: [], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_memory_major_page_faults--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodMemMajorPFKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '7ad40408', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '8b2a539b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'major page faults', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerCpuUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'fdf017be', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '4b4382be', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: `{{${k8sContainerNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerCpuUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'f0c71cba', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '9301d7c0', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '9b14868b', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '92b99374', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'C', + filters: { + items: [ + { + id: '1de8c8b9', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1c7de95d', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: `Req % : {{${k8sContainerNameKey}}} `, + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: `Limit % : {{${k8sContainerNameKey}}}`, + queryName: 'F2', + }, + ], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'e8914a2d', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '964fd905', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: `usage :: {{${k8sContainerNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_working_set--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemWorkingSetKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'a2f69b5d', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '76a586be', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: `working set :: {{${k8sContainerNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_rss--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemRssKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: '95fc86d1', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '7c5f875b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: `rss :: {{${k8sContainerNameKey}}}`, + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'c2d56c31', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '80216712', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'c04e7733', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '84b59a9f', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemoryLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'C', + filters: { + items: [ + { + id: 'd1549857', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'd649ad0c', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_container_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sContainerNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'max', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: `Req % : {{${k8sContainerNameKey}}} `, + queryName: 'F1', + }, + { + disabled: false, + expression: 'A/C', + legend: `Limit % : {{${k8sContainerNameKey}}} `, + queryName: 'F2', + }, + ], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '29bc6602', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'bc9c5cf3', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '200e722b', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'b54a3d78', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_filesystem_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodFilesystemCapacityKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '779f7a2e', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1a97cb95', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Capacity', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_filesystem_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodFilesystemAvailableKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'dd756bfe', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: 'ddfbd379', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Available', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_filesystem_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodFilesystemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'a5ac4705', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_namespace_name, + }, + { + id: '1963fc96', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: pod.meta.k8s_pod_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Uage', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + id: v4(), + promql: [ + { + disabled: false, + legend: '', + name: 'A', + query: '', + }, + ], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx b/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx index e2dae778f6..1fb608b74c 100644 --- a/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/StatefulSets/K8sStatefulSetsList.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -137,6 +139,11 @@ function K8sStatefulSetsList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sStatefulSetsRowData, groupBy: IBuilderQuery['groupBy'], @@ -196,6 +203,8 @@ function K8sStatefulSetsList({ queryKey: ['statefulSetList', fetchGroupedByRowDataQuery], enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, }, + undefined, + dotMetricsEnabled, ); const { @@ -204,8 +213,10 @@ function K8sStatefulSetsList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: - K8sEntityToAggregateAttributeMapping[K8sCategory.STATEFULSETS], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.STATEFULSETS, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -251,6 +262,8 @@ function K8sStatefulSetsList({ queryKey: ['statefulSetList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const statefulSetsData = useMemo(() => data?.payload?.data?.records || [], [ diff --git a/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/constants.ts index c1ae28dd77..e9deda80b8 100644 --- a/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/StatefulSets/StatefulSetDetails/constants.ts @@ -38,909 +38,875 @@ export const getStatefulSetMetricsQueryPayload = ( statefulSet: K8sStatefulSetsData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '8627bd22', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '82f07131', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '9c669f4f', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '3c835082', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Reqs util %', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_cpu_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_cpu_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'c0a5e5b1', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limit util %', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'f8ae7d0f', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'usage', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '66fbdd5e', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'requests', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '1a408383', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'contains', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'limits', - limit: null, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_request_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_request_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'acdccfa2', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Reqs util %', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_memory_limit_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_memory_limit_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: 'cc9a85d3', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Limits util %', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '2ea33f83', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, - }, - { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sStatefulSetNameKey = dotMetricsEnabled + ? 'k8s.statefulset.name' + : 'k8s_statefulset_name'; + const k8sNamespaceNameKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name'; + + const k8sPodCpuUtilKey = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + const k8sContainerCpuRequestKey = dotMetricsEnabled + ? 'k8s.container.cpu_request' + : 'k8s_container_cpu_request'; + const k8sContainerCpuLimitKey = dotMetricsEnabled + ? 'k8s.container.cpu_limit' + : 'k8s_container_cpu_limit'; + const k8sPodCpuReqUtilKey = dotMetricsEnabled + ? 'k8s.pod.cpu_request_utilization' + : 'k8s_pod_cpu_request_utilization'; + const k8sPodCpuLimitUtilKey = dotMetricsEnabled + ? 'k8s.pod.cpu_limit_utilization' + : 'k8s_pod_cpu_limit_utilization'; + + const k8sPodMemUsageKey = dotMetricsEnabled + ? 'k8s.pod.memory.usage' + : 'k8s_pod_memory_usage'; + const k8sContainerMemRequestKey = dotMetricsEnabled + ? 'k8s.container.memory_request' + : 'k8s_container_memory_request'; + const k8sContainerMemLimitKey = dotMetricsEnabled + ? 'k8s.container.memory_limit' + : 'k8s_container_memory_limit'; + const k8sPodMemReqUtilKey = dotMetricsEnabled + ? 'k8s.pod.memory_request_utilization' + : 'k8s_pod_memory_request_utilization'; + const k8sPodMemLimitUtilKey = dotMetricsEnabled + ? 'k8s.pod.memory_limit_utilization' + : 'k8s_pod_memory_limit_utilization'; + + const k8sPodNetworkIoKey = dotMetricsEnabled + ? 'k8s.pod.network.io' + : 'k8s_pod_network_io'; + const k8sPodNetworkErrorsKey = dotMetricsEnabled + ? 'k8s.pod.network.errors' + : 'k8s_pod_network_errors'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'cpu_usage', + isColumn: true, isJSON: false, - key: 'direction', - type: 'tag', + key: k8sPodCpuUtilKey, + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_errors', - type: 'Sum', - }, - aggregateOperator: 'increase', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '7e25d4fb', - key: { - dataType: DataTypes.String, - id: 'k8s_statefulset_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_statefulset_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, }, - op: '=', - value: statefulSet.meta.k8s_statefulset_name, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'cpu_request', + isColumn: true, + isJSON: false, + key: k8sContainerCpuRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'f3', + key: { + dataType: DataTypes.String, + id: 'pod_name', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'cpu_limit', + isColumn: true, + isJSON: false, + key: k8sContainerCpuLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'f4', + key: { + dataType: DataTypes.String, + id: 'pod_name', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'cpu_req_util', + isColumn: true, + isJSON: false, + key: k8sPodCpuReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Reqs util %', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'cpu_limit_util', + isColumn: true, + isJSON: false, + key: k8sPodCpuLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limit util %', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'mem_usage', + isColumn: true, + isJSON: false, + key: k8sPodMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'usage', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'mem_request', + isColumn: true, + isJSON: false, + key: k8sContainerMemRequestKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'f3', + key: { + dataType: DataTypes.String, + id: 'pod_name', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'requests', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'mem_limit', + isColumn: true, + isJSON: false, + key: k8sContainerMemLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'f4', + key: { + dataType: DataTypes.String, + id: 'pod_name', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'contains', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'limits', + limit: null, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'mem_req_util', + isColumn: true, + isJSON: false, + key: k8sPodMemReqUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Reqs util %', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'mem_limit_util', + isColumn: true, + isJSON: false, + key: k8sPodMemLimitUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Limits util %', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'net_io', + isColumn: true, + isJSON: false, + key: k8sPodNetworkIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', }, { - id: '47b3adae', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: '=', - value: statefulSet.meta.k8s_namespace_name, + dataType: DataTypes.String, + id: 'interface', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - isJSON: false, - key: 'interface', - type: 'tag', - }, - ], - having: [], - legend: '{{direction}} :: {{interface}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'increase', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'net_err', + isColumn: true, + isJSON: false, + key: k8sPodNetworkErrorsKey, + type: 'Sum', + }, + aggregateOperator: 'increase', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'f1', + key: { + dataType: DataTypes.String, + id: 'ss_name', + isColumn: false, + isJSON: false, + key: k8sStatefulSetNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_statefulset_name, + }, + { + id: 'f2', + key: { + dataType: DataTypes.String, + id: 'ns_name', + isColumn: false, + isJSON: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: '=', + value: statefulSet.meta.k8s_namespace_name, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'interface', + isColumn: false, + isJSON: false, + key: 'interface', + type: 'tag', + }, + ], + having: [], + legend: '{{direction}} :: {{interface}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'increase', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/StatefulSets/utils.tsx b/frontend/src/container/InfraMonitoringK8s/StatefulSets/utils.tsx index 35730263c2..0e393e99bf 100644 --- a/frontend/src/container/InfraMonitoringK8s/StatefulSets/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/StatefulSets/utils.tsx @@ -236,6 +236,11 @@ export const getK8sStatefulSetsListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.statefulset.name': 'k8s_statefulset_name', +}; + const getGroupByEle = ( statefulSet: K8sStatefulSetsData, groupBy: IBuilderQuery['groupBy'], @@ -243,9 +248,14 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push( - statefulSet.meta[group.key as keyof typeof statefulSet.meta], - ); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? + rawKey) as keyof typeof statefulSet.meta; + const value = statefulSet.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx b/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx index aa9a1c69dd..dea58590f7 100644 --- a/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Volumes/K8sVolumesList.tsx @@ -29,11 +29,13 @@ import { AppState } from 'store/reducers'; import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getOrderByFromParams } from '../commonUtils'; import { + GetK8sEntityToAggregateAttribute, INFRA_MONITORING_K8S_PARAMS_KEYS, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from '../constants'; import K8sHeader from '../K8sHeader'; import LoadingContainer from '../LoadingContainer'; @@ -137,6 +139,11 @@ function K8sVolumesList({ } }, [quickFiltersLastUpdated]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const createFiltersForSelectedRowData = ( selectedRowData: K8sVolumesRowData, groupBy: IBuilderQuery['groupBy'], @@ -190,10 +197,15 @@ function K8sVolumesList({ isLoading: isLoadingGroupedByRowData, isError: isErrorGroupedByRowData, refetch: fetchGroupedByRowData, - } = useGetK8sVolumesList(fetchGroupedByRowDataQuery as K8sVolumesListPayload, { - queryKey: ['volumeList', fetchGroupedByRowDataQuery], - enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, - }); + } = useGetK8sVolumesList( + fetchGroupedByRowDataQuery as K8sVolumesListPayload, + { + queryKey: ['volumeList', fetchGroupedByRowDataQuery], + enabled: !!fetchGroupedByRowDataQuery && !!selectedRowData, + }, + undefined, + dotMetricsEnabled, + ); const { data: groupByFiltersData, @@ -201,7 +213,10 @@ function K8sVolumesList({ } = useGetAggregateKeys( { dataSource: currentQuery.builder.queryData[0].dataSource, - aggregateAttribute: K8sEntityToAggregateAttributeMapping[K8sCategory.NODES], + aggregateAttribute: GetK8sEntityToAggregateAttribute( + K8sCategory.NODES, + dotMetricsEnabled, + ), aggregateOperator: 'noop', searchText: '', tagType: '', @@ -247,6 +262,8 @@ function K8sVolumesList({ queryKey: ['volumeList', query], enabled: !!query, }, + undefined, + dotMetricsEnabled, ); const volumesData = useMemo(() => data?.payload?.data?.records || [], [data]); diff --git a/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/constants.ts b/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/constants.ts index 089c097937..d18d5aff6e 100644 --- a/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/Volumes/VolumeDetails/constants.ts @@ -34,562 +34,521 @@ export const getVolumeQueryPayload = ( volume: K8sVolumesData, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_volume_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_volume_available', - type: 'Gauge', + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sClusterNameKey = dotMetricsEnabled + ? 'k8s.cluster.name' + : 'k8s_cluster_name'; + const k8sNamespaceNameKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const k8sVolumeAvailableKey = dotMetricsEnabled + ? 'k8s.volume.available' + : 'k8s_volume_available'; + const k8sVolumeCapacityKey = dotMetricsEnabled + ? 'k8s.volume.capacity' + : 'k8s_volume_capacity'; + const k8sVolumeInodesUsedKey = dotMetricsEnabled + ? 'k8s.volume.inodes.used' + : 'k8s_volume_inodes_used'; + const k8sVolumeInodesKey = dotMetricsEnabled + ? 'k8s.volume.inodes' + : 'k8s_volume_inodes'; + const k8sVolumeInodesFreeKey = dotMetricsEnabled + ? 'k8s.volume.inodes.free' + : 'k8s_volume_inodes_free'; + const k8sVolumeTypeKey = dotMetricsEnabled + ? 'k8s.volume.type' + : 'k8s_volume_type'; + const k8sPVCNameKey = dotMetricsEnabled + ? 'k8s.persistentvolumeclaim.name' + : 'k8s_persistentvolumeclaim_name'; + const legendTemplate = dotMetricsEnabled + ? '{{k8s.namespace.name}}-{{k8s.pod.name}}' + : '{{k8s_namespace_name}}-{{k8s_pod_name}}'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_volume_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sVolumeAvailableKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: volume.meta.k8s_cluster_name, + }, + { + id: 'c2', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: 'in', + value: [volume.meta.k8s_namespace_name], + }, + { + id: 'c3', + key: { + dataType: DataTypes.String, + id: 'k8s_volume_type--string--tag--false', + isColumn: false, + key: k8sVolumeTypeKey, + type: 'tag', + }, + op: 'in', + value: ['persistentVolumeClaim'], + }, + { + id: 'c4', + key: { + dataType: DataTypes.String, + id: 'k8s_persistentvolumeclaim_name--string--tag--false', + isColumn: false, + key: k8sPVCNameKey, + type: 'tag', + }, + op: '=', + value: volume.persistentVolumeClaimName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: legendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: volume.meta.k8s_cluster_name, - }, - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: 'in', - value: [volume.meta.k8s_namespace_name], - }, - { - id: '217757e9', - key: { - dataType: DataTypes.String, - id: 'k8s_volume_type--string--tag--false', - isColumn: false, - key: 'k8s_volume_type', - type: 'tag', - }, - op: 'in', - value: ['persistentVolumeClaim'], - }, - { - id: '34754bda', - key: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_persistentvolumeclaim_name--string--tag--false', - }, - op: '=', - value: volume.persistentVolumeClaimName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: '{{k8s_namespace_name}}-{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_volume_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_volume_capacity', - type: 'Gauge', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_volume_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sVolumeCapacityKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: volume.meta.k8s_cluster_name, + }, + { + id: 'c2', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: 'in', + value: [volume.meta.k8s_namespace_name], + }, + { + id: 'c3', + key: { + dataType: DataTypes.String, + id: 'k8s_volume_type--string--tag--false', + isColumn: false, + key: k8sVolumeTypeKey, + type: 'tag', + }, + op: 'in', + value: ['persistentVolumeClaim'], + }, + { + id: 'c4', + key: { + dataType: DataTypes.String, + id: 'k8s_persistentvolumeclaim_name--string--tag--false', + isColumn: false, + key: k8sPVCNameKey, + type: 'tag', + }, + op: '=', + value: volume.persistentVolumeClaimName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: legendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: volume.meta.k8s_cluster_name, - }, - { - id: '0cdebb88', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: 'in', - value: [volume.meta.k8s_namespace_name], - }, - { - id: 'e0e880ce', - key: { - dataType: DataTypes.String, - id: 'k8s_volume_type--string--tag--false', - isColumn: false, - key: 'k8s_volume_type', - type: 'tag', - }, - op: 'in', - value: ['persistentVolumeClaim'], - }, - { - id: '34754bda', - key: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_persistentvolumeclaim_name--string--tag--false', - }, - op: '=', - value: volume.persistentVolumeClaimName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: '{{k8s_namespace_name}}-{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_volume_inodes_used--float64----true', - isColumn: true, - key: 'k8s_volume_inodes_used', - type: '', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_volume_inodes_used--float64----true', + isColumn: true, + key: k8sVolumeInodesUsedKey, + type: '', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: volume.meta.k8s_cluster_name, + }, + { + id: 'c2', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: 'in', + value: [volume.meta.k8s_namespace_name], + }, + { + id: 'c3', + key: { + dataType: DataTypes.String, + id: 'k8s_volume_type--string--tag--false', + isColumn: false, + key: k8sVolumeTypeKey, + type: 'tag', + }, + op: 'in', + value: ['persistentVolumeClaim'], + }, + { + id: 'c4', + key: { + dataType: DataTypes.String, + id: 'k8s_persistentvolumeclaim_name--string--tag--false', + isColumn: false, + key: k8sPVCNameKey, + type: 'tag', + }, + op: '=', + value: volume.persistentVolumeClaimName, + }, + ], + op: 'AND', + }, + groupBy: [], + having: [], + legend: legendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + functions: [], }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: volume.meta.k8s_cluster_name, - }, - { - id: '46393c61', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: 'in', - value: [volume.meta.k8s_namespace_name], - }, - { - id: '450ee3cb', - key: { - dataType: DataTypes.String, - id: 'k8s_volume_type--string--tag--false', - isColumn: false, - key: 'k8s_volume_type', - type: 'tag', - }, - op: 'in', - value: ['persistentVolumeClaim'], - }, - { - id: '34754bda', - key: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_persistentvolumeclaim_name--string--tag--false', - }, - op: '=', - value: volume.persistentVolumeClaimName, - }, - ], - op: 'AND', - }, - groupBy: [], - having: [], - legend: '{{k8s_namespace_name}}-{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - functions: [], - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_volume_inodes--float64----true', - isColumn: true, - key: 'k8s_volume_inodes', - type: '', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_volume_inodes--float64----true', + isColumn: true, + key: k8sVolumeInodesKey, + type: '', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: volume.meta.k8s_cluster_name, + }, + { + id: 'c2', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: 'in', + value: [volume.meta.k8s_namespace_name], + }, + { + id: 'c3', + key: { + dataType: DataTypes.String, + id: 'k8s_volume_type--string--tag--false', + isColumn: false, + key: k8sVolumeTypeKey, + type: 'tag', + }, + op: 'in', + value: ['persistentVolumeClaim'], + }, + { + id: 'c4', + key: { + dataType: DataTypes.String, + id: 'k8s_persistentvolumeclaim_name--string--tag--false', + isColumn: false, + key: k8sPVCNameKey, + type: 'tag', + }, + op: '=', + value: volume.persistentVolumeClaimName, + }, + ], + op: 'AND', + }, + groupBy: [], + having: [], + legend: legendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + functions: [], }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: volume.meta.k8s_cluster_name, - }, - { - id: '5a604bad', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: 'in', - value: [volume.meta.k8s_namespace_name], - }, - { - id: '24b074f3', - key: { - dataType: DataTypes.String, - id: 'k8s_volume_type--string--tag--false', - isColumn: false, - key: 'k8s_volume_type', - type: 'tag', - }, - op: 'in', - value: ['persistentVolumeClaim'], - }, - { - id: '34754bda', - key: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_persistentvolumeclaim_name--string--tag--false', - }, - op: '=', - value: volume.persistentVolumeClaimName, - }, - ], - op: 'AND', - }, - groupBy: [], - having: [], - legend: '{{k8s_namespace_name}}-{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - functions: [], - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_volume_inodes_free--float64----true', - isColumn: true, - key: 'k8s_volume_inodes_free', - type: '', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_volume_inodes_free--float64----true', + isColumn: true, + key: k8sVolumeInodesFreeKey, + type: '', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'c1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: volume.meta.k8s_cluster_name, + }, + { + id: 'c2', + key: { + dataType: DataTypes.String, + id: 'k8s_namespace_name--string--tag--false', + isColumn: false, + key: k8sNamespaceNameKey, + type: 'tag', + }, + op: 'in', + value: [volume.meta.k8s_namespace_name], + }, + { + id: 'c3', + key: { + dataType: DataTypes.String, + id: 'k8s_volume_type--string--tag--false', + isColumn: false, + key: k8sVolumeTypeKey, + type: 'tag', + }, + op: 'in', + value: ['persistentVolumeClaim'], + }, + { + id: 'c4', + key: { + dataType: DataTypes.String, + id: 'k8s_persistentvolumeclaim_name--string--tag--false', + isColumn: false, + key: k8sPVCNameKey, + type: 'tag', + }, + op: '=', + value: volume.persistentVolumeClaimName, + }, + ], + op: 'AND', + }, + groupBy: [], + having: [], + legend: legendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + functions: [], }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6077fbc2', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: volume.meta.k8s_cluster_name, - }, - { - id: '8f01b14d', - key: { - dataType: DataTypes.String, - id: 'k8s_namespace_name--string--tag--false', - isColumn: false, - key: 'k8s_namespace_name', - type: 'tag', - }, - op: 'in', - value: [volume.meta.k8s_namespace_name], - }, - { - id: 'a72c99da', - key: { - dataType: DataTypes.String, - id: 'k8s_volume_type--string--tag--false', - isColumn: false, - key: 'k8s_volume_type', - type: 'tag', - }, - op: 'in', - value: ['persistentVolumeClaim'], - }, - { - id: '34754bda', - key: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_persistentvolumeclaim_name--string--tag--false', - }, - op: '=', - value: volume.persistentVolumeClaimName, - }, - ], - op: 'AND', - }, - groupBy: [], - having: [], - legend: '{{k8s_namespace_name}}-{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - functions: [], - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: v4(), + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: v4(), - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + ]; +}; diff --git a/frontend/src/container/InfraMonitoringK8s/Volumes/utils.tsx b/frontend/src/container/InfraMonitoringK8s/Volumes/utils.tsx index 6b8db6ea48..a86dbbfeb7 100644 --- a/frontend/src/container/InfraMonitoringK8s/Volumes/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/Volumes/utils.tsx @@ -142,6 +142,16 @@ export const getK8sVolumesListColumns = ( return columnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.node.name': 'k8s_node_name', + 'k8s.pod.name': 'k8s_pod_name', + 'k8s.pod.uid': 'k8s_pod_uid', + 'k8s.statefulset.name': 'k8s_statefulset_name', + 'k8s.cluster.name': 'k8s_cluster_name', + 'k8s.persistentvolumeclaim.name': 'k8s_persistentvolumeclaim_name', +}; + const getGroupByEle = ( volume: K8sVolumesData, groupBy: IBuilderQuery['groupBy'], @@ -149,7 +159,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(volume.meta[group.key as keyof typeof volume.meta]); + const rawKey = group.key as string; + + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof volume.meta; + + const value = volume.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/InfraMonitoringK8s/constants.ts b/frontend/src/container/InfraMonitoringK8s/constants.ts index d182922421..6956b2637c 100644 --- a/frontend/src/container/InfraMonitoringK8s/constants.ts +++ b/frontend/src/container/InfraMonitoringK8s/constants.ts @@ -36,7 +36,7 @@ export const K8sCategories = { VOLUMES: 'volumes', }; -export const K8sEntityToAggregateAttributeMapping = { +export const underscoreMap = { [K8sCategory.HOSTS]: 'system_cpu_load_average_15m', [K8sCategory.PODS]: 'k8s_pod_cpu_utilization', [K8sCategory.NODES]: 'k8s_node_cpu_utilization', @@ -50,469 +50,654 @@ export const K8sEntityToAggregateAttributeMapping = { [K8sCategory.VOLUMES]: 'k8s_volume_capacity', }; -export const PodsQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Pod', - attributeKey: { - key: 'k8s_pod_name', - dataType: DataTypes.String, - type: 'tag', - isColumn: false, - isJSON: false, - id: 'k8s_pod_name--string--tag--true', - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'Node', - attributeKey: { - key: 'k8s_node_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - id: 'k8s.node.name--string--resource--true', - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'Deployment', - attributeKey: { - key: 'k8s_deployment_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'Statefulset', - attributeKey: { - key: 'k8s_statefulset_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'DaemonSet', - attributeKey: { - key: 'k8s_daemonset_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, - { - type: FiltersType.CHECKBOX, - title: 'Job', - attributeKey: { - key: 'k8s_job_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: false, - }, -]; +export const dotMap = { + [K8sCategory.HOSTS]: 'system.cpu.load_average.15m', + [K8sCategory.PODS]: 'k8s.pod.cpu.utilization', + [K8sCategory.NODES]: 'k8s.node.cpu.utilization', + [K8sCategory.NAMESPACES]: 'k8s.pod.cpu.utilization', + [K8sCategory.CLUSTERS]: 'k8s.node.cpu.utilization', + [K8sCategory.DEPLOYMENTS]: 'k8s.pod.cpu.utilization', + [K8sCategory.STATEFULSETS]: 'k8s.pod.cpu.utilization', + [K8sCategory.DAEMONSETS]: 'k8s.pod.cpu.utilization', + [K8sCategory.CONTAINERS]: 'k8s.pod.cpu.utilization', + [K8sCategory.JOBS]: 'k8s.job.desired_successful_pods', + [K8sCategory.VOLUMES]: 'k8s.volume.capacity', +}; -export const NodesQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Node Name', - attributeKey: { - key: 'k8s_node_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; +export function GetK8sEntityToAggregateAttribute( + category: K8sCategory, + dotMetricsEnabled: boolean, +): string { + return dotMetricsEnabled ? dotMap[category] : underscoreMap[category]; +} -export const NamespaceQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; +export function GetPodsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const podKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const nodeKey = dotMetricsEnabled ? 'k8s.node.name' : 'k8s_node_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const deploymentKey = dotMetricsEnabled + ? 'k8s.deployment.name' + : 'k8s_deployment_name'; + const statefulsetKey = dotMetricsEnabled + ? 'k8s.statefulset.name' + : 'k8s_statefulset_name'; + const daemonsetKey = dotMetricsEnabled + ? 'k8s.daemonset.name' + : 'k8s_daemonset_name'; + const jobKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name'; -export const ClustersQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; + // Define aggregate attribute (metric) name + const cpuUtilizationMetric = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; -export const ContainersQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Container', - attributeKey: { - key: 'k8s_container_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + return [ + { + type: FiltersType.CHECKBOX, + title: 'Pod', + attributeKey: { + key: podKey, + dataType: DataTypes.String, + type: 'tag', + isColumn: false, + isJSON: false, + id: `${podKey}--string--tag--true`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - defaultOpen: true, - }, -]; + { + type: FiltersType.CHECKBOX, + title: 'Namespace', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${namespaceKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'Node', + attributeKey: { + key: nodeKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${nodeKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'Deployment', + attributeKey: { + key: deploymentKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${deploymentKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'Statefulset', + attributeKey: { + key: statefulsetKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${statefulsetKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'DaemonSet', + attributeKey: { + key: daemonsetKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${daemonsetKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + { + type: FiltersType.CHECKBOX, + title: 'Job', + attributeKey: { + key: jobKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${jobKey}--string--resource--false`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilizationMetric, + dataSource: DataSource.METRICS, + defaultOpen: false, + }, + ]; +} -export const VolumesQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'PVC Volume Claim Name', - attributeKey: { - key: 'k8s_persistentvolumeclaim_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_volume_capacity', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_volume_capacity', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_volume_capacity', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; +export function GetNodesQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + // Define attribute keys + const nodeKey = dotMetricsEnabled ? 'k8s.node.name' : 'k8s_node_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; -export const DeploymentsQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Deployment Name', - attributeKey: { - key: 'k8s_deployment_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; + // Define aggregate metric name for node CPU utilization + const cpuUtilMetric = dotMetricsEnabled + ? 'k8s.node.cpu.utilization' + : 'k8s_node_cpu_utilization'; -export const StatefulsetsQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Statefulset Name', - attributeKey: { - key: 'k8s_statefulset_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + return [ + { + type: FiltersType.CHECKBOX, + title: 'Node Name', + attributeKey: { + key: nodeKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${nodeKey}--string--resource--true`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource--true`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; + ]; +} -export const DaemonSetsQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'DaemonSet Name', - attributeKey: { - key: 'k8s_daemonset_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, - }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; +export function GetNamespaceQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const cpuUtilMetric = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; -export const JobsQuickFiltersConfig: IQuickFiltersConfig[] = [ - { - type: FiltersType.CHECKBOX, - title: 'Job Name', - attributeKey: { - key: 'k8s_job_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + return [ + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${namespaceKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Namespace Name', - attributeKey: { - key: 'k8s_namespace_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, - { - type: FiltersType.CHECKBOX, - title: 'Cluster Name', - attributeKey: { - key: 'k8s_cluster_name', - dataType: DataTypes.String, - type: 'resource', - isColumn: false, - isJSON: false, + ]; +} + +export function GetClustersQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const cpuUtilMetric = dotMetricsEnabled + ? 'k8s.node.cpu.utilization' + : 'k8s_node_cpu_utilization'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: cpuUtilMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, }, - aggregateOperator: 'noop', - aggregateAttribute: 'k8s_pod_cpu_utilization', - dataSource: DataSource.METRICS, - defaultOpen: true, - }, -]; + ]; +} + +export function GetContainersQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const containerKey = dotMetricsEnabled + ? 'k8s.container.name' + : 'k8s_container_name'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Container', + attributeKey: { + key: containerKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${containerKey}--string--resource`, + }, + defaultOpen: true, + }, + ]; +} + +export function GetVolumesQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const pvcKey = dotMetricsEnabled + ? 'k8s.persistentvolumeclaim.name' + : 'k8s_persistentvolumeclaim_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const volumeMetric = dotMetricsEnabled + ? 'k8s.volume.capacity' + : 'k8s_volume_capacity'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'PVC Volume Claim Name', + attributeKey: { + key: pvcKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${pvcKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: volumeMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${namespaceKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: volumeMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: volumeMetric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} + +export function GetDeploymentsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const deployKey = dotMetricsEnabled + ? 'k8s.deployment.name' + : 'k8s_deployment_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const metric = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Deployment Name', + attributeKey: { + key: deployKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${deployKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${namespaceKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} + +export function GetStatefulsetsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const ssKey = dotMetricsEnabled + ? 'k8s.statefulset.name' + : 'k8s_statefulset_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const metric = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Statefulset Name', + attributeKey: { + key: ssKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${ssKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${namespaceKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${clusterKey}--string--resource`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metric, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} + +export function GetDaemonsetsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const nameKey = dotMetricsEnabled + ? 'k8s.daemonset.name' + : 'k8s_daemonset_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const metricName = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'DaemonSet Name', + attributeKey: { + key: nameKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${nameKey}--string--resource--true`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} + +export function GetJobsQuickFiltersConfig( + dotMetricsEnabled: boolean, +): IQuickFiltersConfig[] { + const nameKey = dotMetricsEnabled ? 'k8s.job.name' : 'k8s_job_name'; + const namespaceKey = dotMetricsEnabled + ? 'k8s.namespace.name' + : 'k8s_namespace_name'; + const clusterKey = dotMetricsEnabled ? 'k8s.cluster.name' : 'k8s_cluster_name'; + const metricName = dotMetricsEnabled + ? 'k8s.pod.cpu.utilization' + : 'k8s_pod_cpu_utilization'; + + return [ + { + type: FiltersType.CHECKBOX, + title: 'Job Name', + attributeKey: { + key: nameKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + id: `${nameKey}--string--resource--true`, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Namespace Name', + attributeKey: { + key: namespaceKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + { + type: FiltersType.CHECKBOX, + title: 'Cluster Name', + attributeKey: { + key: clusterKey, + dataType: DataTypes.String, + type: 'resource', + isColumn: false, + isJSON: false, + }, + aggregateOperator: 'noop', + aggregateAttribute: metricName, + dataSource: DataSource.METRICS, + defaultOpen: true, + }, + ]; +} export const getInvalidValueTooltipText = ( entity: K8sCategory, diff --git a/frontend/src/container/InfraMonitoringK8s/utils.tsx b/frontend/src/container/InfraMonitoringK8s/utils.tsx index fae703aaf8..976bda2ffa 100644 --- a/frontend/src/container/InfraMonitoringK8s/utils.tsx +++ b/frontend/src/container/InfraMonitoringK8s/utils.tsx @@ -299,6 +299,19 @@ export const getK8sPodsListColumns = ( return updatedColumnsConfig as ColumnType[]; }; +const dotToUnder: Record = { + 'k8s.cronjob.name': 'k8s_cronjob_name', + 'k8s.daemonset.name': 'k8s_daemonset_name', + 'k8s.deployment.name': 'k8s_deployment_name', + 'k8s.job.name': 'k8s_job_name', + 'k8s.namespace.name': 'k8s_namespace_name', + 'k8s.node.name': 'k8s_node_name', + 'k8s.pod.name': 'k8s_pod_name', + 'k8s.pod.uid': 'k8s_pod_uid', + 'k8s.statefulset.name': 'k8s_statefulset_name', + 'k8s.cluster.name': 'k8s_cluster_name', +}; + const getGroupByEle = ( pod: K8sPodsData, groupBy: IBuilderQuery['groupBy'], @@ -306,7 +319,13 @@ const getGroupByEle = ( const groupByValues: string[] = []; groupBy.forEach((group) => { - groupByValues.push(pod.meta[group.key as keyof typeof pod.meta]); + const rawKey = group.key as string; + + // Choose mapped key if present, otherwise use rawKey + const metaKey = (dotToUnder[rawKey] ?? rawKey) as keyof typeof pod.meta; + const value = pod.meta[metaKey]; + + groupByValues.push(value); }); return ( diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsx index af07d16444..d25f58cd2b 100644 --- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx +++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx @@ -22,7 +22,7 @@ import { } from 'antd'; import { TableProps } from 'antd/lib'; import logEvent from 'api/common/logEvent'; -import createDashboard from 'api/dashboard/create'; +import createDashboard from 'api/v1/dashboards/create'; import { AxiosError } from 'axios'; import cx from 'classnames'; import { ENTITY_VERSION_V4 } from 'constants/app'; @@ -63,6 +63,7 @@ import { import { handleContactSupport } from 'pages/Integrations/utils'; import { useAppContext } from 'providers/App/App'; import { useDashboard } from 'providers/Dashboard/Dashboard'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { useTimezone } from 'providers/Timezone'; import { ChangeEvent, @@ -83,6 +84,7 @@ import { WidgetRow, Widgets, } from 'types/api/dashboard/getAll'; +import APIError from 'types/api/error'; import DashboardTemplatesModal from './DashboardTemplates/DashboardTemplatesModal'; import ImportJSON from './ImportJSON'; @@ -226,7 +228,7 @@ function DashboardsList(): JSX.Element { useEffect(() => { const filteredDashboards = filterDashboard( searchString, - dashboardListResponse || [], + dashboardListResponse?.data || [], ); if (sortOrder.columnKey === 'updatedAt') { sortDashboardsByUpdatedAt(filteredDashboards || []); @@ -256,17 +258,19 @@ function DashboardsList(): JSX.Element { errorMessage: '', }); + const { showErrorModal } = useErrorModal(); + const data: Data[] = dashboards?.map((e) => ({ createdAt: e.createdAt, description: e.data.description || '', - id: e.uuid, + id: e.id, lastUpdatedTime: e.updatedAt, name: e.data.title, tags: e.data.tags || [], - key: e.uuid, + key: e.id, createdBy: e.createdBy, - isLocked: !!e.isLocked || false, + isLocked: !!e.locked || false, lastUpdatedBy: e.updatedBy, image: e.data.image || Base64Icons[0], variables: e.data.variables, @@ -292,28 +296,20 @@ function DashboardsList(): JSX.Element { version: ENTITY_VERSION_V4, }); - if (response.statusCode === 200) { - safeNavigate( - generatePath(ROUTES.DASHBOARD, { - dashboardId: response.payload.uuid, - }), - ); - } else { - setNewDashboardState({ - ...newDashboardState, - loading: false, - error: true, - errorMessage: response.error || 'Something went wrong', - }); - } + safeNavigate( + generatePath(ROUTES.DASHBOARD, { + dashboardId: response.data.id, + }), + ); } catch (error) { + showErrorModal(error as APIError); setNewDashboardState({ ...newDashboardState, error: true, errorMessage: (error as AxiosError).toString() || 'Something went Wrong', }); } - }, [newDashboardState, safeNavigate, t]); + }, [newDashboardState, safeNavigate, showErrorModal, t]); const onModalHandler = (uploadedGrafana: boolean): void => { logEvent('Dashboard List: Import JSON clicked', {}); @@ -327,7 +323,7 @@ function DashboardsList(): JSX.Element { const searchText = (event as React.BaseSyntheticEvent)?.target?.value || ''; const filteredDashboards = filterDashboard( searchText, - dashboardListResponse || [], + dashboardListResponse?.data || [], ); setDashboards(filteredDashboards); setIsFilteringDashboards(false); @@ -677,7 +673,7 @@ function DashboardsList(): JSX.Element { !isUndefined(dashboardListResponse) ) { logEvent('Dashboard List: Page visited', { - number: dashboardListResponse?.length, + number: dashboardListResponse?.data?.length, }); logEventCalledRef.current = true; } diff --git a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx index 1ea39e0239..7f5f980666 100644 --- a/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx +++ b/frontend/src/container/ListOfDashboard/ImportJSON/index.tsx @@ -14,19 +14,21 @@ import { UploadProps, } from 'antd'; import logEvent from 'api/common/logEvent'; -import createDashboard from 'api/dashboard/create'; +import createDashboard from 'api/v1/dashboards/create'; import ROUTES from 'constants/routes'; import { useIsDarkMode } from 'hooks/useDarkMode'; import { useNotifications } from 'hooks/useNotifications'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import { getUpdatedLayout } from 'lib/dashboard/getUpdatedLayout'; import { ExternalLink, Github, MonitorDot, MoveRight, X } from 'lucide-react'; +import { useErrorModal } from 'providers/ErrorModalProvider'; // #TODO: Lucide will be removing brand icons like GitHub in the future. In that case, we can use Simple Icons. https://simpleicons.org/ // See more: https://github.com/lucide-icons/lucide/issues/94 import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { generatePath } from 'react-router-dom'; import { DashboardData } from 'types/api/dashboard/getAll'; +import APIError from 'types/api/error'; function ImportJSON({ isImportJSONModalVisible, @@ -74,6 +76,8 @@ function ImportJSON({ } }; + const { showErrorModal } = useErrorModal(); + const onClickLoadJsonHandler = async (): Promise => { try { setDashboardCreating(true); @@ -81,11 +85,6 @@ function ImportJSON({ const dashboardData = JSON.parse(editorValue) as DashboardData; - // Remove uuid from the dashboard data, in all cases - empty, duplicate or any valid not duplicate uuid - if (dashboardData.uuid !== undefined) { - delete dashboardData.uuid; - } - if (dashboardData?.layout) { dashboardData.layout = getUpdatedLayout(dashboardData.layout); } else { @@ -97,28 +96,19 @@ function ImportJSON({ uploadedGrafana, }); - if (response.statusCode === 200) { - safeNavigate( - generatePath(ROUTES.DASHBOARD, { - dashboardId: response.payload.uuid, - }), - ); - logEvent('Dashboard List: New dashboard imported successfully', { - dashboardId: response.payload?.uuid, - dashboardName: response.payload?.data?.title, - }); - } else { - setIsCreateDashboardError(true); - notifications.error({ - message: - response.error || - t('something_went_wrong', { - ns: 'common', - }), - }); - } + safeNavigate( + generatePath(ROUTES.DASHBOARD, { + dashboardId: response.data.id, + }), + ); + logEvent('Dashboard List: New dashboard imported successfully', { + dashboardId: response.data?.id, + dashboardName: response.data?.data?.title, + }); + setDashboardCreating(false); } catch (error) { + showErrorModal(error as APIError); setDashboardCreating(false); setIsCreateDashboardError(true); notifications.error({ diff --git a/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts b/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts index a77cf8ccb5..e15e6bfa0c 100644 --- a/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts +++ b/frontend/src/container/ListOfDashboard/SearchFilter/__tests__/utils.test.ts @@ -6,8 +6,7 @@ import { executeSearchQueries } from '../utils'; describe('executeSearchQueries', () => { const firstDashboard: Dashboard = { - id: 11111, - uuid: uuid(), + id: uuid(), createdAt: '', updatedAt: '', createdBy: '', @@ -18,8 +17,7 @@ describe('executeSearchQueries', () => { }, }; const secondDashboard: Dashboard = { - id: 22222, - uuid: uuid(), + id: uuid(), createdAt: '', updatedAt: '', createdBy: '', @@ -30,8 +28,7 @@ describe('executeSearchQueries', () => { }, }; const thirdDashboard: Dashboard = { - id: 333333, - uuid: uuid(), + id: uuid(), createdAt: '', updatedAt: '', createdBy: '', diff --git a/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx b/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx index 3c300e143d..17ccc9b921 100644 --- a/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx +++ b/frontend/src/container/ListOfDashboard/TableComponents/DeleteButton.tsx @@ -59,7 +59,7 @@ export function DeleteButton({ onClick: (e) => { e.preventDefault(); e.stopPropagation(); - deleteDashboardMutation.mutateAsync(undefined, { + deleteDashboardMutation.mutate(undefined, { onSuccess: () => { notifications.success({ message: t('dashboard:delete_dashboard_success', { diff --git a/frontend/src/container/ListOfDashboard/dashboardSearchAndFilter.ts b/frontend/src/container/ListOfDashboard/dashboardSearchAndFilter.ts index 9e10994c4e..324bf11fc9 100644 --- a/frontend/src/container/ListOfDashboard/dashboardSearchAndFilter.ts +++ b/frontend/src/container/ListOfDashboard/dashboardSearchAndFilter.ts @@ -14,7 +14,7 @@ export const generateSearchData = ( dashboards.forEach((dashboard) => { dashboardSearchData.push({ - id: dashboard.uuid, + id: dashboard.id, title: dashboard.data.title, description: dashboard.data.description, tags: dashboard.data.tags || [], diff --git a/frontend/src/container/LogDetailedView/InfraMetrics/NodeMetrics.tsx b/frontend/src/container/LogDetailedView/InfraMetrics/NodeMetrics.tsx index 8c46d572fd..b62bd3c5b6 100644 --- a/frontend/src/container/LogDetailedView/InfraMetrics/NodeMetrics.tsx +++ b/frontend/src/container/LogDetailedView/InfraMetrics/NodeMetrics.tsx @@ -15,6 +15,8 @@ import { SuccessResponse } from 'types/api'; import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange'; import uPlot from 'uplot'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { getHostQueryPayload, getNodeQueryPayload, @@ -49,12 +51,23 @@ function NodeMetrics({ }; }, [logLineTimestamp]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const queryPayloads = useMemo(() => { if (nodeName) { - return getNodeQueryPayload(clusterName, nodeName, start, end); + return getNodeQueryPayload( + clusterName, + nodeName, + start, + end, + dotMetricsEnabled, + ); } - return getHostQueryPayload(hostName, start, end); - }, [nodeName, hostName, clusterName, start, end]); + return getHostQueryPayload(hostName, start, end, dotMetricsEnabled); + }, [nodeName, hostName, clusterName, start, end, dotMetricsEnabled]); const widgetInfo = nodeName ? nodeWidgetInfo : hostWidgetInfo; const queries = useQueries( diff --git a/frontend/src/container/LogDetailedView/InfraMetrics/PodMetrics.tsx b/frontend/src/container/LogDetailedView/InfraMetrics/PodMetrics.tsx index bb6ff0b654..00cdb4d196 100644 --- a/frontend/src/container/LogDetailedView/InfraMetrics/PodMetrics.tsx +++ b/frontend/src/container/LogDetailedView/InfraMetrics/PodMetrics.tsx @@ -8,6 +8,7 @@ import { useResizeObserver } from 'hooks/useDimensions'; import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults'; import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions'; import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData'; +import { useAppContext } from 'providers/App/App'; import { useTimezone } from 'providers/Timezone'; import { useMemo, useRef } from 'react'; import { useQueries, UseQueryResult } from 'react-query'; @@ -15,6 +16,7 @@ import { SuccessResponse } from 'types/api'; import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange'; import uPlot from 'uplot'; +import { FeatureKeys } from '../../../constants/features'; import { getPodQueryPayload, podWidgetInfo } from './constants'; function PodMetrics({ @@ -41,9 +43,15 @@ function PodMetrics({ verticalLineTimestamp: logTimestamp.unix(), }; }, [logLineTimestamp]); + + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const queryPayloads = useMemo( - () => getPodQueryPayload(clusterName, podName, start, end), - [clusterName, end, podName, start], + () => getPodQueryPayload(clusterName, podName, start, end, dotMetricsEnabled), + [clusterName, end, podName, start, dotMetricsEnabled], ); const queries = useQueries( queryPayloads.map((payload) => ({ diff --git a/frontend/src/container/LogDetailedView/InfraMetrics/constants.ts b/frontend/src/container/LogDetailedView/InfraMetrics/constants.ts index 39130e7f56..ea9ada6d8e 100644 --- a/frontend/src/container/LogDetailedView/InfraMetrics/constants.ts +++ b/frontend/src/container/LogDetailedView/InfraMetrics/constants.ts @@ -10,2953 +10,2645 @@ export const getPodQueryPayload = ( podName: string, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6e050953', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '60fe5e62', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '9b92756a-b445-45f8-90f4-d26f3ef28f8f', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'a4250695', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '3b2bc32b', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'a22c1e03-4876-4b3e-9a96-a3c3a28f9c0f', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '8426b52f', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '2f67240c', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '8c4667e1', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: 'b16e7306', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'in', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A*100/B', - legend: '{{k8s_pod_name}}', - queryName: 'F1', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '7bb3a6f5-d1c6-4f2e-9cc9-7dcc46db398f', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_cpu_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_cpu_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '0a862947', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: 'cd13fbf0', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: 'usage - {{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_cpu_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_cpu_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: 'bfb8acf7', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: 'e09ba819', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'in', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: 'limit - {{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A*100/B', - legend: '{{k8s_pod_name}}', - queryName: 'F1', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '6d5ccd81-0ea1-4fb9-a66b-7f0fe2f15165', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'ea3df3e7', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '39b21fe0', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'in', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_request--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_request', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '7401a4b9', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '7cdad1cb', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A*100/B', - legend: '{{k8s_pod_name}}', - queryName: 'F1', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '4d03a0ff-4fa5-4b19-b397-97f80ba9e0ac', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sClusterNameKey = dotMetricsEnabled + ? 'k8s.cluster.name' + : 'k8s_cluster_name'; + const k8sPodNameKey = dotMetricsEnabled ? 'k8s.pod.name' : 'k8s_pod_name'; + const containerCpuUtilKey = dotMetricsEnabled + ? 'container.cpu.utilization' + : 'container_cpu_utilization'; + const containerMemUsageKey = dotMetricsEnabled + ? 'container.memory.usage' + : 'container_memory_usage'; + const k8sContainerCpuReqKey = dotMetricsEnabled + ? 'k8s.container.cpu_request' + : 'k8s_container_cpu_request'; + const k8sContainerCpuLimitKey = dotMetricsEnabled + ? 'k8s.container.cpu_limit' + : 'k8s_container_cpu_limit'; + const k8sContainerMemReqKey = dotMetricsEnabled + ? 'k8s.container.memory_request' + : 'k8s_container_memory_request'; + const k8sContainerMemLimitKey = dotMetricsEnabled + ? 'k8s.container.memory_limit' + : 'k8s_container_memory_limit'; + const k8sPodFsAvailKey = dotMetricsEnabled + ? 'k8s.pod.filesystem.available' + : 'k8s_pod_filesystem_available'; + const k8sPodFsCapKey = dotMetricsEnabled + ? 'k8s.pod.filesystem.capacity' + : 'k8s_pod_filesystem_capacity'; + const k8sPodNetIoKey = dotMetricsEnabled + ? 'k8s.pod.network.io' + : 'k8s_pod_network_io'; + const podLegendTemplate = dotMetricsEnabled + ? '{{k8s.pod.name}}' + : '{{k8s_pod_name}}'; + const podLegendUsage = dotMetricsEnabled + ? 'usage - {{k8s.pod.name}}' + : 'usage - {{k8s_pod_name}}'; + const podLegendLimit = dotMetricsEnabled + ? 'limit - {{k8s.pod.name}}' + : 'limit - {{k8s_pod_name}}'; - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'container_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'container_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'f2a3175c', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerCpuUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '6e050953', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: 'fc17ff21', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', + { + id: '60fe5e62', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, }, - op: '=', - value: podName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: podLegendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_container_memory_limit--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_container_memory_limit', - type: 'Gauge', - }, - aggregateOperator: 'latest', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '175e96b7', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '1d9fbe48', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: 'in', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'k8s_pod_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'latest', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A*100/B', - legend: '{{k8s_pod_name}}', - queryName: 'F1', - }, - ], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '9b92756a-b445-45f8-90f4-d26f3ef28f8f', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'ad491f19-0f83-4dd4-bb8f-bec295c18d1b', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_filesystem_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_filesystem_available', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '877385bf', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '877385cd', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', - }, - op: '=', - value: podName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_usage--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + key: containerMemUsageKey, + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_filesystem_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_filesystem_capacity', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '877385bf', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'a4250695', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: '877385cd', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', + { + id: '3b2bc32b', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, }, - op: '=', - value: podName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: podLegendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'a22c1e03-4876-4b3e-9a96-a3c3a28f9c0f', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_cpu_utilization--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_pod_name', - type: 'tag', + key: containerCpuUtilKey, + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: '(B-A)/B', - legend: '{{k8s_pod_name}}', - queryName: 'F1', - }, - ], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '16908d4e-1565-4847-8d87-01ebb8fc494a', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - fillGaps: false, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_pod_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_pod_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '877385bf', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: '8426b52f', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: '9613b4da', - key: { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', + { + id: '2f67240c', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, }, - op: '=', - value: podName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_pod_name--string--tag--false', - isColumn: false, - key: 'k8s_pod_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuReqKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{k8s_pod_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '8c4667e1', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: 'b16e7306', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'in', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A*100/B', + legend: podLegendTemplate, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '7bb3a6f5-d1c6-4f2e-9cc9-7dcc46db398f', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '4b255d6d-4cde-474d-8866-f4418583c18b', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_cpu_utilization--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerCpuUtilKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: '0a862947', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: 'cd13fbf0', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: podLegendUsage, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_cpu_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerCpuLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'bfb8acf7', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: 'e09ba819', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'in', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: podLegendLimit, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A*100/B', + legend: podLegendTemplate, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '6d5ccd81-0ea1-4fb9-a66b-7f0fe2f15165', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'ea3df3e7', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '39b21fe0', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'in', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_request--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemReqKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '7401a4b9', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '7cdad1cb', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A*100/B', + legend: podLegendTemplate, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '4d03a0ff-4fa5-4b19-b397-97f80ba9e0ac', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'container_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: containerMemUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'f2a3175c', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: 'fc17ff21', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_container_memory_limit--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sContainerMemLimitKey, + type: 'Gauge', + }, + aggregateOperator: 'latest', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '175e96b7', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '1d9fbe48', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: 'in', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'latest', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A*100/B', + legend: podLegendTemplate, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'ad491f19-0f83-4dd4-bb8f-bec295c18d1b', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_filesystem_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodFsAvailKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: '877385bf', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '877385cd', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_filesystem_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sPodFsCapKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: '877385bf', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '877385cd', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: '(B-A)/B', + legend: podLegendTemplate, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '16908d4e-1565-4847-8d87-01ebb8fc494a', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + fillGaps: false, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_pod_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sPodNetIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: '877385bf', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, + }, + { + id: '9613b4da', + key: { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + op: '=', + value: podName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_pod_name--string--tag--false', + isColumn: false, + key: k8sPodNameKey, + type: 'tag', + }, + ], + having: [], + legend: podLegendTemplate, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '4b255d6d-4cde-474d-8866-f4418583c18b', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + ]; +}; export const getNodeQueryPayload = ( clusterName: string, nodeName: string, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_cpu_time--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_cpu_time', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '91223422', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', - }, - op: '=', - value: clusterName, - }, - { - id: '91223422', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: 'in', - value: nodeName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const k8sClusterNameKey = dotMetricsEnabled + ? 'k8s.cluster.name' + : 'k8s_cluster_name'; + const k8sNodeNameKey = dotMetricsEnabled ? 'k8s.node.name' : 'k8s_node_name'; + const k8sNodeCpuTimeKey = dotMetricsEnabled + ? 'k8s.node.cpu.time' + : 'k8s_node_cpu_time'; + const k8sNodeAllocCpuKey = dotMetricsEnabled + ? 'k8s.node.allocatable_cpu' + : 'k8s_node_allocatable_cpu'; + const k8sNodeMemWsKey = dotMetricsEnabled + ? 'k8s.node.memory.working_set' + : 'k8s_node_memory_working_set'; + const k8sNodeAllocMemKey = dotMetricsEnabled + ? 'k8s.node.allocatable_memory' + : 'k8s_node_allocatable_memory'; + const k8sNodeNetIoKey = dotMetricsEnabled + ? 'k8s.node.network.io' + : 'k8s_node_network_io'; + const k8sNodeFsAvailKey = dotMetricsEnabled + ? 'k8s.node.filesystem.available' + : 'k8s_node_filesystem_available'; + const k8sNodeFsCapKey = dotMetricsEnabled + ? 'k8s.node.filesystem.capacity' + : 'k8s_node_filesystem_capacity'; + const podLegend = dotMetricsEnabled + ? '{{k8s.node.name}}' + : '{{k8s_node_name}}'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_cpu_time--float64--Sum--true', + isColumn: true, isJSON: false, - key: 'k8s_node_name', - type: 'tag', + key: k8sNodeCpuTimeKey, + type: 'Sum', }, - ], - having: [], - legend: '{{k8s_node_name}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_cpu--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_cpu', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '9700f1d4', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'c_cluster', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: 'in', - value: nodeName, + { + id: 'c_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: podLegend, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_cpu--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'k8s_node_name', - type: 'tag', + key: k8sNodeAllocCpuKey, + type: 'Gauge', }, - ], - having: [], - legend: '{{k8s_node_name}}', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: '{{k8s_node_name}}', - queryName: 'F1', - }, - ], + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'cpu_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + isJSON: false, + key: k8sNodeNameKey, + type: 'tag', + }, + ], + having: [], + legend: podLegend, + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: podLegend, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '259295b5-774d-4b2e-8a4f-e5dd63e6c38d', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '259295b5-774d-4b2e-8a4f-e5dd63e6c38d', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + fillGaps: false, + formatForWeb: false, + start, + end, }, - variables: {}, - fillGaps: false, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_memory_working_set--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_memory_working_set', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'a9f58cf3', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_memory_working_set--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeMemWsKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'mem_cluster', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: '8430c9a0', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + { + id: 'mem_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, }, - op: 'in', - value: nodeName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_allocatable_memory--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeAllocMemKey, + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_allocatable_memory--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_allocatable_memory', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: 'cb274856', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'alloc_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, }, - op: 'in', - value: nodeName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: '{{k8s_node_name}}', - queryName: 'F1', - }, - ], + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: podLegend, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '486af4da-2a1a-4b8f-992c-eba098d3a6f9', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '486af4da-2a1a-4b8f-992c-eba098d3a6f9', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + fillGaps: false, + formatForWeb: false, + start, + end, }, - variables: {}, - fillGaps: false, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '91223422', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: k8sNodeNetIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'net_cluster', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, + { + id: 'net_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'interface--string--tag--false', + isColumn: false, + key: 'interface', + type: 'tag', }, { - id: '66308505', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', - }, - op: 'in', - value: nodeName, + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: `${podLegend}-{{interface}}-{{direction}}`, + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'interface--string--tag--false', - isColumn: false, - key: 'interface', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', - }, - ], - having: [], - legend: '{{k8s_node_name}}-{{interface}}-{{direction}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'b56143c0-7d2f-4425-97c5-65ad6fc87366', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'b56143c0-7d2f-4425-97c5-65ad6fc87366', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_available--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_available', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: '91223422', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_available--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFsAvailKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'fs_cluster', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: 'a5dffef6', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + { + id: 'fs_node', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, }, - op: 'in', - value: nodeName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'k8s_node_filesystem_capacity--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: k8sNodeFsCapKey, + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'k8s_node_filesystem_capacity--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'k8s_node_filesystem_capacity', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '91223422', - key: { - dataType: DataTypes.String, - id: 'k8s_cluster_name--string--tag--false', - isColumn: false, - key: 'k8s_cluster_name', - type: 'tag', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'fs_clusterB', + key: { + dataType: DataTypes.String, + id: 'k8s_cluster_name--string--tag--false', + isColumn: false, + key: k8sClusterNameKey, + type: 'tag', + }, + op: '=', + value: clusterName, }, - op: '=', - value: clusterName, - }, - { - id: 'c79d5a16', - key: { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', + { + id: 'fs_nodeB', + key: { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', + }, + op: 'in', + value: nodeName, }, - op: 'in', - value: nodeName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'k8s_node_name--string--tag--false', + isColumn: false, + key: k8sNodeNameKey, + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'sum', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'k8s_node_name--string--tag--false', - isColumn: false, - key: 'k8s_node_name', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'sum', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: '(B-A)/B', - legend: '{{k8s_node_name}}', - queryName: 'F1', - }, - ], + ], + queryFormulas: [ + { + disabled: false, + expression: '(B-A)/B', + legend: podLegend, + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '57eeac15-615c-4a71-9c61-8e0c0c76b045', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '57eeac15-615c-4a71-9c61-8e0c0c76b045', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + ]; +}; export const getHostQueryPayload = ( hostName: string, start: number, end: number, -): GetQueryResultsProps[] => [ - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_cpu_time--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_cpu_time', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'A', - filters: { - items: [ - { - id: 'ad316791', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', - }, - op: '=', - value: hostName, - }, - ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'state--string--tag--false', - isColumn: false, + dotMetricsEnabled: boolean, +): GetQueryResultsProps[] => { + const hostNameKey = dotMetricsEnabled ? 'host.name' : 'host_name'; + const cpuTimeKey = dotMetricsEnabled ? 'system.cpu.time' : 'system_cpu_time'; + const memUsageKey = dotMetricsEnabled + ? 'system.memory.usage' + : 'system_memory_usage'; + const load1mKey = dotMetricsEnabled + ? 'system.cpu.load_average.1m' + : 'system_cpu_load_average_1m'; + const load5mKey = dotMetricsEnabled + ? 'system.cpu.load_average.5m' + : 'system_cpu_load_average_5m'; + const load15mKey = dotMetricsEnabled + ? 'system.cpu.load_average.15m' + : 'system_cpu_load_average_15m'; + const netIoKey = dotMetricsEnabled ? 'system.network.io' : 'system_network_io'; + const netPktsKey = dotMetricsEnabled + ? 'system.network.packets' + : 'system_network_packets'; + const netErrKey = dotMetricsEnabled + ? 'system.network.errors' + : 'system_network_errors'; + const netDropKey = dotMetricsEnabled + ? 'system.network.dropped' + : 'system_network_dropped'; + const netConnKey = dotMetricsEnabled + ? 'system.network.connections' + : 'system_network_connections'; + const diskIoKey = dotMetricsEnabled ? 'system.disk.io' : 'system_disk_io'; + const diskOpTimeKey = dotMetricsEnabled + ? 'system.disk.operation_time' + : 'system_disk_operation_time'; + const diskPendingKey = dotMetricsEnabled + ? 'system.disk.pending_operations' + : 'system_disk_pending_operations'; + + return [ + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_cpu_time--float64--Sum--true', + isColumn: true, isJSON: false, - key: 'state', - type: 'tag', + key: cpuTimeKey, + type: 'Sum', }, - ], - having: [], - legend: '{{state}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_cpu_time--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_cpu_time', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: true, - expression: 'B', - filters: { - items: [ - { - id: '6baf116b', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'A', + filters: { + items: [ + { + id: 'cpu_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'state--string--tag--false', + isColumn: false, + isJSON: false, + key: 'state', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{state}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [], - having: [], - legend: '{{state}}', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [ - { - disabled: false, - expression: 'A/B', - legend: '{{state}}', - queryName: 'F1', - }, - ], + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_cpu_time--float64--Sum--true', + isColumn: true, + isJSON: false, + key: cpuTimeKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: true, + expression: 'B', + filters: { + items: [ + { + id: 'cpu_f2', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: '{{state}}', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [ + { + disabled: false, + expression: 'A/B', + legend: '{{state}}', + queryName: 'F1', + }, + ], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '315b15fa-ff0c-442f-89f8-2bf4fb1af2f2', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '315b15fa-ff0c-442f-89f8-2bf4fb1af2f2', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_memory_usage--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_memory_usage', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '8026009e', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_memory_usage--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: memUsageKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'mem_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'state--string--tag--false', + isColumn: false, + isJSON: false, + key: 'state', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{state}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'state--string--tag--false', - isColumn: false, - isJSON: false, - key: 'state', - type: 'tag', - }, - ], - having: [], - legend: '{{state}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '40218bfb-a9b7-4974-aead-5bf666e139bf', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '40218bfb-a9b7-4974-aead-5bf666e139bf', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_cpu_load_average_1m--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_cpu_load_average_1m', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '4167fbb1', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_cpu_load_average_1m--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: load1mKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'load1m_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: '1m', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: '1m', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_cpu_load_average_5m--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_cpu_load_average_5m', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [ - { - id: '0c2cfeca', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_cpu_load_average_5m--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: load5mKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { + items: [ + { + id: 'load5m_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: '5m', + limit: 30, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: '5m', - limit: 30, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_cpu_load_average_15m--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_cpu_load_average_15m', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'C', - filters: { - items: [ - { - id: '28693375', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_cpu_load_average_15m--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: load15mKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'C', + filters: { + items: [ + { + id: 'load15m_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, - }, - ], - op: 'AND', + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: '15m', + limit: 30, + orderBy: [], + queryName: 'C', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: '15m', - limit: 30, - orderBy: [], - queryName: 'C', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '8e6485ea-7018-43b0-ab27-b210f77b59ad', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '8e6485ea-7018-43b0-ab27-b210f77b59ad', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_network_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_network_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '3a03bc80', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_network_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: netIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'netio_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', }, ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - ], - having: [ - { - columnName: 'SUM(system_network_io)', - op: '>', - value: 0, - }, - ], - legend: '{{device}}::{{direction}}', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '47173220-44df-4ef6-87f4-31e333c180c7', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_network_packets--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_network_packets', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ + having: [ { - id: '3082ef53', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', - }, - op: '=', - value: hostName, + columnName: `SUM(${netIoKey})`, + op: '>', + value: 0, }, ], - op: 'AND', + legend: '{{device}}::{{direction}}', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - ], - having: [], - legend: '{{device}}::{{direction}}', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '47173220-44df-4ef6-87f4-31e333c180c7', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '62eedbc6-c8ad-4d13-80a8-129396e1d1dc', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_network_errors--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_network_errors', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '8859bc50', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_network_packets--float64--Sum--true', + isColumn: true, + isJSON: false, + key: netPktsKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'netpkts_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{device}}::{{direction}}', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - ], - having: [], - legend: '{{device}}::{{direction}}', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '62eedbc6-c8ad-4d13-80a8-129396e1d1dc', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '5ddb1b38-53bb-46f5-b4fe-fe832d6b9b24', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_network_dropped--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_network_dropped', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '40fec2e3', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_network_errors--float64--Sum--true', + isColumn: true, + isJSON: false, + key: netErrKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'neterr_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{device}}::{{direction}}', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - ], - having: [], - legend: '{{device}}::{{direction}}', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '5ddb1b38-53bb-46f5-b4fe-fe832d6b9b24', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'a849bcce-7684-4852-9134-530b45419b8f', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_network_connections--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_network_connections', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '87f665b5', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_network_dropped--float64--Sum--true', + isColumn: true, + isJSON: false, + key: netDropKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'netdrop_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{device}}::{{direction}}', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'protocol--string--tag--false', - isColumn: false, - isJSON: false, - key: 'protocol', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'state--string--tag--false', - isColumn: false, - isJSON: false, - key: 'state', - type: 'tag', - }, - ], - having: [], - legend: '{{protocol}}::{{state}}', - limit: 30, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'a849bcce-7684-4852-9134-530b45419b8f', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'ab685a3d-fa4c-4663-8d94-c452e59038f3', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_disk_io--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_disk_io', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: '6039199f', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_network_connections--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: netConnKey, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'netconn_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'protocol--string--tag--false', + isColumn: false, + isJSON: false, + key: 'protocol', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'state--string--tag--false', + isColumn: false, + isJSON: false, + key: 'state', + type: 'tag', }, ], - op: 'AND', + having: [], + legend: '{{protocol}}::{{state}}', + limit: 30, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'avg', }, - functions: [], - groupBy: [], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'ab685a3d-fa4c-4663-8d94-c452e59038f3', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '9bd40b51-0790-4cdd-9718-551b2ded5926', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_disk_operation_time--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_disk_operation_time', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'd21dc017', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_disk_io--float64--Sum--true', + isColumn: true, + isJSON: false, + key: diskIoKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'diskio_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '9bd40b51-0790-4cdd-9718-551b2ded5926', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, + }, + variables: {}, + formatForWeb: false, + start, + end, + }, + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_disk_operation_time--float64--Sum--true', + isColumn: true, + isJSON: false, + key: diskOpTimeKey, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'diskop_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, + }, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'direction--string--tag--false', + isColumn: false, + isJSON: false, + key: 'direction', + type: 'tag', }, ], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [ - { - columnName: 'SUM(system_disk_operation_time)', - op: '>', - value: 0, - }, - ], - legend: '{{device}}::{{direction}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], - }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '9c6d18ad-89ff-4e38-a15a-440e72ed6ca8', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, - }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_disk_pending_operations--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'system_disk_pending_operations', - type: 'Gauge', - }, - aggregateOperator: 'max', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ + having: [ { - id: 'a1023af9', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', - }, - op: '=', - value: hostName, + columnName: `SUM(${diskOpTimeKey})`, + op: '>', + value: 0, }, ], - op: 'AND', + legend: '{{device}}::{{direction}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - ], - having: [ - { - columnName: 'SUM(system_disk_pending_operations)', - op: '>', - value: 0, - }, - ], - legend: '{{device}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'max', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: '9c6d18ad-89ff-4e38-a15a-440e72ed6ca8', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: 'f4cfc2a5-78fc-42cc-8f4a-194c8c916132', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, - { - selectedTime: 'GLOBAL_TIME', - graphType: PANEL_TYPES.TIME_SERIES, - query: { - builder: { - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'system_disk_operation_time--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'system_disk_operation_time', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [ - { - id: 'd21dc017', - key: { - dataType: DataTypes.String, - id: 'host_name--string--tag--false', - isColumn: false, - isJSON: false, - key: 'host_name', - type: 'tag', + { + selectedTime: 'GLOBAL_TIME', + graphType: PANEL_TYPES.TIME_SERIES, + query: { + builder: { + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + id: 'system_disk_pending_operations--float64--Gauge--true', + isColumn: true, + isJSON: false, + key: diskPendingKey, + type: 'Gauge', + }, + aggregateOperator: 'max', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [ + { + id: 'diskpend_f1', + key: { + dataType: DataTypes.String, + id: 'host_name--string--tag--false', + isColumn: false, + isJSON: false, + key: hostNameKey, + type: 'tag', + }, + op: '=', + value: hostName, }, - op: '=', - value: hostName, + ], + op: 'AND', + }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'device--string--tag--false', + isColumn: false, + isJSON: false, + key: 'device', + type: 'tag', }, ], - op: 'AND', + having: [ + { + columnName: `SUM(${diskPendingKey})`, + op: '>', + value: 0, + }, + ], + legend: '{{device}}', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'max', }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'device--string--tag--false', - isColumn: false, - isJSON: false, - key: 'device', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'direction--string--tag--false', - isColumn: false, - isJSON: false, - key: 'direction', - type: 'tag', - }, - ], - having: [ - { - columnName: 'SUM(system_disk_operation_time)', - op: '>', - value: 0, - }, - ], - legend: '{{device}}::{{direction}}', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - queryFormulas: [], + ], + queryFormulas: [], + }, + clickhouse_sql: [{ disabled: false, legend: '', name: 'A', query: '' }], + id: 'f4cfc2a5-78fc-42cc-8f4a-194c8c916132', + promql: [{ disabled: false, legend: '', name: 'A', query: '' }], + queryType: EQueryType.QUERY_BUILDER, }, - clickhouse_sql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - id: '9c6d18ad-89ff-4e38-a15a-440e72ed6ca8', - promql: [ - { - disabled: false, - legend: '', - name: 'A', - query: '', - }, - ], - queryType: EQueryType.QUERY_BUILDER, + variables: {}, + formatForWeb: false, + start, + end, }, - variables: {}, - formatForWeb: false, - start, - end, - }, -]; + ]; +}; export const podWidgetInfo = [ { diff --git a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx index c99426ef54..ad40981a34 100644 --- a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx +++ b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx @@ -21,8 +21,10 @@ import { FORBID_DOM_PURIFY_TAGS } from 'utils/app'; import { DataType } from '../TableView'; import { + escapeHtml, filterKeyForField, jsonToDataNodes, + parseFieldValue, recursiveParseJSON, removeEscapeCharacters, unescapeString, @@ -85,7 +87,7 @@ export function TableViewActions( record.field === 'body' ? { __html: convert.toHtml( - dompurify.sanitize(unescapeString(record.value), { + dompurify.sanitize(unescapeString(escapeHtml(record.value)), { FORBID_TAGS: [...FORBID_DOM_PURIFY_TAGS], }), ), @@ -155,7 +157,11 @@ export function TableViewActions( ) } - onClick={onClickHandler(OPERATORS['='], fieldFilterKey, fieldData.value)} + onClick={onClickHandler( + OPERATORS['='], + fieldFilterKey, + parseFieldValue(fieldData.value), + )} /> @@ -171,7 +177,7 @@ export function TableViewActions( onClick={onClickHandler( OPERATORS['!='], fieldFilterKey, - fieldData.value, + parseFieldValue(fieldData.value), )} /> diff --git a/frontend/src/container/LogDetailedView/utils.tsx b/frontend/src/container/LogDetailedView/utils.tsx index 05d65259f6..77f765a85e 100644 --- a/frontend/src/container/LogDetailedView/utils.tsx +++ b/frontend/src/container/LogDetailedView/utils.tsx @@ -259,6 +259,24 @@ export const getDataTypes = (value: unknown): DataTypes => { return determineType(value); }; +// prevent html rendering in the value +export const escapeHtml = (unsafe: string): string => + unsafe + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + +// parse field value to remove escaping characters +export const parseFieldValue = (value: string): string => { + try { + return JSON.parse(value); + } catch (error) { + return value; + } +}; + // now we do not want to render colors everywhere like in tooltip and monaco editor hence we remove such codes to make // the log line readable export const removeEscapeCharacters = (str: string): string => diff --git a/frontend/src/container/LogsExplorerViews/index.tsx b/frontend/src/container/LogsExplorerViews/index.tsx index d92457ae43..22c321bbce 100644 --- a/frontend/src/container/LogsExplorerViews/index.tsx +++ b/frontend/src/container/LogsExplorerViews/index.tsx @@ -28,16 +28,12 @@ import LogsExplorerTable from 'container/LogsExplorerTable'; import { useOptionsMenu } from 'container/OptionsMenu'; import TimeSeriesView from 'container/TimeSeriesView/TimeSeriesView'; import dayjs from 'dayjs'; -import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; -import { addEmptyWidgetInDashboardJSONWithQuery } from 'hooks/dashboard/utils'; import { useCopyLogLink } from 'hooks/logs/useCopyLogLink'; import { useGetExplorerQueryRange } from 'hooks/queryBuilder/useGetExplorerQueryRange'; import { useGetPanelTypesQueryParam } from 'hooks/queryBuilder/useGetPanelTypesQueryParam'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; -import useAxiosError from 'hooks/useAxiosError'; import useClickOutside from 'hooks/useClickOutside'; import { useHandleExplorerTabChange } from 'hooks/useHandleExplorerTabChange'; -import { useNotifications } from 'hooks/useNotifications'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import useUrlQueryData from 'hooks/useUrlQueryData'; import { FlatLogData } from 'lib/logs/flatLogData'; @@ -98,7 +94,6 @@ function LogsExplorerViews({ // eslint-disable-next-line @typescript-eslint/no-explicit-any chartQueryKeyRef: MutableRefObject; }): JSX.Element { - const { notifications } = useNotifications(); const { safeNavigate } = useSafeNavigate(); // this is to respect the panel type present in the URL rather than defaulting it to list always. @@ -141,8 +136,6 @@ function LogsExplorerViews({ const [queryId, setQueryId] = useState(v4()); const [queryStats, setQueryStats] = useState(); - const handleAxisError = useAxiosError(); - const listQuery = useMemo(() => { if (!stagedQuery || stagedQuery.builder.queryData.length < 1) return null; @@ -396,11 +389,6 @@ function LogsExplorerViews({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [data?.payload]); - const { - mutate: updateDashboard, - isLoading: isUpdateDashboardLoading, - } = useUpdateDashboard(); - const getUpdatedQueryForExport = useCallback((): Query => { const updatedQuery = cloneDeep(currentQuery); @@ -424,68 +412,22 @@ function LogsExplorerViews({ ? getUpdatedQueryForExport() : exportDefaultQuery; - const updatedDashboard = addEmptyWidgetInDashboardJSONWithQuery( - dashboard, - query, - widgetId, - panelTypeParam, - options.selectColumns, - ); - logEvent('Logs Explorer: Add to dashboard successful', { panelType, isNewDashboard, dashboardName: dashboard?.data?.title, }); - updateDashboard(updatedDashboard, { - onSuccess: (data) => { - if (data.error) { - const message = - data.error === 'feature usage exceeded' ? ( - - Panel limit exceeded for {DataSource.LOGS} in community edition. Please - checkout our paid plans{' '} - - here - - - ) : ( - data.error - ); - notifications.error({ - message, - }); - - return; - } - - const dashboardEditView = generateExportToDashboardLink({ - query, - panelType: panelTypeParam, - dashboardId: data.payload?.uuid || '', - widgetId, - }); - - safeNavigate(dashboardEditView); - }, - onError: handleAxisError, + const dashboardEditView = generateExportToDashboardLink({ + query, + panelType: panelTypeParam, + dashboardId: dashboard.id, + widgetId, }); + + safeNavigate(dashboardEditView); }, - [ - getUpdatedQueryForExport, - exportDefaultQuery, - options.selectColumns, - safeNavigate, - notifications, - panelType, - updateDashboard, - handleAxisError, - ], + [getUpdatedQueryForExport, exportDefaultQuery, safeNavigate, panelType], ); useEffect(() => { @@ -811,7 +753,6 @@ function LogsExplorerViews({ diff --git a/frontend/src/container/MetricsApplication/MetricsPageQueries/DBCallQueries.ts b/frontend/src/container/MetricsApplication/MetricsPageQueries/DBCallQueries.ts index f3124f0ad1..31beb654f0 100644 --- a/frontend/src/container/MetricsApplication/MetricsPageQueries/DBCallQueries.ts +++ b/frontend/src/container/MetricsApplication/MetricsPageQueries/DBCallQueries.ts @@ -21,6 +21,7 @@ export const databaseCallsRPS = ({ servicename, legend, tagFilterItems, + dotMetricsEnabled, }: DatabaseCallsRPSProps): QueryBuilderData => { const autocompleteData: BaseAutocompleteData[] = [ { @@ -34,7 +35,7 @@ export const databaseCallsRPS = ({ { dataType: DataTypes.String, isColumn: false, - key: 'db_system', + key: dotMetricsEnabled ? WidgetKeys.Db_system : WidgetKeys.Db_system_norm, type: 'tag', }, ]; @@ -43,7 +44,9 @@ export const databaseCallsRPS = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -75,6 +78,7 @@ export const databaseCallsRPS = ({ export const databaseCallsAvgDuration = ({ servicename, tagFilterItems, + dotMetricsEnabled, }: DatabaseCallProps): QueryBuilderData => { const autocompleteDataA: BaseAutocompleteData = { key: WidgetKeys.SignozDbLatencySum, @@ -93,7 +97,9 @@ export const databaseCallsAvgDuration = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, diff --git a/frontend/src/container/MetricsApplication/MetricsPageQueries/ExternalQueries.ts b/frontend/src/container/MetricsApplication/MetricsPageQueries/ExternalQueries.ts index 6a7ab65906..a0b8d2674a 100644 --- a/frontend/src/container/MetricsApplication/MetricsPageQueries/ExternalQueries.ts +++ b/frontend/src/container/MetricsApplication/MetricsPageQueries/ExternalQueries.ts @@ -33,6 +33,7 @@ export const externalCallErrorPercent = ({ servicename, legend, tagFilterItems, + dotMetricsEnabled, }: ExternalCallDurationByAddressProps): QueryBuilderData => { const autocompleteDataA: BaseAutocompleteData = { key: WidgetKeys.SignozExternalCallLatencyCount, @@ -51,7 +52,9 @@ export const externalCallErrorPercent = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -62,7 +65,7 @@ export const externalCallErrorPercent = ({ { id: '', key: { - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled ? WidgetKeys.StatusCode : WidgetKeys.StatusCodeNorm, dataType: DataTypes.Int64, isColumn: false, type: MetricsType.Tag, @@ -76,7 +79,9 @@ export const externalCallErrorPercent = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -121,6 +126,7 @@ export const externalCallErrorPercent = ({ export const externalCallDuration = ({ servicename, tagFilterItems, + dotMetricsEnabled, }: ExternalCallProps): QueryBuilderData => { const autocompleteDataA: BaseAutocompleteData = { dataType: DataTypes.Float64, @@ -144,7 +150,9 @@ export const externalCallDuration = ({ key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -184,6 +192,7 @@ export const externalCallRpsByAddress = ({ servicename, legend, tagFilterItems, + dotMetricsEnabled, }: ExternalCallDurationByAddressProps): QueryBuilderData => { const autocompleteData: BaseAutocompleteData[] = [ { @@ -200,7 +209,9 @@ export const externalCallRpsByAddress = ({ key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -231,6 +242,7 @@ export const externalCallDurationByAddress = ({ servicename, legend, tagFilterItems, + dotMetricsEnabled, }: ExternalCallDurationByAddressProps): QueryBuilderData => { const autocompleteDataA: BaseAutocompleteData = { dataType: DataTypes.Float64, @@ -253,7 +265,9 @@ export const externalCallDurationByAddress = ({ key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, diff --git a/frontend/src/container/MetricsApplication/MetricsPageQueries/OverviewQueries.ts b/frontend/src/container/MetricsApplication/MetricsPageQueries/OverviewQueries.ts index 0d2c05a349..977f1e05ea 100644 --- a/frontend/src/container/MetricsApplication/MetricsPageQueries/OverviewQueries.ts +++ b/frontend/src/container/MetricsApplication/MetricsPageQueries/OverviewQueries.ts @@ -37,10 +37,18 @@ export const latency = ({ tagFilterItems, isSpanMetricEnable = false, topLevelOperationsRoute, + dotMetricsEnabled, }: LatencyProps): QueryBuilderData => { + const signozLatencyBucketMetrics = dotMetricsEnabled + ? WidgetKeys.Signoz_latency_bucket + : WidgetKeys.Signoz_latency_bucket_norm; + + const signozMetricsServiceName = dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm; const newAutoCompleteData: BaseAutocompleteData = { key: isSpanMetricEnable - ? WidgetKeys.Signoz_latency_bucket + ? signozLatencyBucketMetrics : WidgetKeys.DurationNano, dataType: DataTypes.Float64, isColumn: true, @@ -53,7 +61,7 @@ export const latency = ({ { id: '', key: { - key: isSpanMetricEnable ? WidgetKeys.Service_name : WidgetKeys.ServiceName, + key: isSpanMetricEnable ? signozMetricsServiceName : WidgetKeys.ServiceName, dataType: DataTypes.String, type: isSpanMetricEnable ? MetricsType.Resource : MetricsType.Tag, isColumn: !isSpanMetricEnable, @@ -295,23 +303,30 @@ export const apDexMetricsQueryBuilderQueries = ({ threashold, delta, metricsBuckets, + dotMetricsEnabled, }: ApDexMetricsQueryBuilderQueriesProps): QueryBuilderData => { const autoCompleteDataA: BaseAutocompleteData = { - key: WidgetKeys.SignozLatencyCount, + key: dotMetricsEnabled + ? WidgetKeys.SignozLatencyCount + : WidgetKeys.SignozLatencyCountNorm, dataType: DataTypes.Float64, isColumn: true, type: '', }; const autoCompleteDataB: BaseAutocompleteData = { - key: WidgetKeys.Signoz_latency_bucket, + key: dotMetricsEnabled + ? WidgetKeys.Signoz_latency_bucket + : WidgetKeys.Signoz_latency_bucket_norm, dataType: DataTypes.Float64, isColumn: true, type: '', }; const autoCompleteDataC: BaseAutocompleteData = { - key: WidgetKeys.Signoz_latency_bucket, + key: dotMetricsEnabled + ? WidgetKeys.Signoz_latency_bucket + : WidgetKeys.Signoz_latency_bucket_norm, dataType: DataTypes.Float64, isColumn: true, type: '', @@ -321,7 +336,9 @@ export const apDexMetricsQueryBuilderQueries = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Tag, @@ -347,7 +364,7 @@ export const apDexMetricsQueryBuilderQueries = ({ { id: '', key: { - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled ? WidgetKeys.StatusCode : WidgetKeys.StatusCodeNorm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Tag, @@ -369,7 +386,9 @@ export const apDexMetricsQueryBuilderQueries = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Tag, @@ -406,7 +425,7 @@ export const apDexMetricsQueryBuilderQueries = ({ { id: '', key: { - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled ? WidgetKeys.StatusCode : WidgetKeys.StatusCodeNorm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Tag, @@ -417,7 +436,9 @@ export const apDexMetricsQueryBuilderQueries = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Tag, @@ -482,10 +503,13 @@ export const operationPerSec = ({ servicename, tagFilterItems, topLevelOperations, + dotMetricsEnabled, }: OperationPerSecProps): QueryBuilderData => { const autocompleteData: BaseAutocompleteData[] = [ { - key: WidgetKeys.SignozLatencyCount, + key: dotMetricsEnabled + ? WidgetKeys.SignozLatencyCount + : WidgetKeys.SignozLatencyCountNorm, dataType: DataTypes.Float64, isColumn: true, type: '', @@ -497,7 +521,9 @@ export const operationPerSec = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -540,6 +566,7 @@ export const errorPercentage = ({ servicename, tagFilterItems, topLevelOperations, + dotMetricsEnabled, }: OperationPerSecProps): QueryBuilderData => { const autocompleteDataA: BaseAutocompleteData = { key: WidgetKeys.SignozCallsTotal, @@ -560,7 +587,9 @@ export const errorPercentage = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -582,7 +611,9 @@ export const errorPercentage = ({ { id: '', key: { - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.StatusCodeNorm, dataType: DataTypes.Int64, isColumn: false, type: MetricsType.Tag, @@ -597,7 +628,9 @@ export const errorPercentage = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, diff --git a/frontend/src/container/MetricsApplication/MetricsPageQueries/TopOperationQueries.ts b/frontend/src/container/MetricsApplication/MetricsPageQueries/TopOperationQueries.ts index 18f0d07a88..d996ebac5a 100644 --- a/frontend/src/container/MetricsApplication/MetricsPageQueries/TopOperationQueries.ts +++ b/frontend/src/container/MetricsApplication/MetricsPageQueries/TopOperationQueries.ts @@ -21,9 +21,12 @@ import { getQueryBuilderQuerieswithFormula } from './MetricsPageQueriesFactory'; export const topOperationQueries = ({ servicename, + dotMetricsEnabled, }: TopOperationQueryFactoryProps): QueryBuilderData => { const latencyAutoCompleteData: BaseAutocompleteData = { - key: WidgetKeys.Signoz_latency_bucket, + key: dotMetricsEnabled + ? WidgetKeys.Signoz_latency_bucket + : WidgetKeys.Signoz_latency_bucket_norm, dataType: DataTypes.Float64, isColumn: true, type: '', @@ -37,7 +40,9 @@ export const topOperationQueries = ({ }; const numOfCallAutoCompleteData: BaseAutocompleteData = { - key: WidgetKeys.SignozLatencyCount, + key: dotMetricsEnabled + ? WidgetKeys.SignozLatencyCount + : WidgetKeys.SignozLatencyCountNorm, dataType: DataTypes.Float64, isColumn: true, type: '', @@ -47,7 +52,9 @@ export const topOperationQueries = ({ { id: '', key: { - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, dataType: DataTypes.String, isColumn: false, type: MetricsType.Resource, @@ -63,7 +70,9 @@ export const topOperationQueries = ({ key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -74,7 +83,7 @@ export const topOperationQueries = ({ key: { dataType: DataTypes.Int64, isColumn: false, - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled ? WidgetKeys.StatusCode : WidgetKeys.StatusCodeNorm, type: MetricsType.Tag, }, op: OPERATORS.IN, diff --git a/frontend/src/container/MetricsApplication/Tabs/DBCall.tsx b/frontend/src/container/MetricsApplication/Tabs/DBCall.tsx index 45da3bfd58..ea6592817b 100644 --- a/frontend/src/container/MetricsApplication/Tabs/DBCall.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/DBCall.tsx @@ -11,6 +11,7 @@ import { import useResourceAttribute from 'hooks/useResourceAttribute'; import { convertRawQueriesToTraceSelectedTags, + getResourceDeploymentKeys, resourceAttributesToTagFilterItems, } from 'hooks/useResourceAttribute/utils'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; @@ -26,6 +27,8 @@ import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData'; import { EQueryType } from 'types/common/dashboard'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { GraphTitle, MENU_ITEMS, SERVICE_CHART_ID } from '../constant'; import { getWidgetQueryBuilder } from '../MetricsApplication.factory'; import { Card, GraphContainer, Row } from '../styles'; @@ -80,7 +83,12 @@ function DBCall(): JSX.Element { [queries], ); - const legend = '{{db_system}}'; + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + + const legend = dotMetricsEnabled ? '{{db.system}}' : '{{db_system}}'; const databaseCallsRPSWidget = useMemo( () => @@ -92,6 +100,7 @@ function DBCall(): JSX.Element { servicename, legend, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -102,7 +111,7 @@ function DBCall(): JSX.Element { id: SERVICE_CHART_ID.dbCallsRPS, fillSpans: false, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled, legend], ); const databaseCallsAverageDurationWidget = useMemo( () => @@ -113,6 +122,7 @@ function DBCall(): JSX.Element { builder: databaseCallsAvgDuration({ servicename, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -123,7 +133,7 @@ function DBCall(): JSX.Element { id: GraphTitle.DATABASE_CALLS_AVG_DURATION, fillSpans: true, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled], ); const stepInterval = useMemo( @@ -141,7 +151,7 @@ function DBCall(): JSX.Element { useEffect(() => { if (!logEventCalledRef.current) { const selectedEnvironments = queries.find( - (val) => val.tagKey === 'resource_deployment_environment', + (val) => val.tagKey === getResourceDeploymentKeys(dotMetricsEnabled), )?.tagValue; logEvent('APM: Service detail page visited', { diff --git a/frontend/src/container/MetricsApplication/Tabs/External.tsx b/frontend/src/container/MetricsApplication/Tabs/External.tsx index 501c63e76f..b77a8b8109 100644 --- a/frontend/src/container/MetricsApplication/Tabs/External.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/External.tsx @@ -13,6 +13,7 @@ import { import useResourceAttribute from 'hooks/useResourceAttribute'; import { convertRawQueriesToTraceSelectedTags, + getResourceDeploymentKeys, resourceAttributesToTagFilterItems, } from 'hooks/useResourceAttribute/utils'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; @@ -28,6 +29,8 @@ import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse'; import { EQueryType } from 'types/common/dashboard'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { GraphTitle, legend, MENU_ITEMS } from '../constant'; import { getWidgetQueryBuilder } from '../MetricsApplication.factory'; import { Card, GraphContainer, Row } from '../styles'; @@ -75,6 +78,10 @@ function External(): JSX.Element { handleNonInQueryRange(resourceAttributesToTagFilterItems(queries)) || [], [queries], ); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; const externalCallErrorWidget = useMemo( () => @@ -86,6 +93,7 @@ function External(): JSX.Element { servicename, legend: legend.address, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -95,7 +103,7 @@ function External(): JSX.Element { yAxisUnit: '%', id: GraphTitle.EXTERNAL_CALL_ERROR_PERCENTAGE, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled], ); const selectedTraceTags = useMemo( @@ -112,6 +120,7 @@ function External(): JSX.Element { builder: externalCallDuration({ servicename, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -122,7 +131,7 @@ function External(): JSX.Element { id: GraphTitle.EXTERNAL_CALL_DURATION, fillSpans: true, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled], ); const errorApmToTraceQuery = useGetAPMToTracesQueries({ @@ -158,7 +167,7 @@ function External(): JSX.Element { useEffect(() => { if (!logEventCalledRef.current) { const selectedEnvironments = queries.find( - (val) => val.tagKey === 'resource_deployment_environment', + (val) => val.tagKey === getResourceDeploymentKeys(dotMetricsEnabled), )?.tagValue; logEvent('APM: Service detail page visited', { @@ -181,6 +190,7 @@ function External(): JSX.Element { servicename, legend: legend.address, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -191,7 +201,7 @@ function External(): JSX.Element { id: GraphTitle.EXTERNAL_CALL_RPS_BY_ADDRESS, fillSpans: true, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled], ); const externalCallDurationAddressWidget = useMemo( @@ -204,6 +214,7 @@ function External(): JSX.Element { servicename, legend: legend.address, tagFilterItems, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -214,7 +225,7 @@ function External(): JSX.Element { id: GraphTitle.EXTERNAL_CALL_DURATION_BY_ADDRESS, fillSpans: true, }), - [servicename, tagFilterItems], + [servicename, tagFilterItems, dotMetricsEnabled], ); const apmToTraceQuery = useGetAPMToTracesQueries({ diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview.tsx index 1492924249..b68a0cfd83 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview.tsx @@ -11,6 +11,7 @@ import { getQueryString } from 'container/SideNav/helper'; import useResourceAttribute from 'hooks/useResourceAttribute'; import { convertRawQueriesToTraceSelectedTags, + getResourceDeploymentKeys, resourceAttributesToTagFilterItems, } from 'hooks/useResourceAttribute/utils'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; @@ -92,12 +93,15 @@ function Application(): JSX.Element { // eslint-disable-next-line react-hooks/exhaustive-deps [handleSetTimeStamp], ); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; const logEventCalledRef = useRef(false); useEffect(() => { if (!logEventCalledRef.current) { const selectedEnvironments = queries.find( - (val) => val.tagKey === 'resource_deployment_environment', + (val) => val.tagKey === getResourceDeploymentKeys(dotMetricsEnabled), )?.tagValue; logEvent('APM: Service detail page visited', { @@ -155,6 +159,7 @@ function Application(): JSX.Element { servicename, tagFilterItems, topLevelOperations: topLevelOperationsRoute, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -164,7 +169,7 @@ function Application(): JSX.Element { yAxisUnit: 'ops', id: SERVICE_CHART_ID.rps, }), - [servicename, tagFilterItems, topLevelOperationsRoute], + [servicename, tagFilterItems, topLevelOperationsRoute, dotMetricsEnabled], ); const errorPercentageWidget = useMemo( @@ -177,6 +182,7 @@ function Application(): JSX.Element { servicename, tagFilterItems, topLevelOperations: topLevelOperationsRoute, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -187,7 +193,7 @@ function Application(): JSX.Element { id: SERVICE_CHART_ID.errorPercentage, fillSpans: true, }), - [servicename, tagFilterItems, topLevelOperationsRoute], + [servicename, tagFilterItems, topLevelOperationsRoute, dotMetricsEnabled], ); const stepInterval = useMemo( diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx index dcd01270ee..f267545bbe 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview/ApDex/ApDexMetrics.tsx @@ -20,6 +20,8 @@ import { useParams } from 'react-router-dom'; import { EQueryType } from 'types/common/dashboard'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../../../../constants/features'; +import { useAppContext } from '../../../../../providers/App/App'; import { IServiceName } from '../../types'; import { ApDexMetricsProps } from './types'; @@ -34,7 +36,10 @@ function ApDexMetrics({ }: ApDexMetricsProps): JSX.Element { const { servicename: encodedServiceName } = useParams(); const servicename = decodeURIComponent(encodedServiceName); - + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; const apDexMetricsWidget = useMemo( () => getWidgetQueryBuilder({ @@ -48,6 +53,7 @@ function ApDexMetrics({ threashold: thresholdValue || 0, delta: delta || false, metricsBuckets: metricsBuckets || [], + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -73,6 +79,7 @@ function ApDexMetrics({ tagFilterItems, thresholdValue, topLevelOperationsRoute, + dotMetricsEnabled, ], ); diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx index 0b05246acc..fde5ac6946 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx @@ -56,6 +56,10 @@ function ServiceOverview({ [isSpanMetricEnable, queries], ); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const latencyWidget = useMemo( () => getWidgetQueryBuilder({ @@ -67,6 +71,7 @@ function ServiceOverview({ tagFilterItems, isSpanMetricEnable, topLevelOperationsRoute, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), @@ -76,7 +81,13 @@ function ServiceOverview({ yAxisUnit: 'ns', id: SERVICE_CHART_ID.latency, }), - [isSpanMetricEnable, servicename, tagFilterItems, topLevelOperationsRoute], + [ + isSpanMetricEnable, + servicename, + tagFilterItems, + topLevelOperationsRoute, + dotMetricsEnabled, + ], ); const isQueryEnabled = diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/TopOperationMetrics.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/TopOperationMetrics.tsx index ed77512d89..30c99b9052 100644 --- a/frontend/src/container/MetricsApplication/Tabs/Overview/TopOperationMetrics.tsx +++ b/frontend/src/container/MetricsApplication/Tabs/Overview/TopOperationMetrics.tsx @@ -18,6 +18,8 @@ import { EQueryType } from 'types/common/dashboard'; import { GlobalReducer } from 'types/reducer/globalTime'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; import { IServiceName } from '../types'; import { title } from './config'; import ColumnWithLink from './TableRenderer/ColumnWithLink'; @@ -40,6 +42,11 @@ function TopOperationMetrics(): JSX.Element { convertRawQueriesToTraceSelectedTags(queries) || [], ); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const keyOperationWidget = useMemo( () => getWidgetQueryBuilder({ @@ -48,13 +55,14 @@ function TopOperationMetrics(): JSX.Element { promql: [], builder: topOperationQueries({ servicename, + dotMetricsEnabled, }), clickhouse_sql: [], id: uuid(), }, panelTypes: PANEL_TYPES.TABLE, }), - [servicename], + [servicename, dotMetricsEnabled], ); const updatedQuery = useStepInterval(keyOperationWidget.query); diff --git a/frontend/src/container/MetricsApplication/Tabs/types.ts b/frontend/src/container/MetricsApplication/Tabs/types.ts index 4dcb3bc01e..29032e704c 100644 --- a/frontend/src/container/MetricsApplication/Tabs/types.ts +++ b/frontend/src/container/MetricsApplication/Tabs/types.ts @@ -10,6 +10,7 @@ export interface IServiceName { export interface TopOperationQueryFactoryProps { servicename: IServiceName['servicename']; + dotMetricsEnabled: boolean; } export interface ExternalCallDurationByAddressProps extends ExternalCallProps { @@ -19,6 +20,7 @@ export interface ExternalCallDurationByAddressProps extends ExternalCallProps { export interface ExternalCallProps { servicename: IServiceName['servicename']; tagFilterItems: TagFilterItem[]; + dotMetricsEnabled: boolean; } export interface BuilderQueriesProps { @@ -50,6 +52,7 @@ export interface OperationPerSecProps { servicename: IServiceName['servicename']; tagFilterItems: TagFilterItem[]; topLevelOperations: string[]; + dotMetricsEnabled: boolean; } export interface LatencyProps { @@ -57,6 +60,7 @@ export interface LatencyProps { tagFilterItems: TagFilterItem[]; isSpanMetricEnable?: boolean; topLevelOperationsRoute: string[]; + dotMetricsEnabled: boolean; } export interface ApDexProps { @@ -74,4 +78,5 @@ export interface TableRendererProps { export interface ApDexMetricsQueryBuilderQueriesProps extends ApDexProps { delta: boolean; metricsBuckets: number[]; + dotMetricsEnabled: boolean; } diff --git a/frontend/src/container/MetricsApplication/constant.ts b/frontend/src/container/MetricsApplication/constant.ts index 1052a8d09a..957a6d9f89 100644 --- a/frontend/src/container/MetricsApplication/constant.ts +++ b/frontend/src/container/MetricsApplication/constant.ts @@ -85,12 +85,15 @@ export enum WidgetKeys { HasError = 'hasError', Address = 'address', DurationNano = 'durationNano', - StatusCode = 'status_code', + StatusCodeNorm = 'status_code', + StatusCode = 'status.code', Operation = 'operation', OperationName = 'operationName', - Service_name = 'service_name', + Service_name_norm = 'service_name', + Service_name = 'service.name', ServiceName = 'serviceName', - SignozLatencyCount = 'signoz_latency_count', + SignozLatencyCountNorm = 'signoz_latency_count', + SignozLatencyCount = 'signoz_latency.count', SignozDBLatencyCount = 'signoz_db_latency_count', DatabaseCallCount = 'signoz_database_call_count', DatabaseCallLatencySum = 'signoz_database_call_latency_sum', @@ -98,7 +101,10 @@ export enum WidgetKeys { SignozCallsTotal = 'signoz_calls_total', SignozExternalCallLatencyCount = 'signoz_external_call_latency_count', SignozExternalCallLatencySum = 'signoz_external_call_latency_sum', - Signoz_latency_bucket = 'signoz_latency_bucket', + Signoz_latency_bucket_norm = 'signoz_latency_bucket', + Signoz_latency_bucket = 'signoz_latency.bucket', + Db_system = 'db.system', + Db_system_norm = 'db_system', } export const topOperationMetricsDownloadOptions: DownloadOptions = { diff --git a/frontend/src/container/MetricsApplication/types.ts b/frontend/src/container/MetricsApplication/types.ts index 5f53204d27..3229ccfb23 100644 --- a/frontend/src/container/MetricsApplication/types.ts +++ b/frontend/src/container/MetricsApplication/types.ts @@ -25,10 +25,11 @@ export interface NavigateToTraceProps { } export interface DatabaseCallsRPSProps extends DatabaseCallProps { - legend: '{{db_system}}'; + legend: string; } export interface DatabaseCallProps { servicename: IServiceName['servicename']; tagFilterItems: TagFilterItem[]; + dotMetricsEnabled: boolean; } diff --git a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx index 1aed2e567b..1f04fcd9c6 100644 --- a/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx +++ b/frontend/src/container/MetricsExplorer/Explorer/Explorer.tsx @@ -2,18 +2,12 @@ import './Explorer.styles.scss'; import * as Sentry from '@sentry/react'; import { Switch } from 'antd'; -import axios from 'axios'; -import { LOCALSTORAGE } from 'constants/localStorage'; import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder'; import ExplorerOptionWrapper from 'container/ExplorerOptions/ExplorerOptionWrapper'; -import { useOptionsMenu } from 'container/OptionsMenu'; import RightToolbarActions from 'container/QueryBuilder/components/ToolbarActions/RightToolbarActions'; import DateTimeSelector from 'container/TopNav/DateTimeSelectionV2'; -import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; -import { addEmptyWidgetInDashboardJSONWithQuery } from 'hooks/dashboard/utils'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl'; -import { useNotifications } from 'hooks/useNotifications'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback'; import { useCallback, useMemo, useState } from 'react'; @@ -39,13 +33,6 @@ function Explorer(): JSX.Element { currentQuery, } = useQueryBuilder(); const { safeNavigate } = useSafeNavigate(); - const { notifications } = useNotifications(); - const { mutate: updateDashboard, isLoading } = useUpdateDashboard(); - const { options } = useOptionsMenu({ - storageKey: LOCALSTORAGE.METRICS_LIST_OPTIONS, - dataSource: DataSource.METRICS, - aggregateOperator: 'noop', - }); const [searchParams, setSearchParams] = useSearchParams(); const isOneChartPerQueryEnabled = @@ -86,59 +73,16 @@ function Explorer(): JSX.Element { const widgetId = uuid(); - const updatedDashboard = addEmptyWidgetInDashboardJSONWithQuery( - dashboard, - queryToExport || exportDefaultQuery, + const dashboardEditView = generateExportToDashboardLink({ + query: queryToExport || exportDefaultQuery, + panelType: PANEL_TYPES.TIME_SERIES, + dashboardId: dashboard.id, widgetId, - PANEL_TYPES.TIME_SERIES, - options.selectColumns, - ); - - updateDashboard(updatedDashboard, { - onSuccess: (data) => { - if (data.error) { - const message = - data.error === 'feature usage exceeded' ? ( - - Panel limit exceeded for {DataSource.METRICS} in community edition. - Please checkout our paid plans{' '} - - here - - - ) : ( - data.error - ); - notifications.error({ - message, - }); - - return; - } - const dashboardEditView = generateExportToDashboardLink({ - query: queryToExport || exportDefaultQuery, - panelType: PANEL_TYPES.TIME_SERIES, - dashboardId: data.payload?.uuid || '', - widgetId, - }); - - safeNavigate(dashboardEditView); - }, - onError: (error) => { - if (axios.isAxiosError(error)) { - notifications.error({ - message: error.message, - }); - } - }, }); + + safeNavigate(dashboardEditView); }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [exportDefaultQuery, notifications, updateDashboard], + [exportDefaultQuery, safeNavigate], ); const splitedQueries = useMemo( @@ -201,7 +145,6 @@ function Explorer(): JSX.Element { ({ }), })); +jest.spyOn(appContextHooks, 'useAppContext').mockReturnValue({ + user: { + role: 'admin', + }, + activeLicenseV3: { + event_queue: { + created_at: '0', + event: LicenseEvent.NO_EVENT, + scheduled_at: '0', + status: '', + updated_at: '0', + }, + license: { + license_key: 'test-license-key', + license_type: 'trial', + org_id: 'test-org-id', + plan_id: 'test-plan-id', + plan_name: 'test-plan-name', + plan_type: 'trial', + plan_version: 'test-plan-version', + }, + }, +} as any); + const queryClient = new QueryClient(); describe('QueryBuilder', () => { diff --git a/frontend/src/container/MetricsExplorer/Views/Views.tsx b/frontend/src/container/MetricsExplorer/Views/Views.tsx deleted file mode 100644 index 4b2bf65263..0000000000 --- a/frontend/src/container/MetricsExplorer/Views/Views.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Sentry from '@sentry/react'; -import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback'; - -function Views(): JSX.Element { - return ( - }> - Views - - ); -} - -export default Views; diff --git a/frontend/src/container/MetricsExplorer/Views/index.ts b/frontend/src/container/MetricsExplorer/Views/index.ts deleted file mode 100644 index 7893d1b90a..0000000000 --- a/frontend/src/container/MetricsExplorer/Views/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Views from './Views'; - -export default Views; diff --git a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx index cf7263d04e..287cf1219c 100644 --- a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx +++ b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx @@ -12,7 +12,6 @@ import { Typography, } from 'antd'; import logEvent from 'api/common/logEvent'; -import { SOMETHING_WENT_WRONG } from 'constants/api'; import { QueryParams } from 'constants/query'; import { PANEL_GROUP_TYPES, PANEL_TYPES } from 'constants/queryBuilder'; import ROUTES from 'constants/routes'; @@ -44,11 +43,8 @@ import { FullScreenHandle } from 'react-full-screen'; import { Layout } from 'react-grid-layout'; import { useTranslation } from 'react-i18next'; import { useCopyToClipboard } from 'react-use'; -import { - Dashboard, - DashboardData, - IDashboardVariable, -} from 'types/api/dashboard/getAll'; +import { DashboardData, IDashboardVariable } from 'types/api/dashboard/getAll'; +import { Props } from 'types/api/dashboard/update'; import { ROLES, USER_ROLES } from 'types/roles'; import { ComponentTypes } from 'utils/permission'; import { v4 as uuid } from 'uuid'; @@ -65,10 +61,9 @@ interface DashboardDescriptionProps { export function sanitizeDashboardData( selectedData: DashboardData, -): Omit { +): DashboardData { if (!selectedData?.variables) { - const { uuid, ...rest } = selectedData; - return rest; + return selectedData; } const updatedVariables = Object.entries(selectedData.variables).reduce( @@ -80,9 +75,8 @@ export function sanitizeDashboardData( {} as Record, ); - const { uuid, ...restData } = selectedData; return { - ...restData, + ...selectedData, variables: updatedVariables, }; } @@ -108,7 +102,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { const selectedData = selectedDashboard ? { ...selectedDashboard.data, - uuid: selectedDashboard.uuid, + uuid: selectedDashboard.id, } : ({} as DashboardData); @@ -162,7 +156,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { setSelectedRowWidgetId(null); handleToggleDashboardSlider(true); logEvent('Dashboard Detail: Add new panel clicked', { - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, dashboardName: selectedDashboard?.data.title, numberOfPanels: selectedDashboard?.data.widgets?.length, }); @@ -178,8 +172,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { if (!selectedDashboard) { return; } - const updatedDashboard = { - ...selectedDashboard, + const updatedDashboard: Props = { + id: selectedDashboard.id, + data: { ...selectedDashboard.data, title: updatedTitle, @@ -191,13 +186,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { message: 'Dashboard renamed successfully', }); setIsRenameDashboardOpen(false); - if (updatedDashboard.payload) - setSelectedDashboard(updatedDashboard.payload); + if (updatedDashboard.data) setSelectedDashboard(updatedDashboard.data); }, onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); setIsRenameDashboardOpen(true); }, }); @@ -251,8 +242,9 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { } } - const updatedDashboard: Dashboard = { - ...selectedDashboard, + const updatedDashboard: Props = { + id: selectedDashboard.id, + data: { ...selectedDashboard.data, layout: [ @@ -279,28 +271,21 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { }, ], }, - uuid: selectedDashboard.uuid, }; updateDashboardMutation.mutate(updatedDashboard, { // eslint-disable-next-line sonarjs/no-identical-functions onSuccess: (updatedDashboard) => { - if (updatedDashboard.payload) { - if (updatedDashboard.payload.data.layout) - setLayouts(sortLayout(updatedDashboard.payload.data.layout)); - setSelectedDashboard(updatedDashboard.payload); - setPanelMap(updatedDashboard.payload?.data?.panelMap || {}); + if (updatedDashboard.data) { + if (updatedDashboard.data.data.layout) + setLayouts(sortLayout(updatedDashboard.data.data.layout)); + setSelectedDashboard(updatedDashboard.data); + setPanelMap(updatedDashboard.data?.data?.panelMap || {}); } setIsPanelNameModalOpen(false); setSectionName(DEFAULT_ROW_NAME); }, - // eslint-disable-next-line sonarjs/no-identical-functions - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, }); } @@ -445,7 +430,7 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { diff --git a/frontend/src/container/NewDashboard/DashboardSettings/General/index.tsx b/frontend/src/container/NewDashboard/DashboardSettings/General/index.tsx index 066b60074e..3bb907ff7f 100644 --- a/frontend/src/container/NewDashboard/DashboardSettings/General/index.tsx +++ b/frontend/src/container/NewDashboard/DashboardSettings/General/index.tsx @@ -1,10 +1,8 @@ import './GeneralSettings.styles.scss'; import { Col, Input, Select, Space, Typography } from 'antd'; -import { SOMETHING_WENT_WRONG } from 'constants/api'; import AddTags from 'container/NewDashboard/DashboardSettings/General/AddTags'; import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; -import { useNotifications } from 'hooks/useNotifications'; import { isEqual } from 'lodash-es'; import { Check, X } from 'lucide-react'; import { useDashboard } from 'providers/Dashboard/Dashboard'; @@ -38,14 +36,12 @@ function GeneralDashboardSettings(): JSX.Element { const { t } = useTranslation('common'); - const { notifications } = useNotifications(); - const onSaveHandler = (): void => { if (!selectedDashboard) return; - updateDashboardMutation.mutateAsync( + updateDashboardMutation.mutate( { - ...selectedDashboard, + id: selectedDashboard.id, data: { ...selectedDashboard.data, description: updatedDescription, @@ -56,15 +52,11 @@ function GeneralDashboardSettings(): JSX.Element { }, { onSuccess: (updatedDashboard) => { - if (updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); } }, - onError: () => { - notifications.error({ - message: SOMETHING_WENT_WRONG, - }); - }, + onError: () => {}, }, ); }; diff --git a/frontend/src/container/NewDashboard/DashboardSettings/Variables/index.tsx b/frontend/src/container/NewDashboard/DashboardSettings/Variables/index.tsx index 70ffcb28a2..19c79868d3 100644 --- a/frontend/src/container/NewDashboard/DashboardSettings/Variables/index.tsx +++ b/frontend/src/container/NewDashboard/DashboardSettings/Variables/index.tsx @@ -171,7 +171,8 @@ function VariablesSetting({ updateMutation.mutateAsync( { - ...selectedDashboard, + id: selectedDashboard.id, + data: { ...selectedDashboard.data, variables: updatedVariablesData, @@ -179,18 +180,13 @@ function VariablesSetting({ }, { onSuccess: (updatedDashboard) => { - if (updatedDashboard.payload) { - setSelectedDashboard(updatedDashboard.payload); + if (updatedDashboard.data) { + setSelectedDashboard(updatedDashboard.data); notifications.success({ message: t('variable_updated_successfully'), }); } }, - onError: () => { - notifications.error({ - message: t('error_while_updating_variable'), - }); - }, }, ); }; diff --git a/frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx b/frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx index ba0840649d..c52a423b90 100644 --- a/frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx +++ b/frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx @@ -127,7 +127,7 @@ function QuerySection({ panelType: selectedWidget.panelTypes, queryType: currentQuery.queryType, widgetId: selectedWidget.id, - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, dashboardName: selectedDashboard?.data.title, isNewPanel, }); diff --git a/frontend/src/container/NewWidget/index.tsx b/frontend/src/container/NewWidget/index.tsx index 8c384af6e5..9b1e33692d 100644 --- a/frontend/src/container/NewWidget/index.tsx +++ b/frontend/src/container/NewWidget/index.tsx @@ -17,7 +17,6 @@ import { DEFAULT_BUCKET_COUNT } from 'container/PanelWrapper/constants'; import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; -import useAxiosError from 'hooks/useAxiosError'; import { useIsDarkMode } from 'hooks/useDarkMode'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import useUrlQuery from 'hooks/useUrlQuery'; @@ -41,10 +40,10 @@ import { AppState } from 'store/reducers'; import { SuccessResponse } from 'types/api'; import { ColumnUnit, - Dashboard, LegendPosition, Widgets, } from 'types/api/dashboard/getAll'; +import { Props } from 'types/api/dashboard/update'; import { IField } from 'types/api/logs/fields'; import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange'; import { EQueryType } from 'types/common/dashboard'; @@ -141,7 +140,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { if (!logEventCalledRef.current) { logEvent('Panel Edit: Page visited', { panelType: selectedWidget?.panelTypes, - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, widgetId: selectedWidget?.id, dashboardName: selectedDashboard?.data.title, isNewPanel: !!isWidgetNotPresent, @@ -345,8 +344,6 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { return { selectedWidget, preWidgets, afterWidgets }; }, [selectedDashboard, query]); - const handleError = useAxiosError(); - // this loading state is to take care of mismatch in the responses for table and other panels // hence while changing the query contains the older value and the processing logic fails const [isLoadingPanelData, setIsLoadingPanelData] = useState(false); @@ -470,9 +467,9 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { updatedLayout = newLayoutItem; } - const dashboard: Dashboard = { - ...selectedDashboard, - uuid: selectedDashboard.uuid, + const dashboard: Props = { + id: selectedDashboard.id, + data: { ...selectedDashboard.data, widgets: isNewDashboard @@ -540,15 +537,14 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { }; updateDashboardMutation.mutateAsync(dashboard, { - onSuccess: () => { + onSuccess: (updatedDashboard) => { setSelectedRowWidgetId(null); - setSelectedDashboard(dashboard); + setSelectedDashboard(updatedDashboard.data); setToScrollWidgetId(selectedWidget?.id || ''); safeNavigate({ pathname: generatePath(ROUTES.DASHBOARD, { dashboardId }), }); }, - onError: handleError, }); }, [ selectedDashboard, @@ -562,7 +558,6 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { currentQuery, preWidgets, updateDashboardMutation, - handleError, widgets, setSelectedDashboard, setToScrollWidgetId, @@ -601,7 +596,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element { logEvent('Panel Edit: Save changes', { panelType: selectedWidget.panelTypes, - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, widgetId: selectedWidget.id, dashboardName: selectedDashboard?.data.title, queryType: currentQuery.queryType, diff --git a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx index ba2938251c..a52858645d 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/AddNewPipeline/index.tsx @@ -1,6 +1,6 @@ -import { Button, Divider, Form, Modal } from 'antd'; +import { Button, Divider, Form, FormInstance, Modal } from 'antd'; import { useAppContext } from 'providers/App/App'; -import React, { useCallback, useEffect, useMemo } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { ActionMode, ActionType, PipelineData } from 'types/api/pipeline/def'; import { v4 } from 'uuid'; @@ -10,6 +10,7 @@ import { getEditedDataSource, getRecordIndex } from '../utils'; import { renderPipelineForm } from './utils'; function AddNewPipeline({ + form, isActionType, setActionType, selectedPipelineData, @@ -17,22 +18,12 @@ function AddNewPipeline({ setCurrPipelineData, currPipelineData, }: AddNewPipelineProps): JSX.Element { - const [form] = Form.useForm(); const { t } = useTranslation('pipeline'); const { user } = useAppContext(); const isEdit = isActionType === 'edit-pipeline'; const isAdd = isActionType === 'add-pipeline'; - useEffect(() => { - if (isEdit) { - form.setFieldsValue(selectedPipelineData); - } - if (isAdd) { - form.resetFields(); - } - }, [form, isEdit, isAdd, selectedPipelineData]); - const onFinish = (values: PipelineData): void => { const newPipeLineData: PipelineData = { id: v4(), @@ -135,6 +126,7 @@ function AddNewPipeline({ } interface AddNewPipelineProps { + form: FormInstance; isActionType: string; setActionType: (actionType?: ActionType) => void; selectedPipelineData: PipelineData | undefined; diff --git a/frontend/src/container/PipelinePage/PipelineListsView/PipelineListsView.tsx b/frontend/src/container/PipelinePage/PipelineListsView/PipelineListsView.tsx index 43051f894c..71b353defe 100644 --- a/frontend/src/container/PipelinePage/PipelineListsView/PipelineListsView.tsx +++ b/frontend/src/container/PipelinePage/PipelineListsView/PipelineListsView.tsx @@ -1,7 +1,7 @@ import './styles.scss'; import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'; -import { Card, Modal, Table, Typography } from 'antd'; +import { Card, Form, Modal, Table, Typography } from 'antd'; import { ExpandableConfig } from 'antd/es/table/interface'; import logEvent from 'api/common/logEvent'; import savePipeline from 'api/pipeline/post'; @@ -95,6 +95,7 @@ function PipelineListsView({ pipelineData, refetchPipelineLists, }: PipelineListsViewProps): JSX.Element { + const [pipelineForm] = Form.useForm(); const { t } = useTranslation(['pipeline', 'common']); const [modal, contextHolder] = Modal.useModal(); const { notifications } = useNotifications(); @@ -179,8 +180,9 @@ function PipelineListsView({ (record: PipelineData) => (): void => { setActionType(ActionType.EditPipeline); setSelectedPipelineData(record); + pipelineForm.setFieldsValue(record); }, - [setActionType], + [setActionType, pipelineForm], ); const pipelineDeleteHandler = useCallback( @@ -382,12 +384,13 @@ function PipelineListsView({ const addNewPipelineHandler = useCallback((): void => { setActionType(ActionType.AddPipeline); + pipelineForm.resetFields(); logEvent('Logs: Pipelines: Clicked Add New Pipeline', { source: 'signoz-ui', }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [setActionType]); + }, [setActionType, pipelineForm]); const footer = useCallback((): JSX.Element | undefined => { if (isEditingActionMode) { @@ -495,6 +498,7 @@ function PipelineListsView({ <> {contextHolder} { matchMedia(); }); +function AddNewPipelineWrapper(): JSX.Element { + const setActionType = jest.fn(); + const selectedPipelineData = pipelineMockData[0]; + const isActionType = 'add-pipeline'; + const [pipelineForm] = Form.useForm(); + + return ( + + ); +} + describe('PipelinePage container test', () => { it('should render AddNewPipeline section', () => { - const setActionType = jest.fn(); - const selectedPipelineData = pipelineMockData[0]; - const isActionType = 'add-pipeline'; - - const { asFragment } = render( - , - ); + const { asFragment } = render(); expect(asFragment()).toMatchSnapshot(); }); }); diff --git a/frontend/src/container/PipelinePage/tests/PipelineListsView.test.tsx b/frontend/src/container/PipelinePage/tests/PipelineListsView.test.tsx index e75c5634e5..2145de152f 100644 --- a/frontend/src/container/PipelinePage/tests/PipelineListsView.test.tsx +++ b/frontend/src/container/PipelinePage/tests/PipelineListsView.test.tsx @@ -1,4 +1,5 @@ /* eslint-disable sonarjs/no-duplicate-string */ +import { screen } from '@testing-library/react'; import { findByText, fireEvent, render, waitFor } from 'tests/test-utils'; import { pipelineApiResponseMockData } from '../mocks/pipeline'; @@ -243,4 +244,34 @@ describe('PipelinePage container test', () => { expect(saveBtn).toBeInTheDocument(); await fireEvent.click(saveBtn); }); + + it('should have populated form fields when edit pipeline is clicked', async () => { + render( + , + ); + + // content assertion + expect(document.querySelectorAll('[data-icon="edit"]').length).toBe(2); + + // expand action + const expandIcon = document.querySelectorAll( + '.ant-table-row-expand-icon-cell > span[class*="anticon-right"]', + ); + expect(expandIcon.length).toBe(2); + await fireEvent.click(expandIcon[0]); + + const editBtn = document.querySelectorAll('[data-icon="edit"]'); + // click on edit btn + await fireEvent.click(editBtn[0] as HTMLElement); + + // to have length 2 + expect(screen.queryAllByText('source = nginx').length).toBe(2); + }); }); diff --git a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx index dc22801cea..14b8b5852f 100644 --- a/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx +++ b/frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/index.tsx @@ -51,6 +51,8 @@ import { getUserOperatingSystem, UserOperatingSystem } from 'utils/getUserOS'; import { popupContainer } from 'utils/selectPopupContainer'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; import { selectStyle } from './config'; import { PLACEHOLDER } from './constant'; import ExampleQueriesRendererForLogs from './ExampleQueriesRendererForLogs'; @@ -85,6 +87,11 @@ function QueryBuilderSearch({ const [isEditingTag, setIsEditingTag] = useState(false); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const { updateTag, handleClearTag, @@ -104,6 +111,7 @@ function QueryBuilderSearch({ exampleQueries, } = useAutoComplete( query, + dotMetricsEnabled, whereClauseConfig, isLogsExplorerPage, isInfraMonitoring, @@ -121,6 +129,7 @@ function QueryBuilderSearch({ const { sourceKeys, handleRemoveSourceKey } = useFetchKeysAndValues( searchValue, query, + dotMetricsEnabled, searchKey, isLogsExplorerPage, isInfraMonitoring, diff --git a/frontend/src/container/ResourceAttributesFilter/ResourceAttributesFilter.tsx b/frontend/src/container/ResourceAttributesFilter/ResourceAttributesFilter.tsx index 93264dc4dd..a3c32d9901 100644 --- a/frontend/src/container/ResourceAttributesFilter/ResourceAttributesFilter.tsx +++ b/frontend/src/container/ResourceAttributesFilter/ResourceAttributesFilter.tsx @@ -9,12 +9,15 @@ import { convertMetricKeyToTrace, getEnvironmentTagKeys, getEnvironmentTagValues, + getResourceDeploymentKeys, } from 'hooks/useResourceAttribute/utils'; import { ReactNode, useEffect, useMemo, useState } from 'react'; import { SelectOption } from 'types/common/select'; import { popupContainer } from 'utils/selectPopupContainer'; import { v4 as uuid } from 'uuid'; +import { FeatureKeys } from '../../constants/features'; +import { useAppContext } from '../../providers/App/App'; import QueryChip from './components/QueryChip'; import { QueryChipItem, SearchContainer } from './styles'; @@ -39,24 +42,27 @@ function ResourceAttributesFilter({ SelectOption[] >([]); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + + const resourceDeploymentKey = getResourceDeploymentKeys(dotMetricsEnabled); + const [selectedEnvironments, setSelectedEnvironments] = useState([]); const queriesExcludingEnvironment = useMemo( - () => - queries.filter( - (query) => query.tagKey !== 'resource_deployment_environment', - ), - [queries], + () => queries.filter((query) => query.tagKey !== resourceDeploymentKey), + [queries, resourceDeploymentKey], ); const isEmpty = useMemo( () => isResourceEmpty(queriesExcludingEnvironment, staging, selectedQuery), [queriesExcludingEnvironment, selectedQuery, staging], ); - useEffect(() => { const resourceDeploymentEnvironmentQuery = queries.filter( - (query) => query.tagKey === 'resource_deployment_environment', + (query) => query.tagKey === resourceDeploymentKey, ); if (resourceDeploymentEnvironmentQuery?.length > 0) { @@ -64,17 +70,17 @@ function ResourceAttributesFilter({ } else { setSelectedEnvironments([]); } - }, [queries]); + }, [queries, resourceDeploymentKey]); useEffect(() => { - getEnvironmentTagKeys().then((tagKeys) => { + getEnvironmentTagKeys(dotMetricsEnabled).then((tagKeys) => { if (tagKeys && Array.isArray(tagKeys) && tagKeys.length > 0) { - getEnvironmentTagValues().then((tagValues) => { + getEnvironmentTagValues(dotMetricsEnabled).then((tagValues) => { setEnvironments(tagValues); }); } }); - }, []); + }, [dotMetricsEnabled]); return (
diff --git a/frontend/src/container/ResourceAttributesFilter/components/QueryChip/QueryChip.tsx b/frontend/src/container/ResourceAttributesFilter/components/QueryChip/QueryChip.tsx index b2babd78b5..ac7a95f171 100644 --- a/frontend/src/container/ResourceAttributesFilter/components/QueryChip/QueryChip.tsx +++ b/frontend/src/container/ResourceAttributesFilter/components/QueryChip/QueryChip.tsx @@ -1,5 +1,10 @@ -import { convertMetricKeyToTrace } from 'hooks/useResourceAttribute/utils'; +import { + convertMetricKeyToTrace, + getResourceDeploymentKeys, +} from 'hooks/useResourceAttribute/utils'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; import { QueryChipContainer, QueryChipItem } from '../../styles'; import { IQueryChipProps } from './types'; @@ -8,12 +13,17 @@ function QueryChip({ queryData, onClose }: IQueryChipProps): JSX.Element { onClose(queryData.id); }; + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + return ( {convertMetricKeyToTrace(queryData.tagKey)} {queryData.operator} {queryData.tagValue.join(', ')} diff --git a/frontend/src/container/ServiceApplication/ServiceMetrics/ServiceMetricsApplication.tsx b/frontend/src/container/ServiceApplication/ServiceMetrics/ServiceMetricsApplication.tsx index 4d5889b909..4098b1d4d5 100644 --- a/frontend/src/container/ServiceApplication/ServiceMetrics/ServiceMetricsApplication.tsx +++ b/frontend/src/container/ServiceApplication/ServiceMetrics/ServiceMetricsApplication.tsx @@ -3,6 +3,8 @@ import { useSelector } from 'react-redux'; import { AppState } from 'store/reducers'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { ServiceMetricsProps } from '../types'; import { getQueryRangeRequestData } from '../utils'; import ServiceMetricTable from './ServiceMetricTable'; @@ -15,6 +17,11 @@ function ServiceMetricsApplication({ GlobalReducer >((state) => state.globalTime); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const queryRangeRequestData = useMemo( () => getQueryRangeRequestData({ @@ -22,8 +29,15 @@ function ServiceMetricsApplication({ minTime, maxTime, globalSelectedInterval, + dotMetricsEnabled, }), - [globalSelectedInterval, maxTime, minTime, topLevelOperations], + [ + globalSelectedInterval, + maxTime, + minTime, + topLevelOperations, + dotMetricsEnabled, + ], ); return ( { const p99AutoCompleteData: BaseAutocompleteData = { dataType: DataTypes.Float64, isColumn: true, - key: WidgetKeys.Signoz_latency_bucket, + key: dotMetricsEnabled + ? WidgetKeys.Signoz_latency_bucket + : WidgetKeys.Signoz_latency_bucket_norm, type: '', }; @@ -54,7 +57,9 @@ export const serviceMetricsQuery = ( key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -79,7 +84,9 @@ export const serviceMetricsQuery = ( key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -90,7 +97,7 @@ export const serviceMetricsQuery = ( key: { dataType: DataTypes.Int64, isColumn: false, - key: WidgetKeys.StatusCode, + key: dotMetricsEnabled ? WidgetKeys.StatusCode : WidgetKeys.StatusCodeNorm, type: MetricsType.Tag, }, op: OPERATORS.IN, @@ -115,7 +122,9 @@ export const serviceMetricsQuery = ( key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -140,7 +149,9 @@ export const serviceMetricsQuery = ( key: { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Resource, }, op: OPERATORS.IN, @@ -195,7 +206,9 @@ export const serviceMetricsQuery = ( { dataType: DataTypes.String, isColumn: false, - key: WidgetKeys.Service_name, + key: dotMetricsEnabled + ? WidgetKeys.Service_name + : WidgetKeys.Service_name_norm, type: MetricsType.Tag, }, ]; diff --git a/frontend/src/container/ServiceApplication/ServiceTraces/index.tsx b/frontend/src/container/ServiceApplication/ServiceTraces/index.tsx index 59c7a294bb..8b5c4c3e1b 100644 --- a/frontend/src/container/ServiceApplication/ServiceTraces/index.tsx +++ b/frontend/src/container/ServiceApplication/ServiceTraces/index.tsx @@ -5,7 +5,10 @@ import { SKIP_ONBOARDING } from 'constants/onboarding'; import useErrorNotification from 'hooks/useErrorNotification'; import { useQueryService } from 'hooks/useQueryService'; import useResourceAttribute from 'hooks/useResourceAttribute'; -import { convertRawQueriesToTraceSelectedTags } from 'hooks/useResourceAttribute/utils'; +import { + convertRawQueriesToTraceSelectedTags, + getResourceDeploymentKeys, +} from 'hooks/useResourceAttribute/utils'; import { isUndefined } from 'lodash-es'; import { useEffect, useMemo, useRef, useState } from 'react'; import { useSelector } from 'react-redux'; @@ -13,6 +16,8 @@ import { AppState } from 'store/reducers'; import { GlobalReducer } from 'types/reducer/globalTime'; import { Tags } from 'types/reducer/trace'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import SkipOnBoardingModal from '../SkipOnBoardModal'; import ServiceTraceTable from './ServiceTracesTable'; @@ -34,6 +39,11 @@ function ServiceTraces(): JSX.Element { selectedTags, }); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + useErrorNotification(error); const services = data || []; @@ -51,7 +61,7 @@ function ServiceTraces(): JSX.Element { useEffect(() => { if (!logEventCalledRef.current && !isUndefined(data)) { const selectedEnvironments = queries.find( - (val) => val.tagKey === 'resource_deployment_environment', + (val) => val.tagKey === getResourceDeploymentKeys(dotMetricsEnabled), )?.tagValue; const rps = data.reduce((total, service) => total + service.callRate, 0); diff --git a/frontend/src/container/ServiceApplication/types.ts b/frontend/src/container/ServiceApplication/types.ts index 4733b3053a..077ef90034 100644 --- a/frontend/src/container/ServiceApplication/types.ts +++ b/frontend/src/container/ServiceApplication/types.ts @@ -29,6 +29,7 @@ export interface GetQueryRangeRequestDataProps { maxTime: number; minTime: number; globalSelectedInterval: Time | TimeV2 | CustomTimeType; + dotMetricsEnabled: boolean; } export interface GetServiceListFromQueryProps { diff --git a/frontend/src/container/ServiceApplication/utils.ts b/frontend/src/container/ServiceApplication/utils.ts index f82c2df562..aef4cbb5f6 100644 --- a/frontend/src/container/ServiceApplication/utils.ts +++ b/frontend/src/container/ServiceApplication/utils.ts @@ -28,6 +28,7 @@ export const getQueryRangeRequestData = ({ maxTime, minTime, globalSelectedInterval, + dotMetricsEnabled, }: GetQueryRangeRequestDataProps): GetQueryResultsProps[] => { const requestData: GetQueryResultsProps[] = []; topLevelOperations.forEach((operation) => { @@ -35,7 +36,7 @@ export const getQueryRangeRequestData = ({ query: { queryType: EQueryType.QUERY_BUILDER, promql: [], - builder: serviceMetricsQuery(operation), + builder: serviceMetricsQuery(operation, dotMetricsEnabled), clickhouse_sql: [], id: uuid(), }, diff --git a/frontend/src/container/SideNav/SideNav.tsx b/frontend/src/container/SideNav/SideNav.tsx index 2603981f14..a9e0d7c087 100644 --- a/frontend/src/container/SideNav/SideNav.tsx +++ b/frontend/src/container/SideNav/SideNav.tsx @@ -26,6 +26,7 @@ import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import { useLocation } from 'react-router-dom'; import { AppState } from 'store/reducers'; +import { LicenseStatus } from 'types/api/licensesV3/getActive'; import AppReducer from 'types/reducer/app'; import { USER_ROLES } from 'types/roles'; import { checkVersionState } from 'utils/app'; @@ -105,7 +106,7 @@ function SideNav(): JSX.Element { const isWorkspaceBlocked = trialInfo?.workSpaceBlock || false; - const isLicenseActive = licenseStatus === 'VALID'; + const isLicenseActive = licenseStatus !== '' && licenseStatus !== 'INVALID'; const onClickSignozCloud = (): void => { window.open( @@ -301,10 +302,11 @@ function SideNav(): JSX.Element { } const isOnBasicPlan = - activeLicenseFetchError && - [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes( - activeLicenseFetchError?.getHttpStatusCode(), - ); + (activeLicenseFetchError && + [StatusCodes.NOT_FOUND, StatusCodes.NOT_IMPLEMENTED].includes( + activeLicenseFetchError?.getHttpStatusCode(), + )) || + (activeLicense?.status && activeLicense.status === LicenseStatus.INVALID); if (user.role !== USER_ROLES.ADMIN || isOnBasicPlan) { updatedMenuItems = updatedMenuItems.filter( @@ -353,6 +355,7 @@ function SideNav(): JSX.Element { t, user.role, activeLicenseFetchError, + activeLicense?.status, ]); return ( diff --git a/frontend/src/hooks/dashboard/useDeleteDashboard.tsx b/frontend/src/hooks/dashboard/useDeleteDashboard.tsx index 35a3c27fce..0ebda0fd39 100644 --- a/frontend/src/hooks/dashboard/useDeleteDashboard.tsx +++ b/frontend/src/hooks/dashboard/useDeleteDashboard.tsx @@ -1,15 +1,23 @@ -import deleteDashboard from 'api/dashboard/delete'; +import deleteDashboard from 'api/v1/dashboards/id/delete'; import { REACT_QUERY_KEY } from 'constants/reactQueryKeys'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { useMutation, UseMutationResult } from 'react-query'; -import { PayloadProps } from 'types/api/dashboard/delete'; +import { SuccessResponseV2 } from 'types/api'; +import APIError from 'types/api/error'; export const useDeleteDashboard = ( id: string, -): UseMutationResult => - useMutation({ +): UseMutationResult, APIError, void, unknown> => { + const { showErrorModal } = useErrorModal(); + + return useMutation, APIError>({ mutationKey: REACT_QUERY_KEY.DELETE_DASHBOARD, mutationFn: () => deleteDashboard({ - uuid: id, + id, }), + onError: (error: APIError) => { + showErrorModal(error); + }, }); +}; diff --git a/frontend/src/hooks/dashboard/useGetAllDashboard.tsx b/frontend/src/hooks/dashboard/useGetAllDashboard.tsx index 91fea33517..fedb2b1de0 100644 --- a/frontend/src/hooks/dashboard/useGetAllDashboard.tsx +++ b/frontend/src/hooks/dashboard/useGetAllDashboard.tsx @@ -1,10 +1,22 @@ -import { getAllDashboardList } from 'api/dashboard/getAll'; +import getAll from 'api/v1/dashboards/getAll'; import { REACT_QUERY_KEY } from 'constants/reactQueryKeys'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { useQuery, UseQueryResult } from 'react-query'; +import { SuccessResponseV2 } from 'types/api'; import { Dashboard } from 'types/api/dashboard/getAll'; +import APIError from 'types/api/error'; -export const useGetAllDashboard = (): UseQueryResult => - useQuery({ - queryFn: getAllDashboardList, +export const useGetAllDashboard = (): UseQueryResult< + SuccessResponseV2, + APIError +> => { + const { showErrorModal } = useErrorModal(); + + return useQuery, APIError>({ + queryFn: getAll, + onError: (error) => { + showErrorModal(error); + }, queryKey: REACT_QUERY_KEY.GET_ALL_DASHBOARDS, }); +}; diff --git a/frontend/src/hooks/dashboard/useUpdateDashboard.tsx b/frontend/src/hooks/dashboard/useUpdateDashboard.tsx index e8dbad4ae6..fd20c90e7e 100644 --- a/frontend/src/hooks/dashboard/useUpdateDashboard.tsx +++ b/frontend/src/hooks/dashboard/useUpdateDashboard.tsx @@ -1,25 +1,31 @@ -import update from 'api/dashboard/update'; +import update from 'api/v1/dashboards/id/update'; import dayjs from 'dayjs'; import { useDashboard } from 'providers/Dashboard/Dashboard'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { useMutation, UseMutationResult } from 'react-query'; -import { ErrorResponse, SuccessResponse } from 'types/api'; +import { SuccessResponseV2 } from 'types/api'; import { Dashboard } from 'types/api/dashboard/getAll'; import { Props } from 'types/api/dashboard/update'; +import APIError from 'types/api/error'; export const useUpdateDashboard = (): UseUpdateDashboard => { const { updatedTimeRef } = useDashboard(); + const { showErrorModal } = useErrorModal(); return useMutation(update, { onSuccess: (data) => { - if (data.payload) { - updatedTimeRef.current = dayjs(data.payload.updatedAt); + if (data.data) { + updatedTimeRef.current = dayjs(data.data.updatedAt); } }, + onError: (error) => { + showErrorModal(error); + }, }); }; type UseUpdateDashboard = UseMutationResult< - SuccessResponse | ErrorResponse, - unknown, + SuccessResponseV2, + APIError, Props, unknown >; diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts index 9b248688c7..55ee6df8c0 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sClustersList.ts @@ -17,6 +17,7 @@ type UseGetK8sClustersList = ( >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -28,6 +29,7 @@ export const useGetK8sClustersList: UseGetK8sClustersList = ( options, headers, + dotMetricsEnabled?: boolean, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -45,7 +47,8 @@ export const useGetK8sClustersList: UseGetK8sClustersList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sClustersList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sClustersList(requestData, signal, headers, dotMetricsEnabled), ...options, diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sDaemonSetsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sDaemonSetsList.ts index 5dde5d62fd..747603f3d4 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sDaemonSetsList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sDaemonSetsList.ts @@ -17,6 +17,7 @@ type UseGetK8sDaemonSetsList = ( >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -28,6 +29,7 @@ export const useGetK8sDaemonSetsList: UseGetK8sDaemonSetsList = ( options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -45,7 +47,8 @@ export const useGetK8sDaemonSetsList: UseGetK8sDaemonSetsList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sDaemonSetsList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sDaemonSetsList(requestData, signal, headers, dotMetricsEnabled), ...options, diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts index 0b075c330d..ab3ceb4e23 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sDeploymentsList.ts @@ -15,6 +15,7 @@ type UseGetK8sDeploymentsList = ( Error >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -24,6 +25,7 @@ export const useGetK8sDeploymentsList: UseGetK8sDeploymentsList = ( requestData, options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -41,7 +43,8 @@ export const useGetK8sDeploymentsList: UseGetK8sDeploymentsList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sDeploymentsList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sDeploymentsList(requestData, signal, headers, dotMetricsEnabled), ...options, queryKey, }); diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sJobsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sJobsList.ts index 942dc19bfe..962816b11a 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sJobsList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sJobsList.ts @@ -17,6 +17,7 @@ type UseGetK8sJobsList = ( >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -28,6 +29,7 @@ export const useGetK8sJobsList: UseGetK8sJobsList = ( options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -42,7 +44,8 @@ export const useGetK8sJobsList: UseGetK8sJobsList = ( }, [options?.queryKey, requestData]); return useQuery | ErrorResponse, Error>({ - queryFn: ({ signal }) => getK8sJobsList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sJobsList(requestData, signal, headers, dotMetricsEnabled), ...options, diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts index 24763b4657..611a153bb9 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sNamespacesList.ts @@ -15,6 +15,7 @@ type UseGetK8sNamespacesList = ( Error >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -24,6 +25,7 @@ export const useGetK8sNamespacesList: UseGetK8sNamespacesList = ( requestData, options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -41,7 +43,8 @@ export const useGetK8sNamespacesList: UseGetK8sNamespacesList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sNamespacesList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sNamespacesList(requestData, signal, headers, dotMetricsEnabled), ...options, queryKey, }); diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts index f88ffa113c..eda2d790b1 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sNodesList.ts @@ -15,6 +15,7 @@ type UseGetK8sNodesList = ( Error >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -24,6 +25,7 @@ export const useGetK8sNodesList: UseGetK8sNodesList = ( requestData, options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -38,7 +40,8 @@ export const useGetK8sNodesList: UseGetK8sNodesList = ( }, [options?.queryKey, requestData]); return useQuery | ErrorResponse, Error>({ - queryFn: ({ signal }) => getK8sNodesList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sNodesList(requestData, signal, headers, dotMetricsEnabled), ...options, queryKey, }); diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sPodsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sPodsList.ts index b7d4a4d6e7..274861242c 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sPodsList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sPodsList.ts @@ -15,6 +15,7 @@ type UseGetK8sPodsList = ( Error >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -24,6 +25,7 @@ export const useGetK8sPodsList: UseGetK8sPodsList = ( requestData, options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -38,7 +40,8 @@ export const useGetK8sPodsList: UseGetK8sPodsList = ( }, [options?.queryKey, requestData]); return useQuery | ErrorResponse, Error>({ - queryFn: ({ signal }) => getK8sPodsList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sPodsList(requestData, signal, headers, dotMetricsEnabled), ...options, queryKey, }); diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sStatefulSetsList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sStatefulSetsList.ts index 941942cba1..b1684a207d 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sStatefulSetsList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sStatefulSetsList.ts @@ -17,6 +17,7 @@ type UseGetK8sStatefulSetsList = ( >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -28,6 +29,7 @@ export const useGetK8sStatefulSetsList: UseGetK8sStatefulSetsList = ( options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -45,7 +47,8 @@ export const useGetK8sStatefulSetsList: UseGetK8sStatefulSetsList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sStatefulSetsList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sStatefulSetsList(requestData, signal, headers, dotMetricsEnabled), ...options, diff --git a/frontend/src/hooks/infraMonitoring/useGetK8sVolumesList.ts b/frontend/src/hooks/infraMonitoring/useGetK8sVolumesList.ts index bc1c4961ea..5519ab8396 100644 --- a/frontend/src/hooks/infraMonitoring/useGetK8sVolumesList.ts +++ b/frontend/src/hooks/infraMonitoring/useGetK8sVolumesList.ts @@ -15,6 +15,7 @@ type UseGetK8sVolumesList = ( Error >, headers?: Record, + dotMetricsEnabled?: boolean, ) => UseQueryResult< SuccessResponse | ErrorResponse, Error @@ -24,6 +25,7 @@ export const useGetK8sVolumesList: UseGetK8sVolumesList = ( requestData, options, headers, + dotMetricsEnabled, ) => { const queryKey = useMemo(() => { if (options?.queryKey && Array.isArray(options.queryKey)) { @@ -41,7 +43,8 @@ export const useGetK8sVolumesList: UseGetK8sVolumesList = ( SuccessResponse | ErrorResponse, Error >({ - queryFn: ({ signal }) => getK8sVolumesList(requestData, signal, headers), + queryFn: ({ signal }) => + getK8sVolumesList(requestData, signal, headers, dotMetricsEnabled), ...options, queryKey, }); diff --git a/frontend/src/hooks/queryBuilder/useAutoComplete.ts b/frontend/src/hooks/queryBuilder/useAutoComplete.ts index 9977e328ae..c1903e0cd9 100644 --- a/frontend/src/hooks/queryBuilder/useAutoComplete.ts +++ b/frontend/src/hooks/queryBuilder/useAutoComplete.ts @@ -27,6 +27,7 @@ export type WhereClauseConfig = { export const useAutoComplete = ( query: IBuilderQuery, + dotMetricsEnabled: boolean, whereClauseConfig?: WhereClauseConfig, shouldUseSuggestions?: boolean, isInfraMonitoring?: boolean, @@ -39,6 +40,7 @@ export const useAutoComplete = ( const { keys, results, isFetching, exampleQueries } = useFetchKeysAndValues( searchValue, query, + dotMetricsEnabled, searchKey, shouldUseSuggestions, isInfraMonitoring, diff --git a/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx b/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx index c1a87bfc46..d85586ddfa 100644 --- a/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx +++ b/frontend/src/hooks/queryBuilder/useCreateAlerts.tsx @@ -38,7 +38,7 @@ const useCreateAlerts = (widget?: Widgets, caller?: string): VoidFunction => { logEvent('Panel Edit: Create alert', { panelType: widget.panelTypes, dashboardName: selectedDashboard?.data?.title, - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, widgetId: widget.id, queryType: widget.query.queryType, }); @@ -47,7 +47,7 @@ const useCreateAlerts = (widget?: Widgets, caller?: string): VoidFunction => { action: MenuItemKeys.CreateAlerts, panelType: widget.panelTypes, dashboardName: selectedDashboard?.data?.title, - dashboardId: selectedDashboard?.uuid, + dashboardId: selectedDashboard?.id, widgetId: widget.id, queryType: widget.query.queryType, }); diff --git a/frontend/src/hooks/queryBuilder/useFetchKeysAndValues.ts b/frontend/src/hooks/queryBuilder/useFetchKeysAndValues.ts index b566f4330a..a690afe91f 100644 --- a/frontend/src/hooks/queryBuilder/useFetchKeysAndValues.ts +++ b/frontend/src/hooks/queryBuilder/useFetchKeysAndValues.ts @@ -4,8 +4,8 @@ import { getAttributesValues } from 'api/queryBuilder/getAttributesValues'; import { DATA_TYPE_VS_ATTRIBUTE_VALUES_KEY } from 'constants/queryBuilder'; import { DEBOUNCE_DELAY } from 'constants/queryBuilderFilterConfig'; import { + GetK8sEntityToAggregateAttribute, K8sCategory, - K8sEntityToAggregateAttributeMapping, } from 'container/InfraMonitoringK8s/constants'; import { getRemovePrefixFromKey, @@ -50,6 +50,7 @@ type IuseFetchKeysAndValues = { export const useFetchKeysAndValues = ( searchValue: string, query: IBuilderQuery, + dotMetricsEnabled: boolean, searchKey: string, shouldUseSuggestions?: boolean, isInfraMonitoring?: boolean, @@ -123,7 +124,7 @@ export const useFetchKeysAndValues = ( aggregateOperator: query.aggregateOperator, aggregateAttribute: isInfraMonitoring && entity - ? K8sEntityToAggregateAttributeMapping[entity] + ? GetK8sEntityToAggregateAttribute(entity, dotMetricsEnabled) : query.aggregateAttribute.key, tagType: query.aggregateAttribute.type ?? null, }, @@ -219,7 +220,7 @@ export const useFetchKeysAndValues = ( aggregateOperator: 'noop', dataSource: query.dataSource, aggregateAttribute: - K8sEntityToAggregateAttributeMapping[entity] || + GetK8sEntityToAggregateAttribute(entity, dotMetricsEnabled) || query.aggregateAttribute.key, attributeKey: filterAttributeKey?.key ?? tagKey, filterAttributeKeyDataType: diff --git a/frontend/src/hooks/useResourceAttribute/ResourceProvider.tsx b/frontend/src/hooks/useResourceAttribute/ResourceProvider.tsx index d7f712f563..bb4a024191 100644 --- a/frontend/src/hooks/useResourceAttribute/ResourceProvider.tsx +++ b/frontend/src/hooks/useResourceAttribute/ResourceProvider.tsx @@ -7,6 +7,8 @@ import { encode } from 'js-base64'; import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react'; import { useLocation } from 'react-router-dom'; +import { FeatureKeys } from '../../constants/features'; +import { useAppContext } from '../../providers/App/App'; import { whilelistedKeys } from './config'; import { ResourceContext } from './context'; import { ResourceAttributesFilterMachine } from './machine'; @@ -18,6 +20,7 @@ import { import { createQuery, getResourceAttributeQueriesFromURL, + getResourceDeploymentKeys, GetTagKeys, GetTagValues, mappingWithRoutesAndKeys, @@ -53,6 +56,11 @@ function ResourceProvider({ children }: Props): JSX.Element { } }; + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const dispatchQueries = useCallback( (queries: IResourceAttribute[]): void => { urlQuery.set( @@ -70,7 +78,7 @@ function ResourceProvider({ children }: Props): JSX.Element { actions: { onSelectTagKey: () => { handleLoading(true); - GetTagKeys() + GetTagKeys(dotMetricsEnabled) .then((tagKeys) => { const options = mappingWithRoutesAndKeys(pathname, tagKeys); @@ -141,10 +149,10 @@ function ResourceProvider({ children }: Props): JSX.Element { const handleEnvironmentChange = useCallback( (environments: string[]): void => { - const staging = ['resource_deployment_environment', 'IN']; + const staging = [getResourceDeploymentKeys(dotMetricsEnabled), 'IN']; const queriesCopy = queries.filter( - (query) => query.tagKey !== 'resource_deployment_environment', + (query) => query.tagKey !== getResourceDeploymentKeys(dotMetricsEnabled), ); if (environments && Array.isArray(environments) && environments.length > 0) { @@ -159,7 +167,7 @@ function ResourceProvider({ children }: Props): JSX.Element { send('RESET'); }, - [dispatchQueries, queries, send], + [dispatchQueries, dotMetricsEnabled, queries, send], ); const handleClose = useCallback( diff --git a/frontend/src/hooks/useResourceAttribute/__tests__/useResourceAttribute.test.tsx b/frontend/src/hooks/useResourceAttribute/__tests__/useResourceAttribute.test.tsx index 2c4b3731a1..a63e318b70 100644 --- a/frontend/src/hooks/useResourceAttribute/__tests__/useResourceAttribute.test.tsx +++ b/frontend/src/hooks/useResourceAttribute/__tests__/useResourceAttribute.test.tsx @@ -1,10 +1,14 @@ import { act, renderHook, waitFor } from '@testing-library/react'; import { createMemoryHistory } from 'history'; +import { AppProvider } from 'providers/App/App'; +import { QueryClient, QueryClientProvider } from 'react-query'; import { Router } from 'react-router-dom'; import ResourceProvider from '../ResourceProvider'; import useResourceAttribute from '../useResourceAttribute'; +const queryClient = new QueryClient(); + jest.mock('hooks/useSafeNavigate', () => ({ useSafeNavigate: (): any => ({ safeNavigate: jest.fn(), @@ -17,9 +21,13 @@ describe('useResourceAttribute component hook', () => { initialEntries: ['/inital-url?tab=overview'], }); const wrapper = ({ children }: { children: any }): JSX.Element => ( - - {children} - + + + + {children} + + + ); const { result } = renderHook(() => useResourceAttribute(), { wrapper }); diff --git a/frontend/src/hooks/useResourceAttribute/utils.ts b/frontend/src/hooks/useResourceAttribute/utils.ts index 9c644221ec..d0878c6f2b 100644 --- a/frontend/src/hooks/useResourceAttribute/utils.ts +++ b/frontend/src/hooks/useResourceAttribute/utils.ts @@ -146,7 +146,17 @@ export const OperatorSchema: IOption[] = OperatorConversions.map( }), ); -export const GetTagKeys = async (): Promise => { +export const getResourceDeploymentKeys = ( + dotMetricsEnabled: boolean, +): string => { + if (dotMetricsEnabled) return 'resource_deployment.environment'; + return 'resource_deployment_environment'; +}; + +export const GetTagKeys = async ( + dotMetricsEnabled: boolean, +): Promise => { + const resourceDeploymentKey = getResourceDeploymentKeys(dotMetricsEnabled); const { payload } = await getResourceAttributesTagKeys({ metricName: 'signoz_calls_total', match: 'resource_', @@ -159,17 +169,19 @@ export const GetTagKeys = async (): Promise => { payload.data.attributeKeys?.map((attributeKey) => attributeKey.key) || []; return keys - .filter((tagKey: string) => tagKey !== 'resource_deployment_environment') + .filter((tagKey: string) => tagKey !== resourceDeploymentKey) .map((tagKey: string) => ({ label: convertMetricKeyToTrace(tagKey), value: tagKey, })); }; -export const getEnvironmentTagKeys = async (): Promise => { +export const getEnvironmentTagKeys = async ( + dotMetricsEnabled: boolean, +): Promise => { const { payload } = await getResourceAttributesTagKeys({ metricName: 'signoz_calls_total', - match: 'resource_deployment_environment', + match: getResourceDeploymentKeys(dotMetricsEnabled), }); if (!payload || !payload?.data) { return []; @@ -182,9 +194,11 @@ export const getEnvironmentTagKeys = async (): Promise => { })); }; -export const getEnvironmentTagValues = async (): Promise => { +export const getEnvironmentTagValues = async ( + dotMetricsEnabled: boolean, +): Promise => { const { payload } = await getResourceAttributesTagValues({ - tagKey: 'resource_deployment_environment', + tagKey: getResourceDeploymentKeys(dotMetricsEnabled), metricName: 'signoz_calls_total', }); diff --git a/frontend/src/mocks-server/__mockdata__/dashboards.ts b/frontend/src/mocks-server/__mockdata__/dashboards.ts index 8987d0d8a2..1db096a6a4 100644 --- a/frontend/src/mocks-server/__mockdata__/dashboards.ts +++ b/frontend/src/mocks-server/__mockdata__/dashboards.ts @@ -3,8 +3,7 @@ export const dashboardSuccessResponse = { status: 'success', data: [ { - id: 1, - uuid: '1', + id: '1', createdAt: '2022-11-16T13:29:47.064874419Z', createdBy: null, updatedAt: '2024-05-21T06:41:30.546630961Z', @@ -23,8 +22,7 @@ export const dashboardSuccessResponse = { }, }, { - id: 2, - uuid: '2', + id: '2', createdAt: '2022-11-16T13:20:47.064874419Z', createdBy: null, updatedAt: '2024-05-21T06:42:30.546630961Z', @@ -53,8 +51,7 @@ export const dashboardEmptyState = { export const getDashboardById = { status: 'success', data: { - id: 1, - uuid: '1', + id: '1', createdAt: '2022-11-16T13:29:47.064874419Z', createdBy: 'integration', updatedAt: '2024-05-21T06:41:30.546630961Z', @@ -78,8 +75,7 @@ export const getDashboardById = { export const getNonIntegrationDashboardById = { status: 'success', data: { - id: 1, - uuid: '1', + id: '1', createdAt: '2022-11-16T13:29:47.064874419Z', createdBy: 'thor', updatedAt: '2024-05-21T06:41:30.546630961Z', diff --git a/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx b/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx index e6d6490cfc..0b92d2f0f8 100644 --- a/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx +++ b/frontend/src/pages/DashboardsListPage/__tests__/DashboardListPage.test.tsx @@ -234,7 +234,6 @@ describe('dashboard list page', () => { const firstDashboardData = dashboardSuccessResponse.data[0]; expect(dashboardUtils.sanitizeDashboardData).toHaveBeenCalledWith( expect.objectContaining({ - id: firstDashboardData.uuid, title: firstDashboardData.data.title, createdAt: firstDashboardData.createdAt, }), diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricColumnGraphs.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricColumnGraphs.tsx index a2c1cdc48f..44da6fb45b 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricColumnGraphs.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricColumnGraphs.tsx @@ -4,22 +4,24 @@ import { useIsDarkMode } from 'hooks/useDarkMode'; import { useTranslation } from 'react-i18next'; import { Widgets } from 'types/api/dashboard/getAll'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; import MetricPageGridGraph from './MetricPageGraph'; import { - averageRequestLatencyWidgetData, - brokerCountWidgetData, - brokerNetworkThroughputWidgetData, - bytesConsumedWidgetData, - consumerFetchRateWidgetData, - consumerGroupMemberWidgetData, - consumerLagByGroupWidgetData, - consumerOffsetWidgetData, - ioWaitTimeWidgetData, - kafkaProducerByteRateWidgetData, - messagesConsumedWidgetData, - producerFetchRequestPurgatoryWidgetData, - requestResponseWidgetData, - requestTimesWidgetData, + getAverageRequestLatencyWidgetData, + getBrokerCountWidgetData, + getBrokerNetworkThroughputWidgetData, + getBytesConsumedWidgetData, + getConsumerFetchRateWidgetData, + getConsumerGroupMemberWidgetData, + getConsumerLagByGroupWidgetData, + getConsumerOffsetWidgetData, + getIoWaitTimeWidgetData, + getKafkaProducerByteRateWidgetData, + getMessagesConsumedWidgetData, + getProducerFetchRequestPurgatoryWidgetData, + getRequestResponseWidgetData, + getRequestTimesWidgetData, } from './MetricPageUtil'; interface MetricSectionProps { @@ -71,15 +73,20 @@ function MetricColumnGraphs({ }): JSX.Element { const { t } = useTranslation('messagingQueues'); + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const metricsData = [ { title: t('metricGraphCategory.brokerMetrics.title'), description: t('metricGraphCategory.brokerMetrics.description'), graphCount: [ - brokerCountWidgetData, - requestTimesWidgetData, - producerFetchRequestPurgatoryWidgetData, - brokerNetworkThroughputWidgetData, + getBrokerCountWidgetData(dotMetricsEnabled), + getRequestTimesWidgetData(dotMetricsEnabled), + getProducerFetchRequestPurgatoryWidgetData(dotMetricsEnabled), + getBrokerNetworkThroughputWidgetData(dotMetricsEnabled), ], id: 'broker-metrics', }, @@ -87,11 +94,11 @@ function MetricColumnGraphs({ title: t('metricGraphCategory.producerMetrics.title'), description: t('metricGraphCategory.producerMetrics.description'), graphCount: [ - ioWaitTimeWidgetData, - requestResponseWidgetData, - averageRequestLatencyWidgetData, - kafkaProducerByteRateWidgetData, - bytesConsumedWidgetData, + getIoWaitTimeWidgetData(dotMetricsEnabled), + getRequestResponseWidgetData(dotMetricsEnabled), + getAverageRequestLatencyWidgetData(dotMetricsEnabled), + getKafkaProducerByteRateWidgetData(dotMetricsEnabled), + getBytesConsumedWidgetData(dotMetricsEnabled), ], id: 'producer-metrics', }, @@ -99,11 +106,11 @@ function MetricColumnGraphs({ title: t('metricGraphCategory.consumerMetrics.title'), description: t('metricGraphCategory.consumerMetrics.description'), graphCount: [ - consumerOffsetWidgetData, - consumerGroupMemberWidgetData, - consumerLagByGroupWidgetData, - consumerFetchRateWidgetData, - messagesConsumedWidgetData, + getConsumerOffsetWidgetData(dotMetricsEnabled), + getConsumerGroupMemberWidgetData(dotMetricsEnabled), + getConsumerLagByGroupWidgetData(dotMetricsEnabled), + getConsumerFetchRateWidgetData(dotMetricsEnabled), + getMessagesConsumedWidgetData(dotMetricsEnabled), ], id: 'consumer-metrics', }, diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPage.tsx b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPage.tsx index 43c83fd018..aaf18d86ea 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPage.tsx +++ b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPage.tsx @@ -10,17 +10,19 @@ import { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Widgets } from 'types/api/dashboard/getAll'; +import { FeatureKeys } from '../../../../constants/features'; +import { useAppContext } from '../../../../providers/App/App'; import MetricColumnGraphs from './MetricColumnGraphs'; import MetricPageGridGraph from './MetricPageGraph'; import { - cpuRecentUtilizationWidgetData, - currentOffsetPartitionWidgetData, - insyncReplicasWidgetData, - jvmGcCollectionsElapsedWidgetData, - jvmGCCountWidgetData, - jvmMemoryHeapWidgetData, - oldestOffsetWidgetData, - partitionCountPerTopicWidgetData, + getCpuRecentUtilizationWidgetData, + getCurrentOffsetPartitionWidgetData, + getInsyncReplicasWidgetData, + getJvmGcCollectionsElapsedWidgetData, + getJvmGCCountWidgetData, + getJvmMemoryHeapWidgetData, + getOldestOffsetWidgetData, + getPartitionCountPerTopicWidgetData, } from './MetricPageUtil'; interface CollapsibleMetricSectionProps { @@ -95,6 +97,11 @@ function MetricPage(): JSX.Element { })); }; + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const { t } = useTranslation('messagingQueues'); const metricSections = [ @@ -103,10 +110,10 @@ function MetricPage(): JSX.Element { title: t('metricGraphCategory.brokerJVMMetrics.title'), description: t('metricGraphCategory.brokerJVMMetrics.description'), graphCount: [ - jvmGCCountWidgetData, - jvmGcCollectionsElapsedWidgetData, - cpuRecentUtilizationWidgetData, - jvmMemoryHeapWidgetData, + getJvmGCCountWidgetData(dotMetricsEnabled), + getJvmGcCollectionsElapsedWidgetData(dotMetricsEnabled), + getCpuRecentUtilizationWidgetData(dotMetricsEnabled), + getJvmMemoryHeapWidgetData(dotMetricsEnabled), ], }, { @@ -114,10 +121,10 @@ function MetricPage(): JSX.Element { title: t('metricGraphCategory.partitionMetrics.title'), description: t('metricGraphCategory.partitionMetrics.description'), graphCount: [ - partitionCountPerTopicWidgetData, - currentOffsetPartitionWidgetData, - oldestOffsetWidgetData, - insyncReplicasWidgetData, + getPartitionCountPerTopicWidgetData(dotMetricsEnabled), + getCurrentOffsetPartitionWidgetData(dotMetricsEnabled), + getOldestOffsetWidgetData(dotMetricsEnabled), + getInsyncReplicasWidgetData(dotMetricsEnabled), ], }, ]; diff --git a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil.ts b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil.ts index 66999c77ae..fdb304b970 100644 --- a/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil.ts +++ b/frontend/src/pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil.ts @@ -79,1023 +79,1145 @@ export function getWidgetQuery( }; } -export const requestTimesWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_request_time_avg--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_request_time_avg', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request Times', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Request Times', - description: - 'This metric is used to measure the average latency experienced by requests across the Kafka broker.', - }), -); - -export const brokerCountWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_brokers--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_brokers', - type: 'Gauge', - }, - aggregateOperator: 'sum', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Broker count', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'sum', - }, - ], - title: 'Broker Count', - description: 'Total number of active brokers in the Kafka cluster.\n', - }), -); - -export const producerFetchRequestPurgatoryWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_purgatory_size--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_purgatory_size', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Producer and Fetch Request Purgatory', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Producer and Fetch Request Purgatory', - description: - 'Measures the number of requests that Kafka brokers have received but cannot immediately fulfill', - }), -); - -export const brokerNetworkThroughputWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: - 'kafka_server_brokertopicmetrics_bytesoutpersec_oneminuterate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_server_brokertopicmetrics_bytesoutpersec_oneminuterate', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Broker Network Throughput', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Broker Network Throughput', - description: - 'Helps gauge the data throughput from the Kafka broker to consumer clients, focusing on the network usage associated with serving messages to consumers.', - }), -); - -export const ioWaitTimeWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_producer_io_waittime_total--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'kafka_producer_io_waittime_total', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'I/O Wait Time', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - title: 'I/O Wait Time', - description: - 'This metric measures the total time that producers are in an I/O wait state, indicating potential bottlenecks in data transmission from producers to Kafka brokers.', - }), -); - -export const requestResponseWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_producer_request_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_producer_request_rate', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Request Rate', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_producer_response_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_producer_response_rate', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'B', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Response Rate', - limit: null, - orderBy: [], - queryName: 'B', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Request and Response Rate', - description: - "Indicates how many requests the producer is sending per second, reflecting the intensity of the producer's interaction with the Kafka cluster. Also, helps Kafka administrators gauge the responsiveness of brokers to producer requests.", - }), -); - -export const averageRequestLatencyWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_producer_request_latency_avg--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_producer_request_latency_avg', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Average Request Latency', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Average Request Latency', - description: - 'Helps Kafka administrators and developers understand the average latency experienced by producer requests.', - }), -); - -export const kafkaProducerByteRateWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_producer_byte_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_producer_byte_rate', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, +export const getRequestTimesWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + // choose key based on flag + key: dotMetricsEnabled + ? 'kafka.request.time.avg' + : 'kafka_request_time_avg', + // mirror into the id as well + id: 'kafka_request_time_avg--float64--Gauge--true', + isColumn: true, isJSON: false, - key: 'topic', - type: 'tag', + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'kafka_producer_byte_rate', - description: - 'Helps measure the data output rate from the producer, indicating the load a producer is placing on Kafka brokers.', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { + items: [], + op: 'AND', + }, + functions: [], + groupBy: [], + having: [], + legend: 'Request Times', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Request Times', + description: + 'This metric is used to measure the average latency experienced by requests across the Kafka broker.', + }), + ); -export const bytesConsumedWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_bytes_consumed_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_bytes_consumed_rate', - type: 'Gauge', +export const getBrokerCountWidgetData = (dotMetricsEnabled: boolean): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled ? 'kafka.brokers' : 'kafka_brokers', + id: 'kafka_brokers--float64--Gauge--true', + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'sum', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Broker count', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'sum', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Bytes Consumed', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Bytes Consumed', - description: - 'Helps Kafka administrators monitor the data consumption rate of a consumer group, showing how much data (in bytes) is being read from the Kafka cluster over time.', - }), -); + ], + title: 'Broker Count', + description: 'Total number of active brokers in the Kafka cluster.', + }), + ); -export const consumerOffsetWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_group_offset--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_group_offset', - type: 'Gauge', +export const getProducerFetchRequestPurgatoryWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + // inline ternary based on dotMetricsEnabled + key: dotMetricsEnabled ? 'kafka.purgatory.size' : 'kafka_purgatory_size', + id: `${ + dotMetricsEnabled ? 'kafka.purgatory.size' : 'kafka_purgatory_size' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Producer and Fetch Request Purgatory', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'group--string--tag--false', - isColumn: false, - isJSON: false, - key: 'group', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, - isJSON: false, - key: 'topic', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'partition--string--tag--false', - isColumn: false, - isJSON: false, - key: 'partition', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Consumer Offset', - description: 'Current offset of each consumer group for each topic partition', - }), -); + ], + title: 'Producer and Fetch Request Purgatory', + description: + 'Measures the number of requests that Kafka brokers have received but cannot immediately fulfill', + }), + ); -export const consumerGroupMemberWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_group_members--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_group_members', - type: 'Gauge', - }, - aggregateOperator: 'sum', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'group--string--tag--false', - isColumn: false, +export const getBrokerNetworkThroughputWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + // inline ternary based on dotMetricsEnabled + key: dotMetricsEnabled + ? 'kafka_server_brokertopicmetrics_total_replicationbytesinpersec_oneminuterate' + : 'kafka_server_brokertopicmetrics_bytesoutpersec_oneminuterate', + id: `${ + dotMetricsEnabled + ? 'kafka_server_brokertopicmetrics_total_replicationbytesinpersec_oneminuterate' + : 'kafka_server_brokertopicmetrics_bytesoutpersec_oneminuterate' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'group', - type: 'tag', + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'sum', - }, - ], - title: 'Consumer Group Members', - description: 'Number of active users in each group', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Broker Network Throughput', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Broker Network Throughput', + description: + 'Helps gauge the data throughput from the Kafka broker to consumer clients, focusing on the network usage associated with serving messages to consumers.', + }), + ); -export const consumerLagByGroupWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_group_lag--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_group_lag', - type: 'Gauge', +export const getIoWaitTimeWidgetData = (dotMetricsEnabled: boolean): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + // inline ternary based on dotMetricsEnabled + key: dotMetricsEnabled + ? 'kafka.producer.io_waittime_total' + : 'kafka_producer_io_waittime_total', + id: `${ + dotMetricsEnabled + ? 'kafka.producer.io_waittime_total' + : 'kafka_producer_io_waittime_total' + }--float64--Sum--true`, + isColumn: true, + isJSON: false, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'I/O Wait Time', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'group--string--tag--false', - isColumn: false, - isJSON: false, - key: 'group', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, - isJSON: false, - key: 'topic', - type: 'tag', - }, - { - dataType: DataTypes.String, - id: 'partition--string--tag--false', - isColumn: false, - isJSON: false, - key: 'partition', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Consumer Lag by Group', - description: - 'Helps Kafka administrators assess whether consumer groups are keeping up with the incoming data stream or falling behind', - }), -); + ], + title: 'I/O Wait Time', + description: + 'This metric measures the total time that producers are in an I/O wait state, indicating potential bottlenecks in data transmission from producers to Kafka brokers.', + }), + ); -export const consumerFetchRateWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_fetch_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_fetch_rate', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'service_name--string--tag--false', - isColumn: false, +export const getRequestResponseWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.producer.request_rate' + : 'kafka_producer_request_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.producer.request_rate' + : 'kafka_producer_request_rate' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'service_name', - type: 'tag', + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Consumer Fetch Rate', - description: - 'Metric measures the rate at which fetch requests are made by a Kafka consumer to the broker, typically in requests per second.', - }), -); - -export const messagesConsumedWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_consumer_records_consumed_rate--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_consumer_records_consumed_rate', - type: 'Gauge', + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Request Rate', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'Messages Consumed', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Messages Consumed', - description: - 'Measures the rate at which a Kafka consumer is consuming records (messages) per second from Kafka brokers.', - }), -); - -export const jvmGCCountWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'jvm_gc_collections_count--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'jvm_gc_collections_count', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'JVM GC Count', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - title: 'JVM GC Count', - description: - 'Tracks the total number of garbage collection (GC) events that have occurred in the Java Virtual Machine (JVM).', - }), -); - -export const jvmGcCollectionsElapsedWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'jvm_gc_collections_elapsed--float64--Sum--true', - isColumn: true, - isJSON: false, - key: 'jvm_gc_collections_elapsed', - type: 'Sum', - }, - aggregateOperator: 'rate', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'garbagecollector', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'rate', - }, - ], - title: 'jvm_gc_collections_elapsed', - description: - 'Measures the total time (usually in milliseconds) spent on garbage collection (GC) events in the Java Virtual Machine (JVM).', - }), -); - -export const cpuRecentUtilizationWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'jvm_cpu_recent_utilization--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'jvm_cpu_recent_utilization', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'CPU utilization', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'CPU Recent Utilization', - description: - 'This metric measures the recent CPU usage by the Java Virtual Machine (JVM), typically expressed as a percentage.', - }), -); - -export const jvmMemoryHeapWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'jvm_memory_heap_max--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'jvm_memory_heap_max', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [], - having: [], - legend: 'JVM memory heap', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'JVM memory heap', - description: - 'The metric represents the maximum amount of heap memory available to the Java Virtual Machine (JVM)', - }), -); - -export const partitionCountPerTopicWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_topic_partitions--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_topic_partitions', - type: 'Gauge', - }, - aggregateOperator: 'sum', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.producer.response_rate' + : 'kafka_producer_response_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.producer.response_rate' + : 'kafka_producer_response_rate' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'topic', - type: 'tag', + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'sum', - stepInterval: 60, - timeAggregation: 'sum', - }, - ], - title: 'Partition Count per Topic', - description: 'Number of partitions for each topic', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'B', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Response Rate', + limit: null, + orderBy: [], + queryName: 'B', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Request and Response Rate', + description: + "Indicates how many requests the producer is sending per second, reflecting the intensity of the producer's interaction with the Kafka cluster. Also, helps Kafka administrators gauge the responsiveness of brokers to producer requests.", + }), + ); -export const currentOffsetPartitionWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_partition_current_offset--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_partition_current_offset', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, +export const getAverageRequestLatencyWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.producer.request_latency_avg' + : 'kafka_producer_request_latency_avg', + id: `${ + dotMetricsEnabled + ? 'kafka.producer.request_latency_avg' + : 'kafka_producer_request_latency_avg' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'topic', - type: 'tag', + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'partition--string--tag--false', - isColumn: false, - isJSON: false, - key: 'partition', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Current Offset ( Partition )', - description: - 'Current offset of each partition, showing the latest position in each partition', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Average Request Latency', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Average Request Latency', + description: + 'Helps Kafka administrators and developers understand the average latency experienced by producer requests.', + }), + ); -export const oldestOffsetWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_partition_oldest_offset--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_partition_oldest_offset', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, +export const getKafkaProducerByteRateWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.producer.byte_rate' + : 'kafka_producer_byte_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.producer.byte_rate' + : 'kafka_producer_byte_rate' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'topic', - type: 'tag', + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'partition--string--tag--false', - isColumn: false, - isJSON: false, - key: 'partition', - type: 'tag', - }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'Oldest Offset (Partition)', - description: - 'Oldest offset of each partition to identify log retention and offset range.', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: dotMetricsEnabled + ? 'kafka.producer.byte_rate' + : 'kafka_producer_byte_rate', + description: + 'Helps measure the data output rate from the producer, indicating the load a producer is placing on Kafka brokers.', + }), + ); -export const insyncReplicasWidgetData = getWidgetQueryBuilder( - getWidgetQuery({ - queryData: [ - { - aggregateAttribute: { - dataType: DataTypes.Float64, - id: 'kafka_partition_replicas_in_sync--float64--Gauge--true', - isColumn: true, - isJSON: false, - key: 'kafka_partition_replicas_in_sync', - type: 'Gauge', - }, - aggregateOperator: 'avg', - dataSource: DataSource.METRICS, - disabled: false, - expression: 'A', - filters: { - items: [], - op: 'AND', - }, - functions: [], - groupBy: [ - { - dataType: DataTypes.String, - id: 'topic--string--tag--false', - isColumn: false, +export const getBytesConsumedWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer.bytes_consumed_rate' + : 'kafka_consumer_bytes_consumed_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer.bytes_consumed_rate' + : 'kafka_consumer_bytes_consumed_rate' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'topic', - type: 'tag', + type: 'Gauge', }, - { - dataType: DataTypes.String, - id: 'partition--string--tag--false', - isColumn: false, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Bytes Consumed', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + // Use kebab-case title as requested + title: 'Bytes Consumed', + description: + 'Helps Kafka administrators monitor the data consumption rate of a consumer group, showing how much data (in bytes) is being read from the Kafka cluster over time.', + }), + ); + +export const getConsumerOffsetWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer_group.offset' + : 'kafka_consumer_group_offset', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer_group.offset' + : 'kafka_consumer_group_offset' + }--float64--Gauge--true`, + isColumn: true, isJSON: false, - key: 'partition', - type: 'tag', + type: 'Gauge', }, - ], - having: [], - legend: '', - limit: null, - orderBy: [], - queryName: 'A', - reduceTo: 'avg', - spaceAggregation: 'avg', - stepInterval: 60, - timeAggregation: 'avg', - }, - ], - title: 'In-Sync Replicas (ISR)', - description: - 'Count of in-sync replicas for each partition to ensure data availability.', - }), -); + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'group--string--tag--false', + isColumn: false, + isJSON: false, + key: 'group', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'partition--string--tag--false', + isColumn: false, + isJSON: false, + key: 'partition', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Consumer Offset', + description: + 'Current offset of each consumer group for each topic partition', + }), + ); + +export const getConsumerGroupMemberWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer_group.members' + : 'kafka_consumer_group_members', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer_group.members' + : 'kafka_consumer_group_members' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'sum', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'group--string--tag--false', + isColumn: false, + isJSON: false, + key: 'group', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'sum', + }, + ], + title: 'Consumer Group Members', + description: 'Number of active users in each group', + }), + ); + +export const getConsumerLagByGroupWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer_group.lag' + : 'kafka_consumer_group_lag', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer_group.lag' + : 'kafka_consumer_group_lag' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'group--string--tag--false', + isColumn: false, + isJSON: false, + key: 'group', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'partition--string--tag--false', + isColumn: false, + isJSON: false, + key: 'partition', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Consumer Lag by Group', + description: + 'Helps Kafka administrators assess whether consumer groups are keeping up with the incoming data stream or falling behind', + }), + ); + +export const getConsumerFetchRateWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer.fetch_rate' + : 'kafka_consumer_fetch_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer.fetch_rate' + : 'kafka_consumer_fetch_rate' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'service_name--string--tag--false', + isColumn: false, + isJSON: false, + key: dotMetricsEnabled ? 'service.name' : 'service_name', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Consumer Fetch Rate', + description: + 'Metric measures the rate at which fetch requests are made by a Kafka consumer to the broker, typically in requests per second.', + }), + ); + +export const getMessagesConsumedWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.consumer.records_consumed_rate' + : 'kafka_consumer_records_consumed_rate', + id: `${ + dotMetricsEnabled + ? 'kafka.consumer.records_consumed_rate' + : 'kafka_consumer_records_consumed_rate' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'Messages Consumed', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Messages Consumed', + description: + 'Measures the rate at which a Kafka consumer is consuming records (messages) per second from Kafka brokers.', + }), + ); + +export const getJvmGCCountWidgetData = (dotMetricsEnabled: boolean): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'jvm.gc.collections.count' + : 'jvm_gc_collections_count', + id: `${ + dotMetricsEnabled + ? 'jvm.gc.collections.count' + : 'jvm_gc_collections_count' + }--float64--Sum--true`, + isColumn: true, + isJSON: false, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'JVM GC Count', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + title: 'JVM GC Count', + description: + 'Tracks the total number of garbage collection (GC) events that have occurred in the Java Virtual Machine (JVM).', + }), + ); + +export const getJvmGcCollectionsElapsedWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'jvm.gc.collections.elapsed' + : 'jvm_gc_collections_elapsed', + id: `${ + dotMetricsEnabled + ? 'jvm.gc.collections.elapsed' + : 'jvm_gc_collections_elapsed' + }--float64--Sum--true`, + isColumn: true, + isJSON: false, + type: 'Sum', + }, + aggregateOperator: 'rate', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'garbagecollector', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'rate', + }, + ], + title: dotMetricsEnabled + ? 'jvm.gc.collections.elapsed' + : 'jvm_gc_collections_elapsed', + description: + 'Measures the total time (usually in milliseconds) spent on garbage collection (GC) events in the Java Virtual Machine (JVM).', + }), + ); + +export const getCpuRecentUtilizationWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'jvm.cpu.recent_utilization' + : 'jvm_cpu_recent_utilization', + id: `${ + dotMetricsEnabled + ? 'jvm.cpu.recent_utilization' + : 'jvm_cpu_recent_utilization' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'CPU utilization', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'CPU Recent Utilization', + description: + 'This metric measures the recent CPU usage by the Java Virtual Machine (JVM), typically expressed as a percentage.', + }), + ); + +export const getJvmMemoryHeapWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled ? 'jvm.memory.heap.max' : 'jvm_memory_heap_max', + id: `${ + dotMetricsEnabled ? 'jvm.memory.heap.max' : 'jvm_memory_heap_max' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [], + having: [], + legend: 'JVM memory heap', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'JVM memory heap', + description: + 'The metric represents the maximum amount of heap memory available to the Java Virtual Machine (JVM)', + }), + ); + +export const getPartitionCountPerTopicWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.topic.partitions' + : 'kafka_topic_partitions', + id: `${ + dotMetricsEnabled ? 'kafka.topic.partitions' : 'kafka_topic_partitions' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'sum', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'sum', + stepInterval: 60, + timeAggregation: 'sum', + }, + ], + title: 'Partition Count per Topic', + description: 'Number of partitions for each topic', + }), + ); + +export const getCurrentOffsetPartitionWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.partition.current_offset' + : 'kafka_partition_current_offset', + id: `${ + dotMetricsEnabled + ? 'kafka.partition.current_offset' + : 'kafka_partition_current_offset' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'partition--string--tag--false', + isColumn: false, + isJSON: false, + key: 'partition', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Current Offset ( Partition )', + description: + 'Current offset of each partition, showing the latest position in each partition', + }), + ); + +export const getOldestOffsetWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.partition.oldest_offset' + : 'kafka_partition_oldest_offset', + id: `${ + dotMetricsEnabled + ? 'kafka.partition.oldest_offset' + : 'kafka_partition_oldest_offset' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'partition--string--tag--false', + isColumn: false, + isJSON: false, + key: 'partition', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'Oldest Offset (Partition)', + description: + 'Oldest offset of each partition to identify log retention and offset range.', + }), + ); + +export const getInsyncReplicasWidgetData = ( + dotMetricsEnabled: boolean, +): Widgets => + getWidgetQueryBuilder( + getWidgetQuery({ + queryData: [ + { + aggregateAttribute: { + dataType: DataTypes.Float64, + key: dotMetricsEnabled + ? 'kafka.partition.replicas_in_sync' + : 'kafka_partition_replicas_in_sync', + id: `${ + dotMetricsEnabled + ? 'kafka.partition.replicas_in_sync' + : 'kafka_partition_replicas_in_sync' + }--float64--Gauge--true`, + isColumn: true, + isJSON: false, + type: 'Gauge', + }, + aggregateOperator: 'avg', + dataSource: DataSource.METRICS, + disabled: false, + expression: 'A', + filters: { items: [], op: 'AND' }, + functions: [], + groupBy: [ + { + dataType: DataTypes.String, + id: 'topic--string--tag--false', + isColumn: false, + isJSON: false, + key: 'topic', + type: 'tag', + }, + { + dataType: DataTypes.String, + id: 'partition--string--tag--false', + isColumn: false, + isJSON: false, + key: 'partition', + type: 'tag', + }, + ], + having: [], + legend: '', + limit: null, + orderBy: [], + queryName: 'A', + reduceTo: 'avg', + spaceAggregation: 'avg', + stepInterval: 60, + timeAggregation: 'avg', + }, + ], + title: 'In-Sync Replicas (ISR)', + description: + 'Count of in-sync replicas for each partition to ensure data availability.', + }), + ); diff --git a/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx b/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx index da83a197fc..72e384460c 100644 --- a/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx +++ b/frontend/src/pages/MessagingQueues/MQGraph/MQConfigOptions.tsx @@ -13,6 +13,8 @@ import { useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; import { useCopyToClipboard } from 'react-use'; +import { FeatureKeys } from '../../../constants/features'; +import { useAppContext } from '../../../providers/App/App'; import { useGetAllConfigOptions } from './useGetAllConfigOptions'; type ConfigOptionType = 'group' | 'topic' | 'partition'; @@ -38,11 +40,19 @@ const useConfigOptions = ( isFetching: boolean; options: DefaultOptionType[]; } => { + const { featureFlags } = useAppContext(); + const dotMetricsEnabled = + featureFlags?.find((flag) => flag.name === FeatureKeys.DOT_METRICS_ENABLED) + ?.active || false; + const [searchText, setSearchText] = useState(''); - const { isFetching, options } = useGetAllConfigOptions({ - attributeKey: type, - searchText, - }); + const { isFetching, options } = useGetAllConfigOptions( + { + attributeKey: type, + searchText, + }, + dotMetricsEnabled, + ); const handleDebouncedSearch = useDebouncedFn((searchText): void => { setSearchText(searchText as string); }, 500); diff --git a/frontend/src/pages/MessagingQueues/MQGraph/useGetAllConfigOptions.ts b/frontend/src/pages/MessagingQueues/MQGraph/useGetAllConfigOptions.ts index f3370512bc..aa070d6758 100644 --- a/frontend/src/pages/MessagingQueues/MQGraph/useGetAllConfigOptions.ts +++ b/frontend/src/pages/MessagingQueues/MQGraph/useGetAllConfigOptions.ts @@ -17,16 +17,19 @@ export interface GetAllConfigOptionsResponse { export function useGetAllConfigOptions( props: ConfigOptions, + dotMetricsEnabled: boolean, ): GetAllConfigOptionsResponse { const { attributeKey, searchText } = props; const { data, isLoading } = useQuery( ['attributesValues', attributeKey, searchText], - async () => { + async (): Promise => { const { payload } = await getAttributesValues({ aggregateOperator: 'avg', dataSource: DataSource.METRICS, - aggregateAttribute: 'kafka_consumer_group_lag', + aggregateAttribute: dotMetricsEnabled + ? 'kafka.consumer_group.lag' + : 'kafka_consumer_group_lag', attributeKey, searchText: searchText ?? '', filterAttributeKeyDataType: DataTypes.String, diff --git a/frontend/src/pages/MetricsExplorer/MetricsExplorerPage.tsx b/frontend/src/pages/MetricsExplorer/MetricsExplorerPage.tsx index 1b416d4f64..7a13a65ac9 100644 --- a/frontend/src/pages/MetricsExplorer/MetricsExplorerPage.tsx +++ b/frontend/src/pages/MetricsExplorer/MetricsExplorerPage.tsx @@ -5,12 +5,12 @@ import { TabRoutes } from 'components/RouteTab/types'; import history from 'lib/history'; import { useLocation } from 'react-use'; -import { Explorer, Summary } from './constants'; +import { Explorer, Summary, Views } from './constants'; function MetricsExplorerPage(): JSX.Element { const { pathname } = useLocation(); - const routes: TabRoutes[] = [Summary, Explorer]; + const routes: TabRoutes[] = [Summary, Explorer, Views]; return (
diff --git a/frontend/src/pages/MetricsExplorer/constants.tsx b/frontend/src/pages/MetricsExplorer/constants.tsx index a1c12d0906..daad1775b5 100644 --- a/frontend/src/pages/MetricsExplorer/constants.tsx +++ b/frontend/src/pages/MetricsExplorer/constants.tsx @@ -2,8 +2,8 @@ import { TabRoutes } from 'components/RouteTab/types'; import ROUTES from 'constants/routes'; import ExplorerPage from 'container/MetricsExplorer/Explorer'; import SummaryPage from 'container/MetricsExplorer/Summary'; -import ViewsPage from 'container/MetricsExplorer/Views'; import { BarChart2, Compass, TowerControl } from 'lucide-react'; +import SaveView from 'pages/SaveView'; export const Summary: TabRoutes = { Component: SummaryPage, @@ -28,7 +28,7 @@ export const Explorer: TabRoutes = { }; export const Views: TabRoutes = { - Component: ViewsPage, + Component: SaveView, name: (
Views diff --git a/frontend/src/pages/NewDashboard/DashboardPage.tsx b/frontend/src/pages/NewDashboard/DashboardPage.tsx index befefa88eb..05f8fe168d 100644 --- a/frontend/src/pages/NewDashboard/DashboardPage.tsx +++ b/frontend/src/pages/NewDashboard/DashboardPage.tsx @@ -19,9 +19,9 @@ function DashboardPage(): JSX.Element { : 'Something went wrong'; useEffect(() => { - const dashboardTitle = dashboardResponse.data?.data.title; + const dashboardTitle = dashboardResponse.data?.data.data.title; document.title = dashboardTitle || document.title; - }, [dashboardResponse.data?.data.title, isFetching]); + }, [dashboardResponse.data?.data.data.title, isFetching]); if (isError && !isFetching && errorMessage === ErrorType.NotFound) { return ; diff --git a/frontend/src/pages/SaveView/constants.ts b/frontend/src/pages/SaveView/constants.ts index a6d55b1cb9..e07b3c8876 100644 --- a/frontend/src/pages/SaveView/constants.ts +++ b/frontend/src/pages/SaveView/constants.ts @@ -5,6 +5,7 @@ export const SOURCEPAGE_VS_ROUTES: { } = { logs: ROUTES.LOGS_EXPLORER, traces: ROUTES.TRACES_EXPLORER, + metrics: ROUTES.METRICS_EXPLORER_EXPLORER, } as const; export const ROUTES_VS_SOURCEPAGE: { @@ -12,4 +13,5 @@ export const ROUTES_VS_SOURCEPAGE: { } = { [ROUTES.LOGS_SAVE_VIEWS]: 'logs', [ROUTES.TRACES_SAVE_VIEWS]: 'traces', + [ROUTES.METRICS_EXPLORER_VIEWS]: 'metrics', } as const; diff --git a/frontend/src/pages/TracesExplorer/index.tsx b/frontend/src/pages/TracesExplorer/index.tsx index c1e82a82d0..28324a0baf 100644 --- a/frontend/src/pages/TracesExplorer/index.tsx +++ b/frontend/src/pages/TracesExplorer/index.tsx @@ -4,7 +4,6 @@ import { FilterOutlined } from '@ant-design/icons'; import * as Sentry from '@sentry/react'; import { Button, Card, Tabs, Tooltip } from 'antd'; import logEvent from 'api/common/logEvent'; -import axios from 'axios'; import cx from 'classnames'; import ExplorerCard from 'components/ExplorerCard/ExplorerCard'; import QuickFilters from 'components/QuickFilters/QuickFilters'; @@ -19,13 +18,10 @@ import RightToolbarActions from 'container/QueryBuilder/components/ToolbarAction import DateTimeSelector from 'container/TopNav/DateTimeSelectionV2'; import { defaultSelectedColumns } from 'container/TracesExplorer/ListView/configs'; import QuerySection from 'container/TracesExplorer/QuerySection'; -import { useUpdateDashboard } from 'hooks/dashboard/useUpdateDashboard'; -import { addEmptyWidgetInDashboardJSONWithQuery } from 'hooks/dashboard/utils'; import { useGetPanelTypesQueryParam } from 'hooks/queryBuilder/useGetPanelTypesQueryParam'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl'; import { useHandleExplorerTabChange } from 'hooks/useHandleExplorerTabChange'; -import { useNotifications } from 'hooks/useNotifications'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import { cloneDeep, isEmpty, set } from 'lodash-es'; import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback'; @@ -40,8 +36,6 @@ import { ActionsWrapper, Container } from './styles'; import { getTabsItems } from './utils'; function TracesExplorer(): JSX.Element { - const { notifications } = useNotifications(); - const { currentQuery, panelType, @@ -124,9 +118,7 @@ function TracesExplorer(): JSX.Element { [currentQuery, updateAllQueriesOperators], ); - const { mutate: updateDashboard, isLoading } = useUpdateDashboard(); - - const getUpdatedQueryForExport = (): Query => { + const getUpdatedQueryForExport = useCallback((): Query => { const updatedQuery = cloneDeep(currentQuery); set( @@ -136,7 +128,7 @@ function TracesExplorer(): JSX.Element { ); return updatedQuery; - }; + }, [currentQuery, options.selectColumns]); const handleExport = useCallback( (dashboard: Dashboard | null, isNewDashboard?: boolean): void => { @@ -153,65 +145,22 @@ function TracesExplorer(): JSX.Element { ? getUpdatedQueryForExport() : exportDefaultQuery; - const updatedDashboard = addEmptyWidgetInDashboardJSONWithQuery( - dashboard, - query, - widgetId, - panelTypeParam, - options.selectColumns, - ); - logEvent('Traces Explorer: Add to dashboard successful', { panelType, isNewDashboard, dashboardName: dashboard?.data?.title, }); - updateDashboard(updatedDashboard, { - onSuccess: (data) => { - if (data.error) { - const message = - data.error === 'feature usage exceeded' ? ( - - Panel limit exceeded for {DataSource.TRACES} in community edition. - Please checkout our paid plans{' '} - - here - - - ) : ( - data.error - ); - notifications.error({ - message, - }); - - return; - } - const dashboardEditView = generateExportToDashboardLink({ - query, - panelType: panelTypeParam, - dashboardId: data.payload?.uuid || '', - widgetId, - }); - - safeNavigate(dashboardEditView); - }, - onError: (error) => { - if (axios.isAxiosError(error)) { - notifications.error({ - message: error.message, - }); - } - }, + const dashboardEditView = generateExportToDashboardLink({ + query, + panelType: panelTypeParam, + dashboardId: dashboard.id, + widgetId, }); + + safeNavigate(dashboardEditView); }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [exportDefaultQuery, notifications, panelType, updateDashboard], + [exportDefaultQuery, panelType, safeNavigate, getUpdatedQueryForExport], ); useShareBuilderUrl(defaultQuery); @@ -282,11 +231,7 @@ function TracesExplorer(): JSX.Element { - + diff --git a/frontend/src/providers/Dashboard/Dashboard.tsx b/frontend/src/providers/Dashboard/Dashboard.tsx index 4fa7c3be4b..745eabcc25 100644 --- a/frontend/src/providers/Dashboard/Dashboard.tsx +++ b/frontend/src/providers/Dashboard/Dashboard.tsx @@ -1,14 +1,12 @@ /* eslint-disable no-nested-ternary */ import { Modal } from 'antd'; -import getDashboard from 'api/dashboard/get'; -import lockDashboardApi from 'api/dashboard/lockDashboard'; -import unlockDashboardApi from 'api/dashboard/unlockDashboard'; +import getDashboard from 'api/v1/dashboards/id/get'; +import locked from 'api/v1/dashboards/id/lock'; import { REACT_QUERY_KEY } from 'constants/reactQueryKeys'; import ROUTES from 'constants/routes'; import { getMinMax } from 'container/TopNav/AutoRefresh/config'; import dayjs, { Dayjs } from 'dayjs'; import { useDashboardVariablesFromLocalStorage } from 'hooks/dashboard/useDashboardFromLocalStorage'; -import useAxiosError from 'hooks/useAxiosError'; import { useSafeNavigate } from 'hooks/useSafeNavigate'; import useTabVisibility from 'hooks/useTabFocus'; import useUrlQuery from 'hooks/useUrlQuery'; @@ -18,6 +16,7 @@ import isEqual from 'lodash-es/isEqual'; import isUndefined from 'lodash-es/isUndefined'; import omitBy from 'lodash-es/omitBy'; import { useAppContext } from 'providers/App/App'; +import { useErrorModal } from 'providers/ErrorModalProvider'; import { createContext, PropsWithChildren, @@ -36,7 +35,9 @@ import { Dispatch } from 'redux'; import { AppState } from 'store/reducers'; import AppActions from 'types/actions'; import { UPDATE_TIME_INTERVAL } from 'types/actions/globalTime'; +import { SuccessResponseV2 } from 'types/api'; import { Dashboard, IDashboardVariable } from 'types/api/dashboard/getAll'; +import APIError from 'types/api/error'; import { GlobalReducer } from 'types/reducer/globalTime'; import { v4 as generateUUID } from 'uuid'; @@ -52,7 +53,10 @@ const DashboardContext = createContext({ isDashboardLocked: false, handleToggleDashboardSlider: () => {}, handleDashboardLockToggle: () => {}, - dashboardResponse: {} as UseQueryResult, + dashboardResponse: {} as UseQueryResult< + SuccessResponseV2, + APIError + >, selectedDashboard: {} as Dashboard, dashboardId: '', layouts: [], @@ -116,6 +120,8 @@ export function DashboardProvider({ exact: true, }); + const { showErrorModal } = useErrorModal(); + // added extra checks here in case wrong values appear use the default values rather than empty dashboards const supportedOrderColumnKeys = ['createdAt', 'updatedAt']; @@ -270,18 +276,24 @@ export function DashboardProvider({ setIsDashboardFetching(true); try { return await getDashboard({ - uuid: dashboardId, + id: dashboardId, }); + } catch (error) { + showErrorModal(error as APIError); + return; } finally { setIsDashboardFetching(false); } }, refetchOnWindowFocus: false, - onSuccess: (data) => { - const updatedDashboardData = transformDashboardVariables(data); + onError: (error) => { + showErrorModal(error as APIError); + }, + onSuccess: (data: SuccessResponseV2) => { + const updatedDashboardData = transformDashboardVariables(data?.data); const updatedDate = dayjs(updatedDashboardData.updatedAt); - setIsDashboardLocked(updatedDashboardData?.isLocked || false); + setIsDashboardLocked(updatedDashboardData?.locked || false); // on first render if (updatedTimeRef.current === null) { @@ -387,29 +399,25 @@ export function DashboardProvider({ setIsDashboardSlider(value); }; - const handleError = useAxiosError(); - - const { mutate: lockDashboard } = useMutation(lockDashboardApi, { - onSuccess: () => { + const { mutate: lockDashboard } = useMutation(locked, { + onSuccess: (_, props) => { setIsDashboardSlider(false); - setIsDashboardLocked(true); + setIsDashboardLocked(props.lock); }, - onError: handleError, - }); - - const { mutate: unlockDashboard } = useMutation(unlockDashboardApi, { - onSuccess: () => { - setIsDashboardLocked(false); + onError: (error) => { + showErrorModal(error as APIError); }, - onError: handleError, }); const handleDashboardLockToggle = async (value: boolean): Promise => { if (selectedDashboard) { - if (value) { - lockDashboard(selectedDashboard); - } else { - unlockDashboard(selectedDashboard); + try { + await lockDashboard({ + id: selectedDashboard.id, + lock: value, + }); + } catch (error) { + showErrorModal(error as APIError); } } }; diff --git a/frontend/src/providers/Dashboard/types.ts b/frontend/src/providers/Dashboard/types.ts index 13ab53f8e8..e7ee7d9739 100644 --- a/frontend/src/providers/Dashboard/types.ts +++ b/frontend/src/providers/Dashboard/types.ts @@ -1,6 +1,7 @@ import dayjs from 'dayjs'; import { Layout } from 'react-grid-layout'; import { UseQueryResult } from 'react-query'; +import { SuccessResponseV2 } from 'types/api'; import { Dashboard } from 'types/api/dashboard/getAll'; export interface DashboardSortOrder { @@ -19,7 +20,7 @@ export interface IDashboardContext { isDashboardLocked: boolean; handleToggleDashboardSlider: (value: boolean) => void; handleDashboardLockToggle: (value: boolean) => void; - dashboardResponse: UseQueryResult; + dashboardResponse: UseQueryResult, unknown>; selectedDashboard: Dashboard | undefined; dashboardId: string; layouts: Layout[]; diff --git a/frontend/src/tests/test-utils.tsx b/frontend/src/tests/test-utils.tsx index f58b818ec0..c07ae853ee 100644 --- a/frontend/src/tests/test-utils.tsx +++ b/frontend/src/tests/test-utils.tsx @@ -243,7 +243,8 @@ export function getAppContextMock( ...appContextOverrides, }; } -function AllTheProviders({ + +export function AllTheProviders({ children, role, // Accept the role as a prop appContextOverrides, @@ -254,20 +255,19 @@ function AllTheProviders({ }): ReactElement { return ( - - - - + + + + - {/* Use the mock store with the provided role */} {children} - - - - + + + + ); } diff --git a/frontend/src/types/api/dashboard/create.ts b/frontend/src/types/api/dashboard/create.ts index b553ecd17b..1db418814d 100644 --- a/frontend/src/types/api/dashboard/create.ts +++ b/frontend/src/types/api/dashboard/create.ts @@ -1,11 +1,12 @@ -import { Dashboard, DashboardData } from './getAll'; +import { Dashboard } from './getAll'; -export type Props = - | { - title: Dashboard['data']['title']; - uploadedGrafana: boolean; - version?: string; - } - | { DashboardData: DashboardData; uploadedGrafana: boolean }; +export type Props = { + title: Dashboard['data']['title']; + uploadedGrafana: boolean; + version?: string; +}; -export type PayloadProps = Dashboard; +export interface PayloadProps { + data: Dashboard; + status: string; +} diff --git a/frontend/src/types/api/dashboard/delete.ts b/frontend/src/types/api/dashboard/delete.ts index 9bdc519b47..afad4087a5 100644 --- a/frontend/src/types/api/dashboard/delete.ts +++ b/frontend/src/types/api/dashboard/delete.ts @@ -1,9 +1,10 @@ import { Dashboard } from './getAll'; export type Props = { - uuid: Dashboard['uuid']; + id: Dashboard['id']; }; export interface PayloadProps { - status: 'success'; + status: string; + data: null; } diff --git a/frontend/src/types/api/dashboard/get.ts b/frontend/src/types/api/dashboard/get.ts index 2c440c2f02..37a7381021 100644 --- a/frontend/src/types/api/dashboard/get.ts +++ b/frontend/src/types/api/dashboard/get.ts @@ -1,7 +1,10 @@ import { Dashboard } from './getAll'; export type Props = { - uuid: Dashboard['uuid']; + id: Dashboard['id']; }; -export type PayloadProps = Dashboard; +export interface PayloadProps { + data: Dashboard; + status: string; +} diff --git a/frontend/src/types/api/dashboard/getAll.ts b/frontend/src/types/api/dashboard/getAll.ts index 2e6d883287..2115b94e82 100644 --- a/frontend/src/types/api/dashboard/getAll.ts +++ b/frontend/src/types/api/dashboard/getAll.ts @@ -9,8 +9,6 @@ import { Query } from 'types/api/queryBuilder/queryBuilderData'; import { IField } from '../logs/fields'; import { BaseAutocompleteData } from '../queryBuilder/queryAutocompleteResponse'; -export type PayloadProps = Dashboard[]; - export const VariableQueryTypeArr = ['QUERY', 'TEXTBOX', 'CUSTOM'] as const; export type TVariableQueryType = typeof VariableQueryTypeArr[number]; @@ -50,14 +48,18 @@ export interface IDashboardVariable { change?: boolean; } export interface Dashboard { - id: number; - uuid: string; + id: string; createdAt: string; updatedAt: string; createdBy: string; updatedBy: string; data: DashboardData; - isLocked?: boolean; + locked?: boolean; +} + +export interface PayloadProps { + data: Dashboard[]; + status: string; } export interface DashboardTemplate { @@ -69,7 +71,7 @@ export interface DashboardTemplate { } export interface DashboardData { - uuid?: string; + // uuid?: string; description?: string; tags?: string[]; name?: string; diff --git a/frontend/src/types/api/dashboard/lockUnlock.ts b/frontend/src/types/api/dashboard/lockUnlock.ts new file mode 100644 index 0000000000..06374c3aa7 --- /dev/null +++ b/frontend/src/types/api/dashboard/lockUnlock.ts @@ -0,0 +1,11 @@ +import { Dashboard } from './getAll'; + +export type Props = { + id: Dashboard['id']; + lock: boolean; +}; + +export interface PayloadProps { + data: null; + status: string; +} diff --git a/frontend/src/types/api/dashboard/update.ts b/frontend/src/types/api/dashboard/update.ts index 3839a84c88..38a481a876 100644 --- a/frontend/src/types/api/dashboard/update.ts +++ b/frontend/src/types/api/dashboard/update.ts @@ -1,8 +1,11 @@ import { Dashboard, DashboardData } from './getAll'; export type Props = { - uuid: Dashboard['uuid']; + id: Dashboard['id']; data: DashboardData; }; -export type PayloadProps = Dashboard; +export interface PayloadProps { + data: Dashboard; + status: string; +} diff --git a/frontend/src/types/api/licensesV3/getActive.ts b/frontend/src/types/api/licensesV3/getActive.ts index a26d766064..be0d488b5e 100644 --- a/frontend/src/types/api/licensesV3/getActive.ts +++ b/frontend/src/types/api/licensesV3/getActive.ts @@ -6,6 +6,7 @@ export enum LicenseEvent { export enum LicenseStatus { SUSPENDED = 'SUSPENDED', VALID = 'VALID', + INVALID = 'INVALID', } export enum LicenseState { diff --git a/go.mod b/go.mod index 6af7b55b7e..bbe8dc9ecd 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,6 @@ require ( github.com/gorilla/handlers v1.5.1 github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.0 - github.com/gosimple/slug v1.10.0 github.com/huandu/go-sqlbuilder v1.35.0 github.com/jackc/pgx/v5 v5.7.2 github.com/jmoiron/sqlx v1.3.4 @@ -138,7 +137,6 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect github.com/googleapis/gax-go/v2 v2.14.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect - github.com/gosimple/unidecode v1.0.0 // indirect github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index 03f23b73ff..0dfc703d7d 100644 --- a/go.sum +++ b/go.sum @@ -450,10 +450,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gosimple/slug v1.10.0 h1:3XbiQua1IpCdrvuntWvGBxVm+K99wCSxJjlxkP49GGQ= -github.com/gosimple/slug v1.10.0/go.mod h1:MICb3w495l9KNdZm+Xn5b6T2Hn831f9DMxiJ1r+bAjw= -github.com/gosimple/unidecode v1.0.0 h1:kPdvM+qy0tnk4/BrnkrbdJ82xe88xn7c9hcaipDz4dQ= -github.com/gosimple/unidecode v1.0.0/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= diff --git a/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore/config.go b/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore/config.go index 1175d9c369..c2bbc69876 100644 --- a/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore/config.go +++ b/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore/config.go @@ -67,23 +67,6 @@ func (store *config) Set(ctx context.Context, config *alertmanagertypes.Config, }, opts...) } -func (store *config) ListOrgs(ctx context.Context) ([]string, error) { - var orgIDs []string - - err := store. - sqlstore. - BunDB(). - NewSelect(). - Table("organizations"). - ColumnExpr("id"). - Scan(ctx, &orgIDs) - if err != nil { - return nil, err - } - - return orgIDs, nil -} - func (store *config) CreateChannel(ctx context.Context, channel *alertmanagertypes.Channel, opts ...alertmanagertypes.StoreOption) error { return store.wrap(ctx, func(ctx context.Context) error { if _, err := store. diff --git a/pkg/alertmanager/legacyalertmanager/provider.go b/pkg/alertmanager/legacyalertmanager/provider.go index b8fbba68e3..b4e1453b31 100644 --- a/pkg/alertmanager/legacyalertmanager/provider.go +++ b/pkg/alertmanager/legacyalertmanager/provider.go @@ -14,6 +14,7 @@ import ( "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerbatcher" "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore" "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types/alertmanagertypes" "github.com/SigNoz/signoz/pkg/valuer" @@ -57,16 +58,17 @@ type provider struct { configStore alertmanagertypes.ConfigStore batcher *alertmanagerbatcher.Batcher url *url.URL + orgGetter organization.Getter orgID string } -func NewFactory(sqlstore sqlstore.SQLStore) factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config] { +func NewFactory(sqlstore sqlstore.SQLStore, orgGetter organization.Getter) factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config] { return factory.NewProviderFactory(factory.MustNewName("legacy"), func(ctx context.Context, settings factory.ProviderSettings, config alertmanager.Config) (alertmanager.Alertmanager, error) { - return New(ctx, settings, config, sqlstore) + return New(ctx, settings, config, sqlstore, orgGetter) }) } -func New(ctx context.Context, providerSettings factory.ProviderSettings, config alertmanager.Config, sqlstore sqlstore.SQLStore) (*provider, error) { +func New(ctx context.Context, providerSettings factory.ProviderSettings, config alertmanager.Config, sqlstore sqlstore.SQLStore, orgGetter organization.Getter) (*provider, error) { settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/alertmanager/legacyalertmanager") configStore := sqlalertmanagerstore.NewConfigStore(sqlstore) @@ -92,7 +94,7 @@ func (provider *provider) Start(ctx context.Context) error { // For the first time, we need to get the orgID from the config store. // Since this is the legacy alertmanager, we get the first org from the store. if provider.orgID == "" { - orgIDs, err := provider.configStore.ListOrgs(ctx) + orgIDs, err := provider.orgGetter.ListByOwnedKeyRange(ctx) if err != nil { provider.settings.Logger().ErrorContext(ctx, "failed to send alerts to alertmanager", "error", err) continue @@ -103,7 +105,7 @@ func (provider *provider) Start(ctx context.Context) error { continue } - provider.orgID = orgIDs[0] + provider.orgID = orgIDs[0].ID.String() } if err := provider.putAlerts(ctx, provider.orgID, alerts); err != nil { diff --git a/pkg/alertmanager/service.go b/pkg/alertmanager/service.go index d8fdd74b28..c67c9e9edc 100644 --- a/pkg/alertmanager/service.go +++ b/pkg/alertmanager/service.go @@ -7,6 +7,7 @@ import ( "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/types/alertmanagertypes" ) @@ -20,6 +21,9 @@ type Service struct { // configStore is the config store for the alertmanager service configStore alertmanagertypes.ConfigStore + // organization is the organization module for the alertmanager service + orgGetter organization.Getter + // settings is the settings for the alertmanager service settings factory.ScopedProviderSettings @@ -30,11 +34,19 @@ type Service struct { serversMtx sync.RWMutex } -func New(ctx context.Context, settings factory.ScopedProviderSettings, config alertmanagerserver.Config, stateStore alertmanagertypes.StateStore, configStore alertmanagertypes.ConfigStore) *Service { +func New( + ctx context.Context, + settings factory.ScopedProviderSettings, + config alertmanagerserver.Config, + stateStore alertmanagertypes.StateStore, + configStore alertmanagertypes.ConfigStore, + orgGetter organization.Getter, +) *Service { service := &Service{ config: config, stateStore: stateStore, configStore: configStore, + orgGetter: orgGetter, settings: settings, servers: make(map[string]*alertmanagerserver.Server), serversMtx: sync.RWMutex{}, @@ -44,38 +56,38 @@ func New(ctx context.Context, settings factory.ScopedProviderSettings, config al } func (service *Service) SyncServers(ctx context.Context) error { - orgIDs, err := service.configStore.ListOrgs(ctx) + orgs, err := service.orgGetter.ListByOwnedKeyRange(ctx) if err != nil { return err } service.serversMtx.Lock() - for _, orgID := range orgIDs { - config, err := service.getConfig(ctx, orgID) + for _, org := range orgs { + config, err := service.getConfig(ctx, org.ID.StringValue()) if err != nil { - service.settings.Logger().ErrorContext(ctx, "failed to get alertmanager config for org", "org_id", orgID, "error", err) + service.settings.Logger().ErrorContext(ctx, "failed to get alertmanager config for org", "org_id", org.ID.StringValue(), "error", err) continue } // If the server is not present, create it and sync the config - if _, ok := service.servers[orgID]; !ok { - server, err := service.newServer(ctx, orgID) + if _, ok := service.servers[org.ID.StringValue()]; !ok { + server, err := service.newServer(ctx, org.ID.StringValue()) if err != nil { - service.settings.Logger().ErrorContext(ctx, "failed to create alertmanager server", "org_id", orgID, "error", err) + service.settings.Logger().ErrorContext(ctx, "failed to create alertmanager server", "org_id", org.ID.StringValue(), "error", err) continue } - service.servers[orgID] = server + service.servers[org.ID.StringValue()] = server } - if service.servers[orgID].Hash() == config.StoreableConfig().Hash { - service.settings.Logger().DebugContext(ctx, "skipping alertmanager sync for org", "org_id", orgID, "hash", config.StoreableConfig().Hash) + if service.servers[org.ID.StringValue()].Hash() == config.StoreableConfig().Hash { + service.settings.Logger().DebugContext(ctx, "skipping alertmanager sync for org", "org_id", org.ID.StringValue(), "hash", config.StoreableConfig().Hash) continue } - err = service.servers[orgID].SetConfig(ctx, config) + err = service.servers[org.ID.StringValue()].SetConfig(ctx, config) if err != nil { - service.settings.Logger().ErrorContext(ctx, "failed to set config for alertmanager server", "org_id", orgID, "error", err) + service.settings.Logger().ErrorContext(ctx, "failed to set config for alertmanager server", "org_id", org.ID.StringValue(), "error", err) continue } } diff --git a/pkg/alertmanager/signozalertmanager/provider.go b/pkg/alertmanager/signozalertmanager/provider.go index c0b285358f..8c3c0872ae 100644 --- a/pkg/alertmanager/signozalertmanager/provider.go +++ b/pkg/alertmanager/signozalertmanager/provider.go @@ -8,6 +8,7 @@ import ( "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerstore/sqlalertmanagerstore" "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types/alertmanagertypes" "github.com/SigNoz/signoz/pkg/valuer" @@ -22,13 +23,13 @@ type provider struct { stopC chan struct{} } -func NewFactory(sqlstore sqlstore.SQLStore) factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config] { +func NewFactory(sqlstore sqlstore.SQLStore, orgGetter organization.Getter) factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config] { return factory.NewProviderFactory(factory.MustNewName("signoz"), func(ctx context.Context, settings factory.ProviderSettings, config alertmanager.Config) (alertmanager.Alertmanager, error) { - return New(ctx, settings, config, sqlstore) + return New(ctx, settings, config, sqlstore, orgGetter) }) } -func New(ctx context.Context, providerSettings factory.ProviderSettings, config alertmanager.Config, sqlstore sqlstore.SQLStore) (*provider, error) { +func New(ctx context.Context, providerSettings factory.ProviderSettings, config alertmanager.Config, sqlstore sqlstore.SQLStore, orgGetter organization.Getter) (*provider, error) { settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager") configStore := sqlalertmanagerstore.NewConfigStore(sqlstore) stateStore := sqlalertmanagerstore.NewStateStore(sqlstore) @@ -40,6 +41,7 @@ func New(ctx context.Context, providerSettings factory.ProviderSettings, config config.Signoz.Config, stateStore, configStore, + orgGetter, ), settings: settings, config: config, diff --git a/pkg/http/middleware/api_key.go b/pkg/http/middleware/api_key.go index 01e1981bd7..0d53b736bc 100644 --- a/pkg/http/middleware/api_key.go +++ b/pkg/http/middleware/api_key.go @@ -5,9 +5,15 @@ import ( "net/http" "time" + "github.com/SigNoz/signoz/pkg/sharder" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +const ( + apiKeyCrossOrgMessage string = "::API-KEY-CROSS-ORG::" ) type APIKey struct { @@ -15,10 +21,11 @@ type APIKey struct { uuid *authtypes.UUID headers []string logger *slog.Logger + sharder sharder.Sharder } -func NewAPIKey(store sqlstore.SQLStore, headers []string, logger *slog.Logger) *APIKey { - return &APIKey{store: store, uuid: authtypes.NewUUID(), headers: headers, logger: logger} +func NewAPIKey(store sqlstore.SQLStore, headers []string, logger *slog.Logger, sharder sharder.Sharder) *APIKey { + return &APIKey{store: store, uuid: authtypes.NewUUID(), headers: headers, logger: logger, sharder: sharder} } func (a *APIKey) Wrap(next http.Handler) http.Handler { @@ -36,13 +43,20 @@ func (a *APIKey) Wrap(next http.Handler) http.Handler { next.ServeHTTP(w, r) return } + apiKeyToken, ok := authtypes.UUIDFromContext(ctx) if !ok { next.ServeHTTP(w, r) return } - err = a.store.BunDB().NewSelect().Model(&apiKey).Where("token = ?", apiKeyToken).Scan(r.Context()) + err = a. + store. + BunDB(). + NewSelect(). + Model(&apiKey). + Where("token = ?", apiKeyToken). + Scan(r.Context()) if err != nil { next.ServeHTTP(w, r) return @@ -71,6 +85,18 @@ func (a *APIKey) Wrap(next http.Handler) http.Handler { ctx = authtypes.NewContextWithClaims(ctx, jwt) + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + next.ServeHTTP(w, r) + return + } + + if err := a.sharder.IsMyOwnedKey(r.Context(), types.NewOrganizationKey(valuer.MustNewUUID(claims.OrgID))); err != nil { + a.logger.ErrorContext(r.Context(), apiKeyCrossOrgMessage, "claims", claims, "error", err) + next.ServeHTTP(w, r) + return + } + r = r.WithContext(ctx) next.ServeHTTP(w, r) diff --git a/pkg/http/middleware/auth.go b/pkg/http/middleware/auth.go index 491ccb93f1..8e6a4e3a03 100644 --- a/pkg/http/middleware/auth.go +++ b/pkg/http/middleware/auth.go @@ -1,18 +1,28 @@ package middleware import ( + "log/slog" "net/http" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +const ( + authCrossOrgMessage string = "::AUTH-CROSS-ORG::" ) type Auth struct { jwt *authtypes.JWT headers []string + sharder sharder.Sharder + logger *slog.Logger } -func NewAuth(jwt *authtypes.JWT, headers []string) *Auth { - return &Auth{jwt: jwt, headers: headers} +func NewAuth(jwt *authtypes.JWT, headers []string, sharder sharder.Sharder, logger *slog.Logger) *Auth { + return &Auth{jwt: jwt, headers: headers, sharder: sharder, logger: logger} } func (a *Auth) Wrap(next http.Handler) http.Handler { @@ -28,6 +38,18 @@ func (a *Auth) Wrap(next http.Handler) http.Handler { return } + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + next.ServeHTTP(w, r) + return + } + + if err := a.sharder.IsMyOwnedKey(r.Context(), types.NewOrganizationKey(valuer.MustNewUUID(claims.OrgID))); err != nil { + a.logger.ErrorContext(r.Context(), authCrossOrgMessage, "claims", claims, "error", err) + next.ServeHTTP(w, r) + return + } + r = r.WithContext(ctx) next.ServeHTTP(w, r) diff --git a/pkg/modules/apdex/apdex.go b/pkg/modules/apdex/apdex.go index 9b23334f36..ed618f0670 100644 --- a/pkg/modules/apdex/apdex.go +++ b/pkg/modules/apdex/apdex.go @@ -4,13 +4,13 @@ import ( "context" "net/http" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/apdextypes" ) type Module interface { - Get(context.Context, string, []string) ([]*types.ApdexSettings, error) + Get(context.Context, string, []string) ([]*apdextypes.Settings, error) - Set(context.Context, string, *types.ApdexSettings) error + Set(context.Context, string, *apdextypes.Settings) error } type Handler interface { diff --git a/pkg/modules/apdex/implapdex/handler.go b/pkg/modules/apdex/implapdex/handler.go index effa4c537d..38030cda70 100644 --- a/pkg/modules/apdex/implapdex/handler.go +++ b/pkg/modules/apdex/implapdex/handler.go @@ -9,7 +9,7 @@ import ( "github.com/SigNoz/signoz/pkg/http/render" "github.com/SigNoz/signoz/pkg/modules/apdex" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/apdextypes" "github.com/SigNoz/signoz/pkg/types/authtypes" ) @@ -31,7 +31,7 @@ func (handler *handler) Set(rw http.ResponseWriter, req *http.Request) { return } - var apdexSettings types.ApdexSettings + var apdexSettings apdextypes.Settings if err := json.NewDecoder(req.Body).Decode(&apdexSettings); err != nil { render.Error(rw, err) return diff --git a/pkg/modules/apdex/implapdex/module.go b/pkg/modules/apdex/implapdex/module.go index 9eaa86048c..3012e4ba36 100644 --- a/pkg/modules/apdex/implapdex/module.go +++ b/pkg/modules/apdex/implapdex/module.go @@ -6,7 +6,7 @@ import ( "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/modules/apdex" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/apdextypes" "github.com/SigNoz/signoz/pkg/valuer" "github.com/uptrace/bun" ) @@ -25,8 +25,8 @@ func NewModule(sqlstore sqlstore.SQLStore) apdex.Module { } } -func (module *module) Get(ctx context.Context, orgID string, services []string) ([]*types.ApdexSettings, error) { - var apdexSettings []*types.ApdexSettings +func (module *module) Get(ctx context.Context, orgID string, services []string) ([]*apdextypes.Settings, error) { + var apdexSettings []*apdextypes.Settings err := module. sqlstore. @@ -51,7 +51,7 @@ func (module *module) Get(ctx context.Context, orgID string, services []string) } if !found { - apdexSettings = append(apdexSettings, &types.ApdexSettings{ + apdexSettings = append(apdexSettings, &apdextypes.Settings{ ServiceName: service, Threshold: defaultApdexThreshold, }) @@ -61,7 +61,7 @@ func (module *module) Get(ctx context.Context, orgID string, services []string) return apdexSettings, nil } -func (module *module) Set(ctx context.Context, orgID string, apdexSettings *types.ApdexSettings) error { +func (module *module) Set(ctx context.Context, orgID string, apdexSettings *apdextypes.Settings) error { apdexSettings.OrgID = orgID apdexSettings.Identifiable.ID = valuer.GenerateUUID() diff --git a/pkg/modules/dashboard/dashboard.go b/pkg/modules/dashboard/dashboard.go index 9463ddfea9..d8ee841f80 100644 --- a/pkg/modules/dashboard/dashboard.go +++ b/pkg/modules/dashboard/dashboard.go @@ -4,25 +4,32 @@ import ( "context" "net/http" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" + "github.com/SigNoz/signoz/pkg/valuer" ) type Module interface { - Create(ctx context.Context, orgID string, email string, data map[string]interface{}) (*types.Dashboard, error) + Create(ctx context.Context, orgID valuer.UUID, createdBy string, data dashboardtypes.PostableDashboard) (*dashboardtypes.Dashboard, error) - List(ctx context.Context, orgID string) ([]*types.Dashboard, error) + Get(ctx context.Context, orgID valuer.UUID, id valuer.UUID) (*dashboardtypes.Dashboard, error) - Delete(ctx context.Context, orgID, uuid string) error + List(ctx context.Context, orgID valuer.UUID) ([]*dashboardtypes.Dashboard, error) - Get(ctx context.Context, orgID, uuid string) (*types.Dashboard, error) + Update(ctx context.Context, orgID valuer.UUID, id valuer.UUID, updatedBy string, data dashboardtypes.UpdatableDashboard) (*dashboardtypes.Dashboard, error) - GetByMetricNames(ctx context.Context, orgID string, metricNames []string) (map[string][]map[string]string, error) + LockUnlock(ctx context.Context, orgID valuer.UUID, id valuer.UUID, updatedBy string, lock bool) error - Update(ctx context.Context, orgID, userEmail, uuid string, data map[string]interface{}) (*types.Dashboard, error) + Delete(ctx context.Context, orgID valuer.UUID, id valuer.UUID) error - LockUnlock(ctx context.Context, orgID, uuid string, lock bool) error + GetByMetricNames(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string][]map[string]string, error) } type Handler interface { + Create(http.ResponseWriter, *http.Request) + + Update(http.ResponseWriter, *http.Request) + + LockUnlock(http.ResponseWriter, *http.Request) + Delete(http.ResponseWriter, *http.Request) } diff --git a/pkg/modules/dashboard/impldashboard/handler.go b/pkg/modules/dashboard/impldashboard/handler.go index b5ab1ada09..449cc228ea 100644 --- a/pkg/modules/dashboard/impldashboard/handler.go +++ b/pkg/modules/dashboard/impldashboard/handler.go @@ -2,12 +2,16 @@ package impldashboard import ( "context" + "encoding/json" "net/http" "time" + "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/http/render" "github.com/SigNoz/signoz/pkg/modules/dashboard" "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" + "github.com/SigNoz/signoz/pkg/valuer" "github.com/gorilla/mux" ) @@ -19,8 +23,8 @@ func NewHandler(module dashboard.Module) dashboard.Handler { return &handler{module: module} } -func (handler *handler) Delete(rw http.ResponseWriter, req *http.Request) { - ctx, cancel := context.WithTimeout(req.Context(), 10*time.Second) +func (handler *handler) Create(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) defer cancel() claims, err := authtypes.ClaimsFromContext(ctx) @@ -29,13 +33,151 @@ func (handler *handler) Delete(rw http.ResponseWriter, req *http.Request) { return } - uuid := mux.Vars(req)["uuid"] + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } - err = handler.module.Delete(ctx, claims.OrgID, uuid) + req := dashboardtypes.PostableDashboard{} + err = json.NewDecoder(r.Body).Decode(&req) + if err != nil { + render.Error(rw, err) + return + } + + dashboard, err := handler.module.Create(ctx, orgID, claims.Email, req) + if err != nil { + render.Error(rw, err) + return + } + + gettableDashboard, err := dashboardtypes.NewGettableDashboardFromDashboard(dashboard) + if err != nil { + render.Error(rw, err) + return + } + + render.Success(rw, http.StatusCreated, gettableDashboard) +} + +func (handler *handler) Update(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + render.Error(rw, err) + return + } + + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } + + id := mux.Vars(r)["id"] + if id == "" { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "id is missing in the path")) + return + } + dashboardID, err := valuer.NewUUID(id) + if err != nil { + render.Error(rw, err) + return + } + + req := dashboardtypes.UpdatableDashboard{} + err = json.NewDecoder(r.Body).Decode(&req) + if err != nil { + render.Error(rw, err) + return + } + + dashboard, err := handler.module.Update(ctx, orgID, dashboardID, claims.Email, req) + if err != nil { + render.Error(rw, err) + return + } + + render.Success(rw, http.StatusOK, dashboard) +} + +func (handler *handler) LockUnlock(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + render.Error(rw, err) + return + } + + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } + + id := mux.Vars(r)["id"] + if id == "" { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "id is missing in the path")) + return + } + dashboardID, err := valuer.NewUUID(id) + if err != nil { + render.Error(rw, err) + return + } + + req := new(dashboardtypes.LockUnlockDashboard) + err = json.NewDecoder(r.Body).Decode(req) + if err != nil { + render.Error(rw, err) + return + } + + err = handler.module.LockUnlock(ctx, orgID, dashboardID, claims.Email, *req.Locked) if err != nil { render.Error(rw, err) return } render.Success(rw, http.StatusOK, nil) + +} + +func (handler *handler) Delete(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + render.Error(rw, err) + return + } + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } + + id := mux.Vars(r)["id"] + if id == "" { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "id is missing in the path")) + return + } + dashboardID, err := valuer.NewUUID(id) + if err != nil { + render.Error(rw, err) + return + } + err = handler.module.Delete(ctx, orgID, dashboardID) + if err != nil { + render.Error(rw, err) + return + } + + render.Success(rw, http.StatusNoContent, nil) } diff --git a/pkg/modules/dashboard/impldashboard/module.go b/pkg/modules/dashboard/impldashboard/module.go index 174ddcd096..83ed50a6b3 100644 --- a/pkg/modules/dashboard/impldashboard/module.go +++ b/pkg/modules/dashboard/impldashboard/module.go @@ -2,164 +2,40 @@ package impldashboard import ( "context" - "encoding/json" "strings" - "time" "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/modules/dashboard" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" - "github.com/google/uuid" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" + "github.com/SigNoz/signoz/pkg/valuer" ) type module struct { - sqlstore sqlstore.SQLStore + store dashboardtypes.Store + settings factory.ScopedProviderSettings } -func NewModule(sqlstore sqlstore.SQLStore) dashboard.Module { +func NewModule(sqlstore sqlstore.SQLStore, settings factory.ProviderSettings) dashboard.Module { + scopedProviderSettings := factory.NewScopedProviderSettings(settings, "github.com/SigNoz/signoz/pkg/modules/impldashboard") return &module{ - sqlstore: sqlstore, + store: NewStore(sqlstore), + settings: scopedProviderSettings, } } -// CreateDashboard creates a new dashboard -func (module *module) Create(ctx context.Context, orgID string, email string, data map[string]interface{}) (*types.Dashboard, error) { - dash := &types.Dashboard{ - Data: data, - } - - dash.OrgID = orgID - dash.CreatedAt = time.Now() - dash.CreatedBy = email - dash.UpdatedAt = time.Now() - dash.UpdatedBy = email - dash.UpdateSlug() - dash.UUID = uuid.New().String() - if data["uuid"] != nil { - dash.UUID = data["uuid"].(string) - } - - err := module. - sqlstore. - BunDB(). - NewInsert(). - Model(dash). - Returning("id"). - Scan(ctx, &dash.ID) - if err != nil { - return nil, module.sqlstore.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "dashboard with uuid %s already exists", dash.UUID) - } - - return dash, nil -} - -func (module *module) List(ctx context.Context, orgID string) ([]*types.Dashboard, error) { - dashboards := []*types.Dashboard{} - - err := module. - sqlstore. - BunDB(). - NewSelect(). - Model(&dashboards). - Where("org_id = ?", orgID). - Scan(ctx) +func (module *module) Create(ctx context.Context, orgID valuer.UUID, createdBy string, postableDashboard dashboardtypes.PostableDashboard) (*dashboardtypes.Dashboard, error) { + dashboard, err := dashboardtypes.NewDashboard(orgID, createdBy, postableDashboard) if err != nil { return nil, err } - return dashboards, nil -} - -func (module *module) Delete(ctx context.Context, orgID, uuid string) error { - dashboard, err := module.Get(ctx, orgID, uuid) - if err != nil { - return err - } - - if dashboard.Locked != nil && *dashboard.Locked == 1 { - return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "dashboard is locked, please unlock the dashboard to be able to delete it") - } - - result, err := module. - sqlstore. - BunDB(). - NewDelete(). - Model(&types.Dashboard{}). - Where("org_id = ?", orgID). - Where("uuid = ?", uuid). - Exec(ctx) - if err != nil { - return err - } - - affectedRows, err := result.RowsAffected() - if err != nil { - return err - } - - if affectedRows == 0 { - return errors.Newf(errors.TypeNotFound, errors.CodeNotFound, "no dashboard found with uuid: %s", uuid) - } - - return nil -} - -func (module *module) Get(ctx context.Context, orgID, uuid string) (*types.Dashboard, error) { - dashboard := types.Dashboard{} - err := module. - sqlstore. - BunDB(). - NewSelect(). - Model(&dashboard). - Where("org_id = ?", orgID). - Where("uuid = ?", uuid). - Scan(ctx) - if err != nil { - return nil, module.sqlstore.WrapNotFoundErrf(err, errors.CodeNotFound, "dashboard with uuid %s not found", uuid) - } - - return &dashboard, nil -} - -func (module *module) Update(ctx context.Context, orgID, userEmail, uuid string, data map[string]interface{}) (*types.Dashboard, error) { - mapData, err := json.Marshal(data) + storableDashboard, err := dashboardtypes.NewStorableDashboardFromDashboard(dashboard) if err != nil { return nil, err } - - dashboard, err := module.Get(ctx, orgID, uuid) - if err != nil { - return nil, err - } - - if dashboard.Locked != nil && *dashboard.Locked == 1 { - return nil, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "dashboard is locked, please unlock the dashboard to be able to edit it") - } - - // if the total count of panels has reduced by more than 1, - // return error - existingIds := getWidgetIds(dashboard.Data) - newIds := getWidgetIds(data) - - differenceIds := getIdDifference(existingIds, newIds) - - if len(differenceIds) > 1 { - return nil, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "deleting more than one panel is not supported") - } - - dashboard.UpdatedAt = time.Now() - dashboard.UpdatedBy = userEmail - dashboard.Data = data - - _, err = module.sqlstore. - BunDB(). - NewUpdate(). - Model(dashboard). - Set("updated_at = ?", dashboard.UpdatedAt). - Set("updated_by = ?", userEmail). - Set("data = ?", mapData). - Where("uuid = ?", dashboard.UUID).Exec(ctx) + err = module.store.Create(ctx, storableDashboard) if err != nil { return nil, err } @@ -167,28 +43,73 @@ func (module *module) Update(ctx context.Context, orgID, userEmail, uuid string, return dashboard, nil } -func (module *module) LockUnlock(ctx context.Context, orgID, uuid string, lock bool) error { - dashboard, err := module.Get(ctx, orgID, uuid) +func (module *module) Get(ctx context.Context, orgID valuer.UUID, id valuer.UUID) (*dashboardtypes.Dashboard, error) { + storableDashboard, err := module.store.Get(ctx, orgID, id) + if err != nil { + return nil, err + } + + dashboard, err := dashboardtypes.NewDashboardFromStorableDashboard(storableDashboard) + if err != nil { + return nil, err + } + return dashboard, nil +} + +func (module *module) List(ctx context.Context, orgID valuer.UUID) ([]*dashboardtypes.Dashboard, error) { + storableDashboards, err := module.store.List(ctx, orgID) + if err != nil { + return nil, err + } + + dashboards, err := dashboardtypes.NewDashboardsFromStorableDashboards(storableDashboards) + if err != nil { + return nil, err + } + + return dashboards, nil +} + +func (module *module) Update(ctx context.Context, orgID valuer.UUID, id valuer.UUID, updatedBy string, updatableDashboard dashboardtypes.UpdatableDashboard) (*dashboardtypes.Dashboard, error) { + dashboard, err := module.Get(ctx, orgID, id) + if err != nil { + return nil, err + } + + err = dashboard.Update(updatableDashboard, updatedBy) + if err != nil { + return nil, err + } + + storableDashboard, err := dashboardtypes.NewStorableDashboardFromDashboard(dashboard) + if err != nil { + return nil, err + } + + err = module.store.Update(ctx, orgID, storableDashboard) + if err != nil { + return nil, err + } + + return dashboard, nil +} + +func (module *module) LockUnlock(ctx context.Context, orgID valuer.UUID, id valuer.UUID, updatedBy string, lock bool) error { + dashboard, err := module.Get(ctx, orgID, id) if err != nil { return err } - var lockValue int - if lock { - lockValue = 1 - } else { - lockValue = 0 + err = dashboard.LockUnlock(ctx, lock, updatedBy) + if err != nil { + return err + } + storableDashboard, err := dashboardtypes.NewStorableDashboardFromDashboard(dashboard) + if err != nil { + return err } - _, err = module. - sqlstore. - BunDB(). - NewUpdate(). - Model(dashboard). - Set("locked = ?", lockValue). - Where("org_id = ?", orgID). - Where("uuid = ?", uuid). - Exec(ctx) + err = module.store.Update(ctx, orgID, storableDashboard) if err != nil { return err } @@ -196,15 +117,21 @@ func (module *module) LockUnlock(ctx context.Context, orgID, uuid string, lock b return nil } -func (module *module) GetByMetricNames(ctx context.Context, orgID string, metricNames []string) (map[string][]map[string]string, error) { - dashboards := []types.Dashboard{} - err := module. - sqlstore. - BunDB(). - NewSelect(). - Model(&dashboards). - Where("org_id = ?", orgID). - Scan(ctx) +func (module *module) Delete(ctx context.Context, orgID valuer.UUID, id valuer.UUID) error { + dashboard, err := module.Get(ctx, orgID, id) + if err != nil { + return err + } + + if dashboard.Locked { + return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "dashboard is locked, please unlock the dashboard to be delete it") + } + + return module.store.Delete(ctx, orgID, id) +} + +func (module *module) GetByMetricNames(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string][]map[string]string, error) { + dashboards, err := module.List(ctx, orgID) if err != nil { return nil, err } @@ -266,7 +193,7 @@ func (module *module) GetByMetricNames(ctx context.Context, orgID string, metric for _, metricName := range metricNames { if strings.TrimSpace(key) == metricName { result[metricName] = append(result[metricName], map[string]string{ - "dashboard_id": dashboard.UUID, + "dashboard_id": dashboard.ID, "widget_name": widgetTitle, "widget_id": widgetID, "dashboard_name": dashTitle, @@ -280,52 +207,3 @@ func (module *module) GetByMetricNames(ctx context.Context, orgID string, metric return result, nil } - -func getWidgetIds(data map[string]interface{}) []string { - widgetIds := []string{} - if data != nil && data["widgets"] != nil { - widgets, ok := data["widgets"] - if ok { - data, ok := widgets.([]interface{}) - if ok { - for _, widget := range data { - sData, ok := widget.(map[string]interface{}) - if ok && sData["query"] != nil && sData["id"] != nil { - id, ok := sData["id"].(string) - - if ok { - widgetIds = append(widgetIds, id) - } - - } - } - } - } - } - return widgetIds -} - -func getIdDifference(existingIds []string, newIds []string) []string { - // Convert newIds array to a map for faster lookups - newIdsMap := make(map[string]bool) - for _, id := range newIds { - newIdsMap[id] = true - } - - // Initialize a map to keep track of elements in the difference array - differenceMap := make(map[string]bool) - - // Initialize the difference array - difference := []string{} - - // Iterate through existingIds - for _, id := range existingIds { - // If the id is not found in newIds, and it's not already in the difference array - if _, found := newIdsMap[id]; !found && !differenceMap[id] { - difference = append(difference, id) - differenceMap[id] = true // Mark the id as seen in the difference array - } - } - - return difference -} diff --git a/pkg/modules/dashboard/impldashboard/store.go b/pkg/modules/dashboard/impldashboard/store.go new file mode 100644 index 0000000000..1b449d0cc7 --- /dev/null +++ b/pkg/modules/dashboard/impldashboard/store.go @@ -0,0 +1,99 @@ +package impldashboard + +import ( + "context" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/sqlstore" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type store struct { + sqlstore sqlstore.SQLStore +} + +func NewStore(sqlstore sqlstore.SQLStore) dashboardtypes.Store { + return &store{sqlstore: sqlstore} +} + +func (store *store) Create(ctx context.Context, storabledashboard *dashboardtypes.StorableDashboard) error { + _, err := store. + sqlstore. + BunDB(). + NewInsert(). + Model(storabledashboard). + Exec(ctx) + if err != nil { + return store.sqlstore.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "dashboard with id %s already exists", storabledashboard.ID) + } + + return nil +} + +func (store *store) Get(ctx context.Context, orgID valuer.UUID, id valuer.UUID) (*dashboardtypes.StorableDashboard, error) { + storableDashboard := new(dashboardtypes.StorableDashboard) + + err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(storableDashboard). + Where("id = ?", id). + Where("org_id = ?", orgID). + Scan(ctx) + if err != nil { + return nil, store.sqlstore.WrapNotFoundErrf(err, errors.CodeNotFound, "dashboard with id %s doesn't exist", id) + } + + return storableDashboard, nil +} + +func (store *store) List(ctx context.Context, orgID valuer.UUID) ([]*dashboardtypes.StorableDashboard, error) { + storableDashboards := make([]*dashboardtypes.StorableDashboard, 0) + + err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(&storableDashboards). + Where("org_id = ?", orgID). + Scan(ctx) + if err != nil { + return nil, store.sqlstore.WrapNotFoundErrf(err, errors.CodeNotFound, "no dashboards found in orgID %s", orgID) + } + + return storableDashboards, nil +} + +func (store *store) Update(ctx context.Context, orgID valuer.UUID, storableDashboard *dashboardtypes.StorableDashboard) error { + _, err := store. + sqlstore. + BunDB(). + NewUpdate(). + Model(storableDashboard). + WherePK(). + Where("org_id = ?", orgID). + Exec(ctx) + if err != nil { + return store.sqlstore.WrapNotFoundErrf(err, errors.CodeAlreadyExists, "dashboard with id %s doesn't exist", storableDashboard.ID) + } + + return nil +} + +func (store *store) Delete(ctx context.Context, orgID valuer.UUID, id valuer.UUID) error { + _, err := store. + sqlstore. + BunDB(). + NewDelete(). + Model(new(dashboardtypes.StorableDashboard)). + Where("id = ?", id). + Where("org_id = ?", orgID). + Exec(ctx) + if err != nil { + return store.sqlstore.WrapNotFoundErrf(err, errors.CodeNotFound, "dashboard with id %s doesn't exist", id) + } + + return nil +} diff --git a/pkg/modules/organization/implorganization/getter.go b/pkg/modules/organization/implorganization/getter.go new file mode 100644 index 0000000000..78c684ece3 --- /dev/null +++ b/pkg/modules/organization/implorganization/getter.go @@ -0,0 +1,36 @@ +package implorganization + +import ( + "context" + + "github.com/SigNoz/signoz/pkg/modules/organization" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type getter struct { + store types.OrganizationStore + sharder sharder.Sharder +} + +func NewGetter(store types.OrganizationStore, sharder sharder.Sharder) organization.Getter { + return &getter{store: store, sharder: sharder} +} + +func (module *getter) Get(ctx context.Context, id valuer.UUID) (*types.Organization, error) { + return module.store.Get(ctx, id) +} + +func (module *getter) List(ctx context.Context) ([]*types.Organization, error) { + return module.store.GetAll(ctx) +} + +func (module *getter) ListByOwnedKeyRange(ctx context.Context) ([]*types.Organization, error) { + start, end, err := module.sharder.GetMyOwnedKeyRange(ctx) + if err != nil { + return nil, err + } + + return module.store.ListByKeyRange(ctx, start, end) +} diff --git a/pkg/modules/organization/implorganization/handler.go b/pkg/modules/organization/implorganization/handler.go index 9c5ca484ed..ab3efc7fe9 100644 --- a/pkg/modules/organization/implorganization/handler.go +++ b/pkg/modules/organization/implorganization/handler.go @@ -15,11 +15,12 @@ import ( ) type handler struct { - module organization.Module + orgGetter organization.Getter + orgSetter organization.Setter } -func NewHandler(module organization.Module) organization.Handler { - return &handler{module: module} +func NewHandler(orgGetter organization.Getter, orgSetter organization.Setter) organization.Handler { + return &handler{orgGetter: orgGetter, orgSetter: orgSetter} } func (handler *handler) Get(rw http.ResponseWriter, r *http.Request) { @@ -38,7 +39,7 @@ func (handler *handler) Get(rw http.ResponseWriter, r *http.Request) { return } - organization, err := handler.module.Get(ctx, orgID) + organization, err := handler.orgGetter.Get(ctx, orgID) if err != nil { render.Error(rw, err) return @@ -67,10 +68,11 @@ func (handler *handler) Update(rw http.ResponseWriter, r *http.Request) { err = json.NewDecoder(r.Body).Decode(&req) if err != nil { render.Error(rw, err) + return } req.ID = orgID - err = handler.module.Update(ctx, req) + err = handler.orgSetter.Update(ctx, req) if err != nil { render.Error(rw, err) return diff --git a/pkg/modules/organization/implorganization/module.go b/pkg/modules/organization/implorganization/module.go deleted file mode 100644 index 27fe2f1e6f..0000000000 --- a/pkg/modules/organization/implorganization/module.go +++ /dev/null @@ -1,33 +0,0 @@ -package implorganization - -import ( - "context" - - "github.com/SigNoz/signoz/pkg/modules/organization" - "github.com/SigNoz/signoz/pkg/types" - "github.com/SigNoz/signoz/pkg/valuer" -) - -type module struct { - store types.OrganizationStore -} - -func NewModule(organizationStore types.OrganizationStore) organization.Module { - return &module{store: organizationStore} -} - -func (module *module) Create(ctx context.Context, organization *types.Organization) error { - return module.store.Create(ctx, organization) -} - -func (module *module) Get(ctx context.Context, id valuer.UUID) (*types.Organization, error) { - return module.store.Get(ctx, id) -} - -func (module *module) GetAll(ctx context.Context) ([]*types.Organization, error) { - return module.store.GetAll(ctx) -} - -func (module *module) Update(ctx context.Context, updatedOrganization *types.Organization) error { - return module.store.Update(ctx, updatedOrganization) -} diff --git a/pkg/modules/organization/implorganization/setter.go b/pkg/modules/organization/implorganization/setter.go new file mode 100644 index 0000000000..693d4a3aab --- /dev/null +++ b/pkg/modules/organization/implorganization/setter.go @@ -0,0 +1,40 @@ +package implorganization + +import ( + "context" + + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/modules/organization" + "github.com/SigNoz/signoz/pkg/modules/quickfilter" + "github.com/SigNoz/signoz/pkg/types" +) + +type setter struct { + store types.OrganizationStore + alertmanager alertmanager.Alertmanager + quickfilter quickfilter.Module +} + +func NewSetter(store types.OrganizationStore, alertmanager alertmanager.Alertmanager, quickfilter quickfilter.Module) organization.Setter { + return &setter{store: store, alertmanager: alertmanager, quickfilter: quickfilter} +} + +func (module *setter) Create(ctx context.Context, organization *types.Organization) error { + if err := module.store.Create(ctx, organization); err != nil { + return err + } + + if err := module.alertmanager.SetDefaultConfig(ctx, organization.ID.StringValue()); err != nil { + return err + } + + if err := module.quickfilter.SetDefaultConfig(ctx, organization.ID); err != nil { + return err + } + + return nil +} + +func (module *setter) Update(ctx context.Context, updatedOrganization *types.Organization) error { + return module.store.Update(ctx, updatedOrganization) +} diff --git a/pkg/modules/organization/implorganization/store.go b/pkg/modules/organization/implorganization/store.go index ec33cd04bd..6acd247dc5 100644 --- a/pkg/modules/organization/implorganization/store.go +++ b/pkg/modules/organization/implorganization/store.go @@ -92,3 +92,20 @@ func (store *store) Delete(ctx context.Context, id valuer.UUID) error { return nil } + +func (store *store) ListByKeyRange(ctx context.Context, start, end uint32) ([]*types.Organization, error) { + organizations := make([]*types.Organization, 0) + err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(&organizations). + Where("key >= ?", start). + Where("key <= ?", end). + Scan(ctx) + if err != nil { + return nil, err + } + + return organizations, nil +} diff --git a/pkg/modules/organization/organization.go b/pkg/modules/organization/organization.go index 00ba48f95d..a48ef682d6 100644 --- a/pkg/modules/organization/organization.go +++ b/pkg/modules/organization/organization.go @@ -8,17 +8,22 @@ import ( "github.com/SigNoz/signoz/pkg/valuer" ) -type Module interface { - // Create creates the given organization - Create(context.Context, *types.Organization) error - +type Getter interface { // Get gets the organization based on the given id Get(context.Context, valuer.UUID) (*types.Organization, error) - // GetAll gets all the organizations - GetAll(context.Context) ([]*types.Organization, error) + // Lists all the organizations + List(context.Context) ([]*types.Organization, error) - // Update updates the given organization based on id present + // ListByOwnedKeyRange gets all the organizations owned by the instance + ListByOwnedKeyRange(context.Context) ([]*types.Organization, error) +} + +type Setter interface { + // Create creates the given organization + Create(context.Context, *types.Organization) error + + // Update updates the given organization Update(context.Context, *types.Organization) error } diff --git a/pkg/modules/tracefunnel/impltracefunnel/handler.go b/pkg/modules/tracefunnel/impltracefunnel/handler.go new file mode 100644 index 0000000000..09f4dfe269 --- /dev/null +++ b/pkg/modules/tracefunnel/impltracefunnel/handler.go @@ -0,0 +1,235 @@ +package impltracefunnel + +import ( + "encoding/json" + "net/http" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/http/render" + "github.com/SigNoz/signoz/pkg/modules/tracefunnel" + "github.com/SigNoz/signoz/pkg/types/authtypes" + tf "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/gorilla/mux" +) + +type handler struct { + module tracefunnel.Module +} + +func NewHandler(module tracefunnel.Module) tracefunnel.Handler { + return &handler{module: module} +} + +func (handler *handler) New(rw http.ResponseWriter, r *http.Request) { + var req tf.PostableFunnel + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + render.Error(rw, err) + return + } + + claims, err := authtypes.ClaimsFromContext(r.Context()) + if err != nil { + render.Error(rw, err) + return + } + + funnel, err := handler.module.Create(r.Context(), req.Timestamp, req.Name, valuer.MustNewUUID(claims.UserID), valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to create funnel: %v", err)) + return + } + + response := tf.ConstructFunnelResponse(funnel, &claims) + render.Success(rw, http.StatusOK, response) +} + +func (handler *handler) UpdateSteps(rw http.ResponseWriter, r *http.Request) { + var req tf.PostableFunnel + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + render.Error(rw, err) + return + } + + claims, err := authtypes.ClaimsFromContext(r.Context()) + if err != nil { + render.Error(rw, err) + return + } + + updatedAt, err := tf.ValidateAndConvertTimestamp(req.Timestamp) + if err != nil { + render.Error(rw, err) + return + } + + funnel, err := handler.module.Get(r.Context(), req.FunnelID, valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "funnel not found: %v", err)) + return + } + + steps, err := tf.ProcessFunnelSteps(req.Steps) + if err != nil { + render.Error(rw, err) + return + } + + funnel.Steps = steps + funnel.UpdatedAt = updatedAt + funnel.UpdatedBy = claims.UserID + + if req.Name != "" { + funnel.Name = req.Name + } + if req.Description != "" { + funnel.Description = req.Description + } + + if err := handler.module.Update(r.Context(), funnel, valuer.MustNewUUID(claims.UserID)); err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to update funnel in database: %v", err)) + return + } + + updatedFunnel, err := handler.module.Get(r.Context(), funnel.ID, valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to get updated funnel: %v", err)) + return + } + + response := tf.ConstructFunnelResponse(updatedFunnel, &claims) + render.Success(rw, http.StatusOK, response) +} + +func (handler *handler) UpdateFunnel(rw http.ResponseWriter, r *http.Request) { + var req tf.PostableFunnel + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + render.Error(rw, err) + return + } + + claims, err := authtypes.ClaimsFromContext(r.Context()) + if err != nil { + render.Error(rw, err) + return + } + + updatedAt, err := tf.ValidateAndConvertTimestamp(req.Timestamp) + if err != nil { + render.Error(rw, err) + return + } + + vars := mux.Vars(r) + funnelID := vars["funnel_id"] + + funnel, err := handler.module.Get(r.Context(), valuer.MustNewUUID(funnelID), valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "funnel not found: %v", err)) + return + } + + funnel.UpdatedAt = updatedAt + funnel.UpdatedBy = claims.UserID + + if req.Name != "" { + funnel.Name = req.Name + } + if req.Description != "" { + funnel.Description = req.Description + } + + if err := handler.module.Update(r.Context(), funnel, valuer.MustNewUUID(claims.UserID)); err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to update funnel in database: %v", err)) + return + } + + updatedFunnel, err := handler.module.Get(r.Context(), funnel.ID, valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to get updated funnel: %v", err)) + return + } + + response := tf.ConstructFunnelResponse(updatedFunnel, &claims) + render.Success(rw, http.StatusOK, response) +} + +func (handler *handler) List(rw http.ResponseWriter, r *http.Request) { + claims, err := authtypes.ClaimsFromContext(r.Context()) + if err != nil { + render.Error(rw, err) + return + } + + funnels, err := handler.module.List(r.Context(), valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to list funnels: %v", err)) + return + } + + var response []tf.GettableFunnel + for _, f := range funnels { + response = append(response, tf.ConstructFunnelResponse(f, &claims)) + } + + render.Success(rw, http.StatusOK, response) +} + +func (handler *handler) Get(rw http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + funnelID := vars["funnel_id"] + + claims, err := authtypes.ClaimsFromContext(r.Context()) + + if err != nil { + render.Error(rw, err) + return + } + + funnel, err := handler.module.Get(r.Context(), valuer.MustNewUUID(funnelID), valuer.MustNewUUID(claims.OrgID)) + if err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "funnel not found: %v", err)) + return + } + response := tf.ConstructFunnelResponse(funnel, &claims) + render.Success(rw, http.StatusOK, response) +} + +func (handler *handler) Delete(rw http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + funnelID := vars["funnel_id"] + + claims, err := authtypes.ClaimsFromContext(r.Context()) + + if err != nil { + render.Error(rw, err) + return + } + + if err := handler.module.Delete(r.Context(), valuer.MustNewUUID(funnelID), valuer.MustNewUUID(claims.OrgID)); err != nil { + render.Error(rw, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "failed to delete funnel: %v", err)) + return + } + + render.Success(rw, http.StatusOK, nil) +} diff --git a/pkg/modules/tracefunnel/impltracefunnel/handler_test.go b/pkg/modules/tracefunnel/impltracefunnel/handler_test.go new file mode 100644 index 0000000000..06df5d31f4 --- /dev/null +++ b/pkg/modules/tracefunnel/impltracefunnel/handler_test.go @@ -0,0 +1,173 @@ +package impltracefunnel + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/authtypes" + traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/gorilla/mux" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +type MockModule struct { + mock.Mock +} + +func (m *MockModule) Create(ctx context.Context, timestamp int64, name string, userID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + args := m.Called(ctx, timestamp, name, userID, orgID) + return args.Get(0).(*traceFunnels.StorableFunnel), args.Error(1) +} + +func (m *MockModule) Get(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + args := m.Called(ctx, funnelID, orgID) + return args.Get(0).(*traceFunnels.StorableFunnel), args.Error(1) +} + +func (m *MockModule) Update(ctx context.Context, funnel *traceFunnels.StorableFunnel, userID valuer.UUID) error { + args := m.Called(ctx, funnel, userID) + return args.Error(0) +} + +func (m *MockModule) List(ctx context.Context, orgID valuer.UUID) ([]*traceFunnels.StorableFunnel, error) { + args := m.Called(ctx, orgID) + return args.Get(0).([]*traceFunnels.StorableFunnel), args.Error(1) +} + +func (m *MockModule) Delete(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) error { + args := m.Called(ctx, funnelID, orgID) + return args.Error(0) +} + +func (m *MockModule) Save(ctx context.Context, funnel *traceFunnels.StorableFunnel, userID valuer.UUID, orgID valuer.UUID) error { + args := m.Called(ctx, funnel, userID, orgID) + return args.Error(0) +} + +func (m *MockModule) GetFunnelMetadata(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (int64, int64, string, error) { + args := m.Called(ctx, funnelID, orgID) + return args.Get(0).(int64), args.Get(1).(int64), args.String(2), args.Error(3) +} + +func TestHandler_List(t *testing.T) { + mockModule := new(MockModule) + handler := NewHandler(mockModule) + + req := httptest.NewRequest(http.MethodGet, "/api/v1/trace-funnels/list", nil) + + orgID := valuer.GenerateUUID() + claims := authtypes.Claims{ + OrgID: orgID.String(), + } + req = req.WithContext(authtypes.NewContextWithClaims(req.Context(), claims)) + + rr := httptest.NewRecorder() + + funnel1ID := valuer.GenerateUUID() + funnel2ID := valuer.GenerateUUID() + expectedFunnels := []*traceFunnels.StorableFunnel{ + { + Identifiable: types.Identifiable{ + ID: funnel1ID, + }, + Name: "funnel-1", + OrgID: orgID, + }, + { + Identifiable: types.Identifiable{ + ID: funnel2ID, + }, + Name: "funnel-2", + OrgID: orgID, + }, + } + + mockModule.On("List", req.Context(), orgID).Return(expectedFunnels, nil) + + handler.List(rr, req) + + assert.Equal(t, http.StatusOK, rr.Code) + + var response struct { + Status string `json:"status"` + Data []traceFunnels.GettableFunnel `json:"data"` + } + err := json.Unmarshal(rr.Body.Bytes(), &response) + assert.NoError(t, err) + assert.Equal(t, "success", response.Status) + assert.Len(t, response.Data, 2) + assert.Equal(t, "funnel-1", response.Data[0].FunnelName) + assert.Equal(t, "funnel-2", response.Data[1].FunnelName) + + mockModule.AssertExpectations(t) +} + +func TestHandler_Get(t *testing.T) { + mockModule := new(MockModule) + handler := NewHandler(mockModule) + + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + req := httptest.NewRequest(http.MethodGet, "/api/v1/trace-funnels/"+funnelID.String(), nil) + req = mux.SetURLVars(req, map[string]string{"funnel_id": funnelID.String()}) + req = req.WithContext(authtypes.NewContextWithClaims(req.Context(), authtypes.Claims{ + OrgID: orgID.String(), + })) + + rr := httptest.NewRecorder() + + expectedFunnel := &traceFunnels.StorableFunnel{ + Identifiable: types.Identifiable{ + ID: funnelID, + }, + Name: "test-funnel", + OrgID: orgID, + } + + mockModule.On("Get", req.Context(), funnelID, orgID).Return(expectedFunnel, nil) + + handler.Get(rr, req) + + assert.Equal(t, http.StatusOK, rr.Code) + + var response struct { + Status string `json:"status"` + Data traceFunnels.GettableFunnel `json:"data"` + } + err := json.Unmarshal(rr.Body.Bytes(), &response) + assert.NoError(t, err) + assert.Equal(t, "success", response.Status) + assert.Equal(t, "test-funnel", response.Data.FunnelName) + assert.Equal(t, expectedFunnel.OrgID.String(), response.Data.OrgID) + + mockModule.AssertExpectations(t) +} + +func TestHandler_Delete(t *testing.T) { + mockModule := new(MockModule) + handler := NewHandler(mockModule) + + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + req := httptest.NewRequest(http.MethodDelete, "/api/v1/trace-funnels/"+funnelID.String(), nil) + req = mux.SetURLVars(req, map[string]string{"funnel_id": funnelID.String()}) + req = req.WithContext(authtypes.NewContextWithClaims(req.Context(), authtypes.Claims{ + OrgID: orgID.String(), + })) + + rr := httptest.NewRecorder() + + mockModule.On("Delete", req.Context(), funnelID, orgID).Return(nil) + + handler.Delete(rr, req) + + assert.Equal(t, http.StatusOK, rr.Code) + + mockModule.AssertExpectations(t) +} diff --git a/pkg/modules/tracefunnel/impltracefunnel/module.go b/pkg/modules/tracefunnel/impltracefunnel/module.go new file mode 100644 index 0000000000..b53ffb42c6 --- /dev/null +++ b/pkg/modules/tracefunnel/impltracefunnel/module.go @@ -0,0 +1,96 @@ +package impltracefunnel + +import ( + "context" + "fmt" + "time" + + "github.com/SigNoz/signoz/pkg/modules/tracefunnel" + "github.com/SigNoz/signoz/pkg/types" + traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type module struct { + store traceFunnels.FunnelStore +} + +func NewModule(store traceFunnels.FunnelStore) tracefunnel.Module { + return &module{ + store: store, + } +} + +func (module *module) Create(ctx context.Context, timestamp int64, name string, userID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + funnel := &traceFunnels.StorableFunnel{ + Name: name, + OrgID: orgID, + } + funnel.CreatedAt = time.Unix(0, timestamp*1000000) // Convert to nanoseconds + funnel.CreatedBy = userID.String() + + // Set up the user relationship + funnel.CreatedByUser = &types.User{ + Identifiable: types.Identifiable{ + ID: userID, + }, + } + + if funnel.ID.IsZero() { + funnel.ID = valuer.GenerateUUID() + } + + if funnel.CreatedAt.IsZero() { + funnel.CreatedAt = time.Now() + } + if funnel.UpdatedAt.IsZero() { + funnel.UpdatedAt = time.Now() + } + + // Set created_by if CreatedByUser is present + if funnel.CreatedByUser != nil { + funnel.CreatedBy = funnel.CreatedByUser.Identifiable.ID.String() + } + + if err := module.store.Create(ctx, funnel); err != nil { + return nil, fmt.Errorf("failed to create funnel: %v", err) + } + + return funnel, nil +} + +// Get gets a funnel by ID +func (module *module) Get(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + return module.store.Get(ctx, funnelID, orgID) +} + +// Update updates a funnel +func (module *module) Update(ctx context.Context, funnel *traceFunnels.StorableFunnel, userID valuer.UUID) error { + funnel.UpdatedBy = userID.String() + return module.store.Update(ctx, funnel) +} + +// List lists all funnels for an organization +func (module *module) List(ctx context.Context, orgID valuer.UUID) ([]*traceFunnels.StorableFunnel, error) { + funnels, err := module.store.List(ctx, orgID) + if err != nil { + return nil, fmt.Errorf("failed to list funnels: %v", err) + } + + return funnels, nil +} + +// Delete deletes a funnel +func (module *module) Delete(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) error { + return module.store.Delete(ctx, funnelID, orgID) +} + +// GetFunnelMetadata gets metadata for a funnel +func (module *module) GetFunnelMetadata(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (int64, int64, string, error) { + funnel, err := module.store.Get(ctx, funnelID, orgID) + if err != nil { + return 0, 0, "", err + } + + return funnel.CreatedAt.UnixNano() / 1000000, funnel.UpdatedAt.UnixNano() / 1000000, funnel.Description, nil +} diff --git a/pkg/modules/tracefunnel/impltracefunnel/store.go b/pkg/modules/tracefunnel/impltracefunnel/store.go new file mode 100644 index 0000000000..f0c2b119b5 --- /dev/null +++ b/pkg/modules/tracefunnel/impltracefunnel/store.go @@ -0,0 +1,114 @@ +package impltracefunnel + +import ( + "context" + "time" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/sqlstore" + traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type store struct { + sqlstore sqlstore.SQLStore +} + +func NewStore(sqlstore sqlstore.SQLStore) traceFunnels.FunnelStore { + return &store{sqlstore: sqlstore} +} + +func (store *store) Create(ctx context.Context, funnel *traceFunnels.StorableFunnel) error { + // Check if a funnel with the same name already exists in the organization + exists, err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(new(traceFunnels.StorableFunnel)). + Where("name = ? AND org_id = ?", funnel.Name, funnel.OrgID.String()). + Exists(ctx) + if err != nil { + return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to check for existing funnelr") + } + if exists { + return store.sqlstore.WrapAlreadyExistsErrf(nil, traceFunnels.ErrFunnelAlreadyExists, "a funnel with name '%s' already exists in this organization", funnel.Name) + } + + _, err = store. + sqlstore. + BunDB(). + NewInsert(). + Model(funnel). + Exec(ctx) + if err != nil { + return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to create funnels") + } + + return nil +} + +// Get retrieves a funnel by ID +func (store *store) Get(ctx context.Context, uuid valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + funnel := &traceFunnels.StorableFunnel{} + err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(funnel). + Relation("CreatedByUser"). + Where("?TableAlias.id = ? AND ?TableAlias.org_id = ?", uuid.String(), orgID.String()). + Scan(ctx) + if err != nil { + return nil, errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to get funnels") + } + return funnel, nil +} + +// Update updates an existing funnel +func (store *store) Update(ctx context.Context, funnel *traceFunnels.StorableFunnel) error { + funnel.UpdatedAt = time.Now() + + _, err := store. + sqlstore. + BunDB(). + NewUpdate(). + Model(funnel). + WherePK(). + Exec(ctx) + if err != nil { + return store.sqlstore.WrapAlreadyExistsErrf(err, traceFunnels.ErrFunnelAlreadyExists, "a funnel with name '%s' already exists in this organization", funnel.Name) + } + return nil +} + +// List retrieves all funnels for a given organization +func (store *store) List(ctx context.Context, orgID valuer.UUID) ([]*traceFunnels.StorableFunnel, error) { + var funnels []*traceFunnels.StorableFunnel + err := store. + sqlstore. + BunDB(). + NewSelect(). + Model(&funnels). + Relation("CreatedByUser"). + Where("?TableAlias.org_id = ?", orgID.String()). + Scan(ctx) + if err != nil { + return nil, errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to list funnels") + } + return funnels, nil +} + +// Delete removes a funnel by ID +func (store *store) Delete(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) error { + _, err := store. + sqlstore. + BunDB(). + NewDelete(). + Model(new(traceFunnels.StorableFunnel)). + Where("id = ? AND org_id = ?", funnelID.String(), orgID.String()). + Exec(ctx) + if err != nil { + return errors.Wrapf(err, errors.TypeInternal, errors.CodeInternal, "failed to delete funnel") + } + return nil +} diff --git a/pkg/modules/tracefunnel/tracefunnel.go b/pkg/modules/tracefunnel/tracefunnel.go new file mode 100644 index 0000000000..13401ee5a4 --- /dev/null +++ b/pkg/modules/tracefunnel/tracefunnel.go @@ -0,0 +1,38 @@ +package tracefunnel + +import ( + "context" + "github.com/SigNoz/signoz/pkg/valuer" + "net/http" + + traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" +) + +// Module defines the interface for trace funnel operations +type Module interface { + Create(ctx context.Context, timestamp int64, name string, userID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) + + Get(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) + + Update(ctx context.Context, funnel *traceFunnels.StorableFunnel, userID valuer.UUID) error + + List(ctx context.Context, orgID valuer.UUID) ([]*traceFunnels.StorableFunnel, error) + + Delete(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) error + + GetFunnelMetadata(ctx context.Context, funnelID valuer.UUID, orgID valuer.UUID) (int64, int64, string, error) +} + +type Handler interface { + New(http.ResponseWriter, *http.Request) + + UpdateSteps(http.ResponseWriter, *http.Request) + + UpdateFunnel(http.ResponseWriter, *http.Request) + + List(http.ResponseWriter, *http.Request) + + Get(http.ResponseWriter, *http.Request) + + Delete(http.ResponseWriter, *http.Request) +} diff --git a/pkg/modules/tracefunnel/tracefunneltest/module_test.go b/pkg/modules/tracefunnel/tracefunneltest/module_test.go new file mode 100644 index 0000000000..0379027669 --- /dev/null +++ b/pkg/modules/tracefunnel/tracefunneltest/module_test.go @@ -0,0 +1,183 @@ +package tracefunneltest + +import ( + "context" + "testing" + "time" + + "github.com/SigNoz/signoz/pkg/modules/tracefunnel/impltracefunnel" + "github.com/SigNoz/signoz/pkg/types" + traceFunnels "github.com/SigNoz/signoz/pkg/types/tracefunneltypes" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +type MockStore struct { + mock.Mock +} + +func (m *MockStore) Create(ctx context.Context, funnel *traceFunnels.StorableFunnel) error { + args := m.Called(ctx, funnel) + return args.Error(0) +} + +func (m *MockStore) Get(ctx context.Context, uuid valuer.UUID, orgID valuer.UUID) (*traceFunnels.StorableFunnel, error) { + args := m.Called(ctx, uuid, orgID) + return args.Get(0).(*traceFunnels.StorableFunnel), args.Error(1) +} + +func (m *MockStore) List(ctx context.Context, orgID valuer.UUID) ([]*traceFunnels.StorableFunnel, error) { + args := m.Called(ctx, orgID) + return args.Get(0).([]*traceFunnels.StorableFunnel), args.Error(1) +} + +func (m *MockStore) Update(ctx context.Context, funnel *traceFunnels.StorableFunnel) error { + args := m.Called(ctx, funnel) + return args.Error(0) +} + +func (m *MockStore) Delete(ctx context.Context, uuid valuer.UUID, orgID valuer.UUID) error { + args := m.Called(ctx, uuid, orgID) + return args.Error(0) +} + +func TestModule_Create(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + timestamp := time.Now().UnixMilli() + name := "test-funnel" + userID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + + mockStore.On("Create", ctx, mock.MatchedBy(func(f *traceFunnels.StorableFunnel) bool { + return f.Name == name && + f.CreatedBy == userID.String() && + f.OrgID == orgID && + f.CreatedByUser != nil && + f.CreatedByUser.ID == userID && + f.CreatedAt.UnixNano()/1000000 == timestamp + })).Return(nil) + + funnel, err := module.Create(ctx, timestamp, name, userID, orgID) + assert.NoError(t, err) + assert.NotNil(t, funnel) + assert.Equal(t, name, funnel.Name) + assert.Equal(t, userID.String(), funnel.CreatedBy) + assert.Equal(t, orgID, funnel.OrgID) + assert.NotNil(t, funnel.CreatedByUser) + assert.Equal(t, userID, funnel.CreatedByUser.ID) + + mockStore.AssertExpectations(t) +} + +func TestModule_Get(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + expectedFunnel := &traceFunnels.StorableFunnel{ + Name: "test-funnel", + } + + mockStore.On("Get", ctx, funnelID, orgID).Return(expectedFunnel, nil) + + funnel, err := module.Get(ctx, funnelID, orgID) + assert.NoError(t, err) + assert.Equal(t, expectedFunnel, funnel) + + mockStore.AssertExpectations(t) +} + +func TestModule_Update(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + userID := valuer.GenerateUUID() + funnel := &traceFunnels.StorableFunnel{ + Name: "test-funnel", + } + + mockStore.On("Update", ctx, funnel).Return(nil) + + err := module.Update(ctx, funnel, userID) + assert.NoError(t, err) + assert.Equal(t, userID.String(), funnel.UpdatedBy) + + mockStore.AssertExpectations(t) +} + +func TestModule_List(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + orgID := valuer.GenerateUUID() + expectedFunnels := []*traceFunnels.StorableFunnel{ + { + Name: "funnel-1", + OrgID: orgID, + }, + { + Name: "funnel-2", + OrgID: orgID, + }, + } + + mockStore.On("List", ctx, orgID).Return(expectedFunnels, nil) + + funnels, err := module.List(ctx, orgID) + assert.NoError(t, err) + assert.Len(t, funnels, 2) + assert.Equal(t, expectedFunnels, funnels) + + mockStore.AssertExpectations(t) +} + +func TestModule_Delete(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + + mockStore.On("Delete", ctx, funnelID, orgID).Return(nil) + + err := module.Delete(ctx, funnelID, orgID) + assert.NoError(t, err) + + mockStore.AssertExpectations(t) +} + +func TestModule_GetFunnelMetadata(t *testing.T) { + mockStore := new(MockStore) + module := impltracefunnel.NewModule(mockStore) + + ctx := context.Background() + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + now := time.Now() + expectedFunnel := &traceFunnels.StorableFunnel{ + Description: "test description", + TimeAuditable: types.TimeAuditable{ + CreatedAt: now, + UpdatedAt: now, + }, + } + + mockStore.On("Get", ctx, funnelID, orgID).Return(expectedFunnel, nil) + + createdAt, updatedAt, description, err := module.GetFunnelMetadata(ctx, funnelID, orgID) + assert.NoError(t, err) + assert.Equal(t, now.UnixNano()/1000000, createdAt) + assert.Equal(t, now.UnixNano()/1000000, updatedAt) + assert.Equal(t, "test description", description) + + mockStore.AssertExpectations(t) +} diff --git a/pkg/modules/user/impluser/module.go b/pkg/modules/user/impluser/module.go index ed7a58c9b7..45eaa4ba66 100644 --- a/pkg/modules/user/impluser/module.go +++ b/pkg/modules/user/impluser/module.go @@ -11,8 +11,10 @@ import ( "github.com/SigNoz/signoz/pkg/emailing" "github.com/SigNoz/signoz/pkg/errors" "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/modules/user" "github.com/SigNoz/signoz/pkg/query-service/constants" + "github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/query-service/telemetry" "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/authtypes" @@ -22,20 +24,22 @@ import ( ) type Module struct { - store types.UserStore - jwt *authtypes.JWT - emailing emailing.Emailing - settings factory.ScopedProviderSettings + store types.UserStore + jwt *authtypes.JWT + emailing emailing.Emailing + settings factory.ScopedProviderSettings + orgSetter organization.Setter } // This module is a WIP, don't take inspiration from this. -func NewModule(store types.UserStore, jwt *authtypes.JWT, emailing emailing.Emailing, providerSettings factory.ProviderSettings) user.Module { +func NewModule(store types.UserStore, jwt *authtypes.JWT, emailing emailing.Emailing, providerSettings factory.ProviderSettings, orgSetter organization.Setter) user.Module { settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/modules/user/impluser") return &Module{ - store: store, - jwt: jwt, - emailing: emailing, - settings: settings, + store: store, + jwt: jwt, + emailing: emailing, + settings: settings, + orgSetter: orgSetter, } } @@ -538,3 +542,36 @@ func (m *Module) ListDomains(ctx context.Context, orgID valuer.UUID) ([]*types.G func (m *Module) UpdateDomain(ctx context.Context, domain *types.GettableOrgDomain) error { return m.store.UpdateDomain(ctx, domain) } + +func (m *Module) Register(ctx context.Context, req *types.PostableRegisterOrgAndAdmin) (*types.User, error) { + if req.Email == "" { + return nil, errors.NewInvalidInputf(errors.CodeInvalidInput, "email is required") + } + + if req.Password == "" { + return nil, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "password is required") + } + + organization := types.NewOrganization(req.OrgDisplayName) + err := m.orgSetter.Create(ctx, organization) + if err != nil { + return nil, model.InternalError(err) + } + + user, err := types.NewUser(req.Name, req.Email, types.RoleAdmin.String(), organization.ID.StringValue()) + if err != nil { + return nil, model.InternalError(err) + } + + password, err := types.NewFactorPassword(req.Password) + if err != nil { + return nil, model.InternalError(err) + } + + user, err = m.CreateUserWithPassword(ctx, user, password) + if err != nil { + return nil, model.InternalError(err) + } + + return user, nil +} diff --git a/pkg/modules/user/user.go b/pkg/modules/user/user.go index f2f4153ddc..cb991ab95b 100644 --- a/pkg/modules/user/user.go +++ b/pkg/modules/user/user.go @@ -62,6 +62,9 @@ type Module interface { ListAPIKeys(ctx context.Context, orgID valuer.UUID) ([]*types.StorableAPIKeyUser, error) RevokeAPIKey(ctx context.Context, id, removedByUserID valuer.UUID) error GetAPIKey(ctx context.Context, orgID valuer.UUID, id valuer.UUID) (*types.StorableAPIKeyUser, error) + + // Register + Register(ctx context.Context, req *types.PostableRegisterOrgAndAdmin) (*types.User, error) } type Handler interface { diff --git a/pkg/prometheus/clickhouseprometheus/client.go b/pkg/prometheus/clickhouseprometheus/client.go index d98caafb30..47087d4c89 100644 --- a/pkg/prometheus/clickhouseprometheus/client.go +++ b/pkg/prometheus/clickhouseprometheus/client.go @@ -3,11 +3,14 @@ package clickhouseprometheus import ( "context" "fmt" + "github.com/SigNoz/signoz/pkg/query-service/constants" + "math" "strconv" "strings" "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/telemetrystore" + promValue "github.com/prometheus/prometheus/model/value" "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/storage" "github.com/prometheus/prometheus/storage/remote" @@ -98,9 +101,15 @@ func (client *client) queryToClickhouseQuery(_ context.Context, query *prompb.Qu var args []any conditions = append(conditions, fmt.Sprintf("metric_name = $%d", argCount+1)) conditions = append(conditions, "temporality IN ['Cumulative', 'Unspecified']") - conditions = append(conditions, "__normalized = true") conditions = append(conditions, fmt.Sprintf("unix_milli >= %d AND unix_milli < %d", start, end)) + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + + conditions = append(conditions, fmt.Sprintf("__normalized = %v", normalized)) + args = append(args, metricName) for _, m := range query.Matchers { switch m.Type { @@ -181,9 +190,10 @@ func (client *client) querySamples(ctx context.Context, start int64, end int64, var fingerprint, prevFingerprint uint64 var timestampMs int64 var value float64 + var flags uint32 for rows.Next() { - if err := rows.Scan(&metricName, &fingerprint, ×tampMs, &value); err != nil { + if err := rows.Scan(&metricName, &fingerprint, ×tampMs, &value, &flags); err != nil { return nil, err } @@ -201,6 +211,10 @@ func (client *client) querySamples(ctx context.Context, start int64, end int64, } } + if flags&1 == 1 { + value = math.Float64frombits(promValue.StaleNaN) + } + // add samples to current time series ts.Samples = append(ts.Samples, prompb.Sample{ Timestamp: timestampMs, diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index 08d0dcc0af..c4dd8dbde1 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -3003,18 +3003,22 @@ func (r *ClickHouseReader) QueryDashboardVars(ctx context.Context, query string) return &result, nil } -func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipDotNames bool, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) { +func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) { var query string var err error var rows driver.Rows var response v3.AggregateAttributeResponse + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } - query = fmt.Sprintf("SELECT metric_name, type, is_monotonic, temporality FROM %s.%s WHERE metric_name ILIKE $1 GROUP BY metric_name, type, is_monotonic, temporality", signozMetricDBName, signozTSTableNameV41Day) + query = fmt.Sprintf("SELECT metric_name, type, is_monotonic, temporality FROM %s.%s WHERE metric_name ILIKE $1 and __normalized = $2 GROUP BY metric_name, type, is_monotonic, temporality", signozMetricDBName, signozTSTableNameV41Day) if req.Limit != 0 { query = query + fmt.Sprintf(" LIMIT %d;", req.Limit) } - rows, err = r.db.Query(ctx, query, fmt.Sprintf("%%%s%%", req.SearchText)) + rows, err = r.db.Query(ctx, query, fmt.Sprintf("%%%s%%", req.SearchText), normalized) if err != nil { zap.L().Error("Error while executing query", zap.Error(err)) @@ -3030,11 +3034,8 @@ func (r *ClickHouseReader) GetMetricAggregateAttributes(ctx context.Context, org if err := rows.Scan(&metricName, &typ, &isMonotonic, &temporality); err != nil { return nil, fmt.Errorf("error while scanning rows: %s", err.Error()) } - if skipDotNames && strings.Contains(metricName, ".") { - continue - } - if skipSignozMetrics && strings.HasPrefix(metricName, "signoz_") { + if skipSignozMetrics && strings.HasPrefix(metricName, "signoz") { continue } @@ -3077,12 +3078,17 @@ func (r *ClickHouseReader) GetMetricAttributeKeys(ctx context.Context, req *v3.F var rows driver.Rows var response v3.FilterAttributeKeyResponse + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + // skips the internal attributes i.e attributes starting with __ - query = fmt.Sprintf("SELECT arrayJoin(tagKeys) AS distinctTagKey FROM (SELECT JSONExtractKeys(labels) AS tagKeys FROM %s.%s WHERE metric_name=$1 AND unix_milli >= $2 AND __normalized = true GROUP BY tagKeys) WHERE distinctTagKey ILIKE $3 AND distinctTagKey NOT LIKE '\\_\\_%%' GROUP BY distinctTagKey", signozMetricDBName, signozTSTableNameV41Day) + query = fmt.Sprintf("SELECT arrayJoin(tagKeys) AS distinctTagKey FROM (SELECT JSONExtractKeys(labels) AS tagKeys FROM %s.%s WHERE metric_name=$1 AND unix_milli >= $2 AND __normalized = $3 GROUP BY tagKeys) WHERE distinctTagKey ILIKE $4 AND distinctTagKey NOT LIKE '\\_\\_%%' GROUP BY distinctTagKey", signozMetricDBName, signozTSTableNameV41Day) if req.Limit != 0 { query = query + fmt.Sprintf(" LIMIT %d;", req.Limit) } - rows, err = r.db.Query(ctx, query, req.AggregateAttribute, common.PastDayRoundOff(), fmt.Sprintf("%%%s%%", req.SearchText)) + rows, err = r.db.Query(ctx, query, req.AggregateAttribute, common.PastDayRoundOff(), normalized, fmt.Sprintf("%%%s%%", req.SearchText)) if err != nil { zap.L().Error("Error while executing query", zap.Error(err)) return nil, fmt.Errorf("error while executing query: %s", err.Error()) @@ -3113,16 +3119,19 @@ func (r *ClickHouseReader) GetMetricAttributeValues(ctx context.Context, req *v3 var rows driver.Rows var attributeValues v3.FilterAttributeValueResponse - query = fmt.Sprintf("SELECT JSONExtractString(labels, $1) AS tagValue FROM %s.%s WHERE metric_name IN $2 AND JSONExtractString(labels, $3) ILIKE $4 AND unix_milli >= $5 GROUP BY tagValue", signozMetricDBName, signozTSTableNameV41Day) + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + + query = fmt.Sprintf("SELECT JSONExtractString(labels, $1) AS tagValue FROM %s.%s WHERE metric_name IN $2 AND JSONExtractString(labels, $3) ILIKE $4 AND unix_milli >= $5 AND __normalized=$6 GROUP BY tagValue", signozMetricDBName, signozTSTableNameV41Day) if req.Limit != 0 { query = query + fmt.Sprintf(" LIMIT %d;", req.Limit) } names := []string{req.AggregateAttribute} - if _, ok := metrics.MetricsUnderTransition[req.AggregateAttribute]; ok { - names = append(names, metrics.MetricsUnderTransition[req.AggregateAttribute]) - } + names = append(names, metrics.GetTransitionedMetric(req.AggregateAttribute, normalized)) - rows, err = r.db.Query(ctx, query, req.FilterAttributeKey, names, req.FilterAttributeKey, fmt.Sprintf("%%%s%%", req.SearchText), common.PastDayRoundOff()) + rows, err = r.db.Query(ctx, query, req.FilterAttributeKey, names, req.FilterAttributeKey, fmt.Sprintf("%%%s%%", req.SearchText), common.PastDayRoundOff(), normalized) if err != nil { zap.L().Error("Error while executing query", zap.Error(err)) @@ -4992,15 +5001,19 @@ func (r *ClickHouseReader) SubscribeToQueryProgress( return r.queryProgressTracker.SubscribeToQueryProgress(queryId) } -func (r *ClickHouseReader) GetAllMetricFilterAttributeKeys(ctx context.Context, req *metrics_explorer.FilterKeyRequest, skipDotNames bool) (*[]v3.AttributeKey, *model.ApiError) { +func (r *ClickHouseReader) GetAllMetricFilterAttributeKeys(ctx context.Context, req *metrics_explorer.FilterKeyRequest) (*[]v3.AttributeKey, *model.ApiError) { var rows driver.Rows var response []v3.AttributeKey - query := fmt.Sprintf("SELECT arrayJoin(tagKeys) AS distinctTagKey FROM (SELECT JSONExtractKeys(labels) AS tagKeys FROM %s.%s WHERE unix_milli >= $1 GROUP BY tagKeys) WHERE distinctTagKey ILIKE $2 AND distinctTagKey NOT LIKE '\\_\\_%%' GROUP BY distinctTagKey", signozMetricDBName, signozTSTableNameV41Day) + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + query := fmt.Sprintf("SELECT arrayJoin(tagKeys) AS distinctTagKey FROM (SELECT JSONExtractKeys(labels) AS tagKeys FROM %s.%s WHERE unix_milli >= $1 and __normalized = $2 GROUP BY tagKeys) WHERE distinctTagKey ILIKE $3 AND distinctTagKey NOT LIKE '\\_\\_%%' GROUP BY distinctTagKey", signozMetricDBName, signozTSTableNameV41Day) if req.Limit != 0 { query = query + fmt.Sprintf(" LIMIT %d;", req.Limit) } valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) - rows, err := r.db.Query(valueCtx, query, common.PastDayRoundOff(), fmt.Sprintf("%%%s%%", req.SearchText)) //only showing past day data + rows, err := r.db.Query(valueCtx, query, common.PastDayRoundOff(), normalized, fmt.Sprintf("%%%s%%", req.SearchText)) //only showing past day data if err != nil { zap.L().Error("Error while executing query", zap.Error(err)) return nil, &model.ApiError{Typ: "ClickHouseError", Err: err} @@ -5011,9 +5024,6 @@ func (r *ClickHouseReader) GetAllMetricFilterAttributeKeys(ctx context.Context, if err := rows.Scan(&attributeKey); err != nil { return nil, &model.ApiError{Typ: "ClickHouseError", Err: err} } - if skipDotNames && strings.Contains(attributeKey, ".") { - continue - } key := v3.AttributeKey{ Key: attributeKey, DataType: v3.AttributeKeyDataTypeString, // https://github.com/OpenObservability/OpenMetrics/blob/main/proto/openmetrics_data_model.proto#L64-L72. @@ -5033,13 +5043,17 @@ func (r *ClickHouseReader) GetAllMetricFilterAttributeValues(ctx context.Context var err error var rows driver.Rows var attributeValues []string + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } - query = fmt.Sprintf("SELECT JSONExtractString(labels, $1) AS tagValue FROM %s.%s WHERE JSONExtractString(labels, $2) ILIKE $3 AND unix_milli >= $4 GROUP BY tagValue", signozMetricDBName, signozTSTableNameV41Day) + query = fmt.Sprintf("SELECT JSONExtractString(labels, $1) AS tagValue FROM %s.%s WHERE JSONExtractString(labels, $2) ILIKE $3 AND unix_milli >= $4 AND __normalized = $5 GROUP BY tagValue", signozMetricDBName, signozTSTableNameV41Day) if req.Limit != 0 { query = query + fmt.Sprintf(" LIMIT %d;", req.Limit) } valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) - rows, err = r.db.Query(valueCtx, query, req.FilterKey, req.FilterKey, fmt.Sprintf("%%%s%%", req.SearchText), common.PastDayRoundOff()) //only showing past day data + rows, err = r.db.Query(valueCtx, query, req.FilterKey, req.FilterKey, fmt.Sprintf("%%%s%%", req.SearchText), common.PastDayRoundOff(), normalized) //only showing past day data if err != nil { zap.L().Error("Error while executing query", zap.Error(err)) @@ -5176,6 +5190,11 @@ func (r *ClickHouseReader) GetAttributesForMetricName(ctx context.Context, metri whereClause = "AND " + strings.Join(conditions, " AND ") } } + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + const baseQueryTemplate = ` SELECT kv.1 AS key, @@ -5183,12 +5202,14 @@ SELECT length(groupUniqArray(10000)(kv.2)) AS valueCount FROM %s.%s ARRAY JOIN arrayFilter(x -> NOT startsWith(x.1, '__'), JSONExtractKeysAndValuesRaw(labels)) AS kv -WHERE metric_name = ? AND __normalized=true %s` +WHERE metric_name = ? AND __normalized=? %s` var args []interface{} args = append(args, metricName) tableName := signozTSTableNameV41Week + args = append(args, normalized) + if start != nil && end != nil { st, en, tsTable, _ := utils.WhichTSTableToUse(*start, *end) *start, *end, tableName = st, en, tsTable @@ -5264,6 +5285,11 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. orderByClauseFirstQuery = fmt.Sprintf("ORDER BY %s %s", req.OrderBy.ColumnName, req.OrderBy.Order) } + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + // Determine which tables to use start, end, tsTable, localTsTable := utils.WhichTSTableToUse(req.Start, req.End) sampleTable, countExp := utils.WhichSampleTableToUse(req.Start, req.End) @@ -5278,8 +5304,8 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. uniq(metric_name) OVER() AS total FROM %s.%s AS t WHERE unix_milli BETWEEN ? AND ? - AND NOT startsWith(metric_name, 'signoz_') - AND __normalized = true + AND NOT startsWith(metric_name, 'signoz') + AND __normalized = ? %s GROUP BY t.metric_name %s @@ -5287,6 +5313,7 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. signozMetricDBName, tsTable, whereClause, orderByClauseFirstQuery, firstQueryLimit, req.Offset) args = append(args, start, end) + args = append(args, normalized) valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) begin := time.Now() rows, err := r.db.Query(valueCtx, metricsQuery, args...) @@ -5346,7 +5373,7 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. SELECT fingerprint FROM %s.%s WHERE metric_name IN (%s) - AND __normalized = true + AND __normalized = ? AND unix_milli BETWEEN ? AND ? %s GROUP BY fingerprint @@ -5361,6 +5388,7 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. metricsList, whereClause, )) + args = append(args, normalized) args = append(args, start, end) args = append(args, req.Start, req.End) } else { @@ -5455,6 +5483,11 @@ func (r *ClickHouseReader) ListSummaryMetrics(ctx context.Context, orgID valuer. func (r *ClickHouseReader) GetMetricsTimeSeriesPercentage(ctx context.Context, req *metrics_explorer.TreeMapMetricsRequest) (*[]metrics_explorer.TreeMapResponseItem, *model.ApiError) { var args []interface{} + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + // Build filters dynamically conditions, _ := utils.BuildFilterConditions(&req.Filters, "") whereClause := "" @@ -5475,9 +5508,9 @@ func (r *ClickHouseReader) GetMetricsTimeSeriesPercentage(ctx context.Context, r uniq(fingerprint) AS total_value, (SELECT uniq(fingerprint) FROM %s.%s - WHERE unix_milli BETWEEN ? AND ? AND __normalized = true) AS total_time_series + WHERE unix_milli BETWEEN ? AND ? AND __normalized = ?) AS total_time_series FROM %s.%s - WHERE unix_milli BETWEEN ? AND ? AND NOT startsWith(metric_name, 'signoz_') AND __normalized = true %s + WHERE unix_milli BETWEEN ? AND ? AND NOT startsWith(metric_name, 'signoz') AND __normalized = ? %s GROUP BY metric_name ) ORDER BY percentage DESC @@ -5491,8 +5524,10 @@ func (r *ClickHouseReader) GetMetricsTimeSeriesPercentage(ctx context.Context, r ) args = append(args, - start, end, // For total_time_series subquery + start, end, + normalized, // For total_time_series subquery start, end, // For main query + normalized, ) valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) @@ -5532,6 +5567,11 @@ func (r *ClickHouseReader) GetMetricsSamplesPercentage(ctx context.Context, req whereClause = "AND " + strings.Join(conditions, " AND ") } + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + // Determine time range and tables to use start, end, tsTable, localTsTable := utils.WhichTSTableToUse(req.Start, req.End) sampleTable, countExp := utils.WhichSampleTableToUse(req.Start, req.End) @@ -5543,7 +5583,7 @@ func (r *ClickHouseReader) GetMetricsSamplesPercentage(ctx context.Context, req uniq(ts.fingerprint) AS timeSeries FROM %s.%s AS ts WHERE NOT startsWith(ts.metric_name, 'signoz_') - AND __normalized = true + AND __normalized = ? AND unix_milli BETWEEN ? AND ? %s GROUP BY ts.metric_name @@ -5554,7 +5594,7 @@ func (r *ClickHouseReader) GetMetricsSamplesPercentage(ctx context.Context, req valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) begin := time.Now() - rows, err := r.db.Query(valueCtx, metricsQuery, start, end) + rows, err := r.db.Query(valueCtx, metricsQuery, normalized, start, end) duration := time.Since(begin) zap.L().Info("Time taken to execute samples percentage metric name query to reduce search space", zap.String("query", metricsQuery), zap.Any("start", start), zap.Any("end", end), zap.Duration("duration", duration)) if err != nil { @@ -5626,13 +5666,13 @@ func (r *ClickHouseReader) GetMetricsSamplesPercentage(ctx context.Context, req FROM %s.%s AS ts WHERE ts.metric_name IN (%s) AND unix_milli BETWEEN ? AND ? - AND __normalized = true + AND __normalized = ? %s GROUP BY ts.fingerprint )`, signozMetricDBName, localTsTable, metricsList, whereClause, )) - args = append(args, start, end) + args = append(args, start, end, normalized) } // Apply metric filtering after all conditions @@ -5682,6 +5722,11 @@ func (r *ClickHouseReader) GetMetricsSamplesPercentage(ctx context.Context, req func (r *ClickHouseReader) GetNameSimilarity(ctx context.Context, req *metrics_explorer.RelatedMetricsRequest) (map[string]metrics_explorer.RelatedMetricsScore, *model.ApiError) { start, end, tsTable, _ := utils.WhichTSTableToUse(req.Start, req.End) + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + query := fmt.Sprintf(` SELECT metric_name, @@ -5692,15 +5737,15 @@ func (r *ClickHouseReader) GetNameSimilarity(ctx context.Context, req *metrics_e FROM %s.%s WHERE metric_name != ? AND unix_milli BETWEEN ? AND ? - AND NOT startsWith(metric_name, 'signoz_') - AND __normalized = true + AND NOT startsWith(metric_name, 'signoz') + AND __normalized = ? GROUP BY metric_name ORDER BY name_similarity DESC LIMIT 30;`, signozMetricDBName, tsTable) valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) - rows, err := r.db.Query(valueCtx, query, req.CurrentMetricName, req.CurrentMetricName, req.CurrentMetricName, start, end) + rows, err := r.db.Query(valueCtx, query, req.CurrentMetricName, req.CurrentMetricName, req.CurrentMetricName, start, end, normalized) if err != nil { return nil, &model.ApiError{Typ: "ClickHouseError", Err: err} } @@ -5730,6 +5775,11 @@ func (r *ClickHouseReader) GetNameSimilarity(ctx context.Context, req *metrics_e func (r *ClickHouseReader) GetAttributeSimilarity(ctx context.Context, req *metrics_explorer.RelatedMetricsRequest) (map[string]metrics_explorer.RelatedMetricsScore, *model.ApiError) { start, end, tsTable, _ := utils.WhichTSTableToUse(req.Start, req.End) + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + // Get target labels extractedLabelsQuery := fmt.Sprintf(` SELECT @@ -5741,12 +5791,12 @@ func (r *ClickHouseReader) GetAttributeSimilarity(ctx context.Context, req *metr AND unix_milli between ? and ? AND NOT startsWith(kv.1, '__') AND NOT startsWith(metric_name, 'signoz_') - AND __normalized = true + AND __normalized = ? GROUP BY label_key LIMIT 50`, signozMetricDBName, tsTable) valueCtx := context.WithValue(ctx, "clickhouse_max_threads", constants.MetricsExplorerClickhouseThreads) - rows, err := r.db.Query(valueCtx, extractedLabelsQuery, req.CurrentMetricName, start, end) + rows, err := r.db.Query(valueCtx, extractedLabelsQuery, req.CurrentMetricName, start, end, normalized) if err != nil { return nil, &model.ApiError{Typ: "ClickHouseError", Err: err} } @@ -5819,7 +5869,7 @@ func (r *ClickHouseReader) GetAttributeSimilarity(ctx context.Context, req *metr WHERE rand() %% 100 < 10 AND unix_milli between ? and ? AND NOT startsWith(metric_name, 'signoz_') - AND __normalized = true + AND __normalized = ? GROUP BY metric_name ORDER BY weighted_match_count DESC, raw_match_count DESC LIMIT 30 @@ -5827,7 +5877,7 @@ func (r *ClickHouseReader) GetAttributeSimilarity(ctx context.Context, req *metr targetKeysList, targetValuesList, priorityListString, 2, signozMetricDBName, tsTable) - rows, err = r.db.Query(valueCtx, candidateLabelsQuery, start, end) + rows, err = r.db.Query(valueCtx, candidateLabelsQuery, start, end, normalized) if err != nil { return nil, &model.ApiError{Typ: "ClickHouseError", Err: err} } @@ -6217,9 +6267,6 @@ func (r *ClickHouseReader) GetUpdatedMetricsMetadata(ctx context.Context, orgID if err == nil { cachedMetadata[metricName] = metadata } else { - if err != nil { - zap.L().Error("Error retrieving metrics metadata from cache", zap.String("metric_name", metricName), zap.Error(err)) - } missingMetrics = append(missingMetrics, metricName) } } diff --git a/pkg/query-service/app/cloudintegrations/controller.go b/pkg/query-service/app/cloudintegrations/controller.go index 8ca790d05c..e617d6e7db 100644 --- a/pkg/query-service/app/cloudintegrations/controller.go +++ b/pkg/query-service/app/cloudintegrations/controller.go @@ -13,6 +13,8 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" + "github.com/SigNoz/signoz/pkg/valuer" "golang.org/x/exp/maps" ) @@ -32,9 +34,7 @@ type Controller struct { serviceConfigRepo ServiceConfigDatabase } -func NewController(sqlStore sqlstore.SQLStore) ( - *Controller, error, -) { +func NewController(sqlStore sqlstore.SQLStore) (*Controller, error) { accountsRepo, err := newCloudProviderAccountsRepository(sqlStore) if err != nil { return nil, fmt.Errorf("couldn't create cloud provider accounts repo: %w", err) @@ -55,9 +55,7 @@ type ConnectedAccountsListResponse struct { Accounts []types.Account `json:"accounts"` } -func (c *Controller) ListConnectedAccounts( - ctx context.Context, orgId string, cloudProvider string, -) ( +func (c *Controller) ListConnectedAccounts(ctx context.Context, orgId string, cloudProvider string) ( *ConnectedAccountsListResponse, *model.ApiError, ) { if apiErr := validateCloudProviderName(cloudProvider); apiErr != nil { @@ -103,9 +101,7 @@ type GenerateConnectionUrlResponse struct { ConnectionUrl string `json:"connection_url"` } -func (c *Controller) GenerateConnectionUrl( - ctx context.Context, orgId string, cloudProvider string, req GenerateConnectionUrlRequest, -) (*GenerateConnectionUrlResponse, *model.ApiError) { +func (c *Controller) GenerateConnectionUrl(ctx context.Context, orgId string, cloudProvider string, req GenerateConnectionUrlRequest) (*GenerateConnectionUrlResponse, *model.ApiError) { // Account connection with a simple connection URL may not be available for all providers. if cloudProvider != "aws" { return nil, model.BadRequest(fmt.Errorf("unsupported cloud provider: %s", cloudProvider)) @@ -154,9 +150,7 @@ type AccountStatusResponse struct { Status types.AccountStatus `json:"status"` } -func (c *Controller) GetAccountStatus( - ctx context.Context, orgId string, cloudProvider string, accountId string, -) ( +func (c *Controller) GetAccountStatus(ctx context.Context, orgId string, cloudProvider string, accountId string) ( *AccountStatusResponse, *model.ApiError, ) { if apiErr := validateCloudProviderName(cloudProvider); apiErr != nil { @@ -198,9 +192,7 @@ type IntegrationConfigForAgent struct { TelemetryCollectionStrategy *CompiledCollectionStrategy `json:"telemetry,omitempty"` } -func (c *Controller) CheckInAsAgent( - ctx context.Context, orgId string, cloudProvider string, req AgentCheckInRequest, -) (*AgentCheckInResponse, error) { +func (c *Controller) CheckInAsAgent(ctx context.Context, orgId string, cloudProvider string, req AgentCheckInRequest) (*AgentCheckInResponse, error) { if apiErr := validateCloudProviderName(cloudProvider); apiErr != nil { return nil, apiErr } @@ -293,13 +285,7 @@ type UpdateAccountConfigRequest struct { Config types.AccountConfig `json:"config"` } -func (c *Controller) UpdateAccountConfig( - ctx context.Context, - orgId string, - cloudProvider string, - accountId string, - req UpdateAccountConfigRequest, -) (*types.Account, *model.ApiError) { +func (c *Controller) UpdateAccountConfig(ctx context.Context, orgId string, cloudProvider string, accountId string, req UpdateAccountConfigRequest) (*types.Account, *model.ApiError) { if apiErr := validateCloudProviderName(cloudProvider); apiErr != nil { return nil, apiErr } @@ -316,9 +302,7 @@ func (c *Controller) UpdateAccountConfig( return &account, nil } -func (c *Controller) DisconnectAccount( - ctx context.Context, orgId string, cloudProvider string, accountId string, -) (*types.CloudIntegration, *model.ApiError) { +func (c *Controller) DisconnectAccount(ctx context.Context, orgId string, cloudProvider string, accountId string) (*types.CloudIntegration, *model.ApiError) { if apiErr := validateCloudProviderName(cloudProvider); apiErr != nil { return nil, apiErr } @@ -520,10 +504,8 @@ func (c *Controller) UpdateServiceConfig( // All dashboards that are available based on cloud integrations configuration // across all cloud providers -func (c *Controller) AvailableDashboards(ctx context.Context, orgId string) ( - []*types.Dashboard, *model.ApiError, -) { - allDashboards := []*types.Dashboard{} +func (c *Controller) AvailableDashboards(ctx context.Context, orgId valuer.UUID) ([]*dashboardtypes.Dashboard, *model.ApiError) { + allDashboards := []*dashboardtypes.Dashboard{} for _, provider := range []string{"aws"} { providerDashboards, apiErr := c.AvailableDashboardsForCloudProvider(ctx, orgId, provider) @@ -539,11 +521,8 @@ func (c *Controller) AvailableDashboards(ctx context.Context, orgId string) ( return allDashboards, nil } -func (c *Controller) AvailableDashboardsForCloudProvider( - ctx context.Context, orgID string, cloudProvider string, -) ([]*types.Dashboard, *model.ApiError) { - - accountRecords, apiErr := c.accountsRepo.listConnected(ctx, orgID, cloudProvider) +func (c *Controller) AvailableDashboardsForCloudProvider(ctx context.Context, orgID valuer.UUID, cloudProvider string) ([]*dashboardtypes.Dashboard, *model.ApiError) { + accountRecords, apiErr := c.accountsRepo.listConnected(ctx, orgID.StringValue(), cloudProvider) if apiErr != nil { return nil, model.WrapApiError(apiErr, "couldn't list connected cloud accounts") } @@ -554,7 +533,7 @@ func (c *Controller) AvailableDashboardsForCloudProvider( for _, ar := range accountRecords { if ar.AccountID != nil { configsBySvcId, apiErr := c.serviceConfigRepo.getAllForAccount( - ctx, orgID, ar.ID.StringValue(), + ctx, orgID.StringValue(), ar.ID.StringValue(), ) if apiErr != nil { return nil, apiErr @@ -573,16 +552,15 @@ func (c *Controller) AvailableDashboardsForCloudProvider( return nil, apiErr } - svcDashboards := []*types.Dashboard{} + svcDashboards := []*dashboardtypes.Dashboard{} for _, svc := range allServices { serviceDashboardsCreatedAt := servicesWithAvailableMetrics[svc.Id] if serviceDashboardsCreatedAt != nil { for _, d := range svc.Assets.Dashboards { - isLocked := 1 author := fmt.Sprintf("%s-integration", cloudProvider) - svcDashboards = append(svcDashboards, &types.Dashboard{ - UUID: c.dashboardUuid(cloudProvider, svc.Id, d.Id), - Locked: &isLocked, + svcDashboards = append(svcDashboards, &dashboardtypes.Dashboard{ + ID: c.dashboardUuid(cloudProvider, svc.Id, d.Id), + Locked: true, Data: *d.Definition, TimeAuditable: types.TimeAuditable{ CreatedAt: *serviceDashboardsCreatedAt, @@ -592,6 +570,7 @@ func (c *Controller) AvailableDashboardsForCloudProvider( CreatedBy: author, UpdatedBy: author, }, + OrgID: orgID, }) } servicesWithAvailableMetrics[svc.Id] = nil @@ -600,11 +579,7 @@ func (c *Controller) AvailableDashboardsForCloudProvider( return svcDashboards, nil } -func (c *Controller) GetDashboardById( - ctx context.Context, - orgId string, - dashboardUuid string, -) (*types.Dashboard, *model.ApiError) { +func (c *Controller) GetDashboardById(ctx context.Context, orgId valuer.UUID, dashboardUuid string) (*dashboardtypes.Dashboard, *model.ApiError) { cloudProvider, _, _, apiErr := c.parseDashboardUuid(dashboardUuid) if apiErr != nil { return nil, apiErr @@ -612,38 +587,28 @@ func (c *Controller) GetDashboardById( allDashboards, apiErr := c.AvailableDashboardsForCloudProvider(ctx, orgId, cloudProvider) if apiErr != nil { - return nil, model.WrapApiError( - apiErr, fmt.Sprintf("couldn't list available dashboards"), - ) + return nil, model.WrapApiError(apiErr, "couldn't list available dashboards") } for _, d := range allDashboards { - if d.UUID == dashboardUuid { + if d.ID == dashboardUuid { return d, nil } } - return nil, model.NotFoundError(fmt.Errorf( - "couldn't find dashboard with uuid: %s", dashboardUuid, - )) + return nil, model.NotFoundError(fmt.Errorf("couldn't find dashboard with uuid: %s", dashboardUuid)) } func (c *Controller) dashboardUuid( cloudProvider string, svcId string, dashboardId string, ) string { - return fmt.Sprintf( - "cloud-integration--%s--%s--%s", cloudProvider, svcId, dashboardId, - ) + return fmt.Sprintf("cloud-integration--%s--%s--%s", cloudProvider, svcId, dashboardId) } -func (c *Controller) parseDashboardUuid(dashboardUuid string) ( - cloudProvider string, svcId string, dashboardId string, apiErr *model.ApiError, -) { +func (c *Controller) parseDashboardUuid(dashboardUuid string) (cloudProvider string, svcId string, dashboardId string, apiErr *model.ApiError) { parts := strings.SplitN(dashboardUuid, "--", 4) if len(parts) != 4 || parts[0] != "cloud-integration" { - return "", "", "", model.BadRequest(fmt.Errorf( - "invalid cloud integration dashboard id", - )) + return "", "", "", model.BadRequest(fmt.Errorf("invalid cloud integration dashboard id")) } return parts[1], parts[2], parts[3], nil diff --git a/pkg/query-service/app/cloudintegrations/controller_test.go b/pkg/query-service/app/cloudintegrations/controller_test.go index ff86b868db..dec3849b1c 100644 --- a/pkg/query-service/app/cloudintegrations/controller_test.go +++ b/pkg/query-service/app/cloudintegrations/controller_test.go @@ -3,17 +3,23 @@ package cloudintegrations import ( "context" "testing" + "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest" "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/modules/user" - "github.com/SigNoz/signoz/pkg/modules/user/impluser" "github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/query-service/utils" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" + "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/google/uuid" "github.com/stretchr/testify/require" ) @@ -24,11 +30,16 @@ func TestRegenerateConnectionUrlWithUpdatedConfig(t *testing.T) { controller, err := NewController(sqlStore) require.NoError(err) - organizationModule := implorganization.NewModule(implorganization.NewStore(sqlStore)) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - userModule := impluser.NewModule(impluser.NewStore(sqlStore, providerSettings), nil, emailing, providerSettings) - user, apiErr := createTestUser(organizationModule, userModule) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlStore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Provider: "signoz", Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, sqlStore, orgGetter) + require.NoError(err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings, orgGetter, alertmanager) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) require.Nil(apiErr) // should be able to generate connection url for @@ -74,11 +85,17 @@ func TestAgentCheckIns(t *testing.T) { sqlStore := utils.NewQueryServiceDBForTests(t) controller, err := NewController(sqlStore) require.NoError(err) - organizationModule := implorganization.NewModule(implorganization.NewStore(sqlStore)) + providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - userModule := impluser.NewModule(impluser.NewStore(sqlStore, providerSettings), nil, emailing, providerSettings) - user, apiErr := createTestUser(organizationModule, userModule) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlStore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Provider: "signoz", Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, sqlStore, orgGetter) + require.NoError(err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings, orgGetter, alertmanager) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) require.Nil(apiErr) // An agent should be able to check in from a cloud account even @@ -164,11 +181,16 @@ func TestCantDisconnectNonExistentAccount(t *testing.T) { controller, err := NewController(sqlStore) require.NoError(err) - organizationModule := implorganization.NewModule(implorganization.NewStore(sqlStore)) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - userModule := impluser.NewModule(impluser.NewStore(sqlStore, providerSettings), nil, emailing, providerSettings) - user, apiErr := createTestUser(organizationModule, userModule) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlStore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Provider: "signoz", Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, sqlStore, orgGetter) + require.NoError(err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings, orgGetter, alertmanager) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) require.Nil(apiErr) // Attempting to disconnect a non-existent account should return error @@ -186,11 +208,16 @@ func TestConfigureService(t *testing.T) { controller, err := NewController(sqlStore) require.NoError(err) - organizationModule := implorganization.NewModule(implorganization.NewStore(sqlStore)) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - userModule := impluser.NewModule(impluser.NewStore(sqlStore, providerSettings), nil, emailing, providerSettings) - user, apiErr := createTestUser(organizationModule, userModule) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlStore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Provider: "signoz", Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, sqlStore, orgGetter) + require.NoError(err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings, orgGetter, alertmanager) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) require.Nil(apiErr) // create a connected account @@ -305,7 +332,7 @@ func makeTestConnectedAccount(t *testing.T, orgId string, controller *Controller return acc } -func createTestUser(organizationModule organization.Module, userModule user.Module) (*types.User, *model.ApiError) { +func createTestUser(organizationModule organization.Setter, userModule user.Module) (*types.User, *model.ApiError) { // Create a test user for auth ctx := context.Background() organization := types.NewOrganization("test") diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/alb/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/alb/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..e56d5e304a --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/alb/assets/dashboards/overview_dot.json @@ -0,0 +1,1887 @@ +{ + "description": "Overview of Application Load Balancers", + "image": "data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDg1IDg1IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIHhsaW5rOmhyZWY9IiNBIiB4PSIyLjUiIHk9IjIuNSIvPjxzeW1ib2wgaWQ9IkEiIG92ZXJmbG93PSJ2aXNpYmxlIj48ZyBzdHJva2U9Im5vbmUiPjxwYXRoIGQ9Ik0wIDQxLjU3OUMwIDIwLjI5MyAxNy44NCAzLjE1NyA0MCAzLjE1N3M0MCAxNy4xMzYgNDAgMzguNDIyUzYyLjE2IDgwIDQwIDgwIDAgNjIuODY0IDAgNDEuNTc5eiIgZmlsbD0iIzlkNTAyNSIvPjxwYXRoIGQ9Ik0wIDM4LjQyMkMwIDE3LjEzNiAxNy44NCAwIDQwIDBzNDAgMTcuMTM2IDQwIDM4LjQyMi0xNy44NCAzOC40MjItNDAgMzguNDIyUzAgNTkuNzA3IDAgMzguNDIyeiIgZmlsbD0iI2Y1ODUzNiIvPjxwYXRoIGQ9Ik01MS42NzIgNy4zODd2MTMuOTUySDI4LjMyN1Y3LjM4N3ptMTguMDYxIDQwLjM3OHYxMS4zNjRoLTExLjgzVjQ3Ljc2NXptLTE0Ljk1OCAwdjExLjM2NGgtMTEuODNWNDcuNzY1em0tMTguMjA2IDB2MTEuMzY0aC0xMS44M1Y0Ny43NjV6bS0xNC45NTkgMHYxMS4zNjRIOS43OFY0Ny43NjV6Ii8+PHBhdGggZD0iTTE0LjYzIDM3LjkyOWgyLjEzdjExLjE0OWgtMi4xM3oiLz48cGF0aCBkPSJNMTQuNjMgMzcuOTI5aDE3LjA4OHYyLjA0NUgxNC42M3oiLz48cGF0aCBkPSJNMjkuNTg5IDM3LjkyOWgyLjEzdjExLjE0OUgyOS41OXptMTguMjA2IDBoMi4xM3YxMS4xNDloLTIuMTN6Ii8+PHBhdGggZD0iTTQ3Ljc5NSAzNy45MjloMTcuMDg4djIuMDQ1SDQ3Ljc5NXoiLz48cGF0aCBkPSJNNjIuNzU0IDM3LjkyOWgyLjEzdjExLjE0OWgtMi4xMjl6bS00MC42MzEtNy45NTRoMi4xM3Y4Ljk3N2gtMi4xM3pNMzguOTM1IDE5LjI4aDIuMTN2MTAuODU5aC0yLjEyOXoiLz48cGF0aCBkPSJNMjIuMTIzIDI5LjExNmgzNS4zMnYyLjA0NWgtMzUuMzJ6Ii8+PHBhdGggZD0iTTU1LjMxNCAyOS45NzVoMi4xM3Y4Ljk3N2gtMi4xMjl6Ii8+PC9nPjwvc3ltYm9sPjwvc3ZnPg==", + "layout": [ + { + "h": 5, + "i": "e13232f0-6308-4466-94c0-629cae762ff0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "9b99d70a-f12a-4df7-9a68-660a0ab55e42", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "5a9ec75f-3bcd-4829-94e6-452caa2cc0d2", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "e16fb999-491b-4cfa-b9aa-d558f2132b6b", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "2be35406-693a-435b-a844-2df239be0b60", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "480ecee2-1271-4dfd-a7bb-9f9845957c6e", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "2243e542-0bbc-4e2a-a4dd-2e121abc9b95", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "3bb56361-9a67-47ce-b186-ccee02e15f51", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 5, + "i": "36cbc321-6c02-4d13-895e-955d71d376b4", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 20 + } + ], + "panelMap": {}, + "tags": [], + "title": "Application Load Balancer Overview", + "uploadedGrafana": false, + "variables": { + "Account": { + "allSelected": false, + "customValue": "", + "description": "AWS Account", + "id": "d5ef5880-68b1-4097-b4e5-9ce74200831f", + "key": "d5ef5880-68b1-4097-b4e5-9ce74200831f", + "modificationUUID": "9974ddda-3bc1-401d-b04a-364ea9a23866", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.account.id') as `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_ApplicationELB_ConsumedLCUs_max'\nGROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "Region": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "bad33abd-ab38-493b-b23e-131659b6d03c", + "key": "bad33abd-ab38-493b-b23e-131659b6d03c", + "modificationUUID": "1aa1ef37-260c-4ca9-8aa9-f2ffb289c9e3", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.region') as `cloud.region`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_ApplicationELB_ConsumedLCUs_max'\n and JSONExtractString(labels, 'cloud.account.id') IN {{.Account}}\nGROUP BY `cloud.region`\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The time elapsed, after the request leaves the load balancer until the target starts to send the response headers.\n\nSee TargetResponseTime at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "9b99d70a-f12a-4df7-9a68-660a0ab55e42", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_TargetResponseTime_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_TargetResponseTime_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b282d9f1", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "71837c70", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "5bfcc581", + "key": { + "dataType": "string", + "id": "TargetGroup--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TargetGroup", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "a9e33e08", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "601aca8a-36fb-4e6a-b234-39294b9b305b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Target Response Time", + "yAxisUnit": "s" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of requests processed over IPv4 and IPv6. This metric is only incremented for requests where the load balancer node was able to choose a target. Requests that are rejected before a target is chosen are not reflected in this metric.\n\nSee RequestCount at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "e13232f0-6308-4466-94c0-629cae762ff0", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_RequestCount_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_RequestCount_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "448b551a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "a8821216", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "f5a62c5a", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "25e8abc8", + "key": { + "dataType": "string", + "id": "TargetGroup--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TargetGroup", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7d92a02f-3202-4059-8b88-2d24112a35e6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Requests", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of HTTP 5XX response codes generated by the targets. This does not include any response codes generated by the load balancer.\n\nSee HTTPCode_Target_5XX_Count at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "5a9ec75f-3bcd-4829-94e6-452caa2cc0d2", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_HTTPCode_Target_5XX_Count_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_HTTPCode_Target_5XX_Count_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "702a8765", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "32985f2d", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "e4cf3d8b", + "key": { + "dataType": "string", + "id": "TargetGroup--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TargetGroup", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "234c77fd", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a1cc5b1c-adb6-4a71-bb6e-99337ef6a9d4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "aws_ApplicationELB_HTTPCode_Target_5XX_Count_sum{TargetGroup=\"\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Target 5XX", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of HTTP 5XX server error codes that originate from the load balancer. This count does not include any response codes generated by the targets.\n\nSee HTTPCode_ELB_5XX_Count at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "e16fb999-491b-4cfa-b9aa-d558f2132b6b", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_HTTPCode_ELB_5XX_Count_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_HTTPCode_ELB_5XX_Count_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5807a1e3", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "0dd63d0c", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "31ccfbae", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "91d000c1-7697-4219-acb6-a43a5d455834", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Loadbalancer 5XX", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The total number of concurrent TCP connections active from clients to the load balancer and from the load balancer to targets.\n\nSee ActiveConnectionCount at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "2be35406-693a-435b-a844-2df239be0b60", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_ActiveConnectionCount_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_ActiveConnectionCount_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "72c256c0", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b433c2a1", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "8f5e7de0", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "74429f26-2fe0-46f2-8b11-23c4f00a260a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Active Connections", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of connections that were not successfully established between the load balancer and target. This metric does not apply if the target is a Lambda function. This metric is not incremented for unsuccessful health check connections.\n\nSee TargetConnectionErrorCount at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "480ecee2-1271-4dfd-a7bb-9f9845957c6e", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_TargetConnectionErrorCount_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_TargetConnectionErrorCount_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "9226a37c", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "c3ff0c8f", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "e3317bc2", + "key": { + "dataType": "", + "isColumn": false, + "key": "TargetGroup", + "type": "" + }, + "op": "nexists", + "value": "" + }, + { + "id": "4e5c2324", + "key": { + "dataType": "", + "isColumn": false, + "key": "AvailabilityZone", + "type": "" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "148daebb-8ae4-4a9f-b569-5e0e75f6b52d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Target Connection Errors", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of load balancer capacity units (LCU) used by your load balancer. You pay for the number of LCUs that you use per hour. When LCU reservation is active, ConsumedLCUs will report 0 if usage is below the reserved capacity, and will report values above 0 if usage exceeds the reserved LCUs\n\nSee ConsumedLCUs at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "2243e542-0bbc-4e2a-a4dd-2e121abc9b95", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_ConsumedLCUs_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_ConsumedLCUs_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "20627274", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "cd861e27", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "38594221-7a5b-4d94-8775-26297f6cb882", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Consumed LCUs", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The total number of bytes processed by the load balancer over IPv4 and IPv6 (HTTP header and HTTP payload). This count includes traffic to and from clients and Lambda functions, and traffic from an Identity Provider (IdP) if user authentication is enabled.\n\nSee ProcessedBytes at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "3bb56361-9a67-47ce-b186-ccee02e15f51", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_ProcessedBytes_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_ProcessedBytes_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d4a3494", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "3c307858", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "fbca8724", + "key": { + "dataType": "string", + "id": "AvailabilityZone--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "AvailabilityZone", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e71d1223-7441-4a5d-b288-928a2903737d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Processed Bytes", + "yAxisUnit": "bytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The maximum number of load balancer capacity units (LCU) used by your load balancer at a given point in time. Only applicable when using LCU Reservation.\n\nSee PeakLCUs at https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html", + "fillSpans": false, + "id": "36cbc321-6c02-4d13-895e-955d71d376b4", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApplicationELB_PeakLCUs_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApplicationELB_PeakLCUs_sum", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a416e862", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "ed7d0a39", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "LoadBalancer--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "LoadBalancer", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{LoadBalancer}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c4728417-0c3c-4477-b8bd-0a2de16c342a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Peak LCUs", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/api-gateway/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/api-gateway/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..9906e2335a --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/api-gateway/assets/dashboards/overview_dot.json @@ -0,0 +1,1441 @@ +{ + "description": "Overview of API Gateway resources in a region", + "image": "data:image/svg+xml,%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3ClinearGradient%20x1%3D%220%25%22%20y1%3D%22100%25%22%20x2%3D%22100%25%22%20y2%3D%220%25%22%20id%3D%22linearGradient-1%22%3E%3Cstop%20stop-color%3D%22%234D27A8%22%20offset%3D%220%25%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23A166FF%22%20offset%3D%22100%25%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cg%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20fill%3D%22url(%23linearGradient-1)%22%3E%3Crect%20id%3D%22Rectangle%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2224%22%20height%3D%2224%22%3E%3C%2Frect%3E%3C%2Fg%3E%3Cpath%20d%3D%22M6%2C6.76751613%20L8%2C5.43446738%20L8%2C18.5659476%20L6%2C17.2328988%20L6%2C6.76751613%20Z%20M5%2C6.49950633%20L5%2C17.4999086%20C5%2C17.6669147%205.084%2C17.8239204%205.223%2C17.9159238%20L8.223%2C19.9159969%20C8.307%2C19.971999%208.403%2C20%208.5%2C20%20C8.581%2C20%208.662%2C19.9809993%208.736%2C19.9409978%20C8.898%2C19.8539947%209%2C19.6849885%209%2C19.4999817%20L9%2C16.9998903%20L10%2C16.9998903%20L10%2C15.9998537%20L9%2C15.9998537%20L9%2C7.99956118%20L10%2C7.99956118%20L10%2C6.99952461%20L9%2C6.99952461%20L9%2C4.49943319%20C9%2C4.31542646%208.898%2C4.14542025%208.736%2C4.0594171%20C8.574%2C3.97241392%208.377%2C3.98141425%208.223%2C4.08341798%20L5.223%2C6.08349112%20C5.084%2C6.17649452%205%2C6.33250022%205%2C6.49950633%20L5%2C6.49950633%20Z%20M19%2C17.2328988%20L17%2C18.5659476%20L17%2C5.43446738%20L19%2C6.76751613%20L19%2C17.2328988%20Z%20M19.777%2C6.08349112%20L16.777%2C4.08341798%20C16.623%2C3.98141425%2016.426%2C3.97241392%2016.264%2C4.0594171%20C16.102%2C4.14542025%2016%2C4.31542646%2016%2C4.49943319%20L16%2C6.99952461%20L15%2C6.99952461%20L15%2C7.99956118%20L16%2C7.99956118%20L16%2C15.9998537%20L15%2C15.9998537%20L15%2C16.9998903%20L16%2C16.9998903%20L16%2C19.4999817%20C16%2C19.6849885%2016.102%2C19.8539947%2016.264%2C19.9409978%20C16.338%2C19.9809993%2016.419%2C20%2016.5%2C20%20C16.597%2C20%2016.693%2C19.971999%2016.777%2C19.9159969%20L19.777%2C17.9159238%20C19.916%2C17.8239204%2020%2C17.6669147%2020%2C17.4999086%20L20%2C6.49950633%20C20%2C6.33250022%2019.916%2C6.17649452%2019.777%2C6.08349112%20L19.777%2C6.08349112%20Z%20M13%2C7.99956118%20L14%2C7.99956118%20L14%2C6.99952461%20L13%2C6.99952461%20L13%2C7.99956118%20Z%20M11%2C7.99956118%20L12%2C7.99956118%20L12%2C6.99952461%20L11%2C6.99952461%20L11%2C7.99956118%20Z%20M13%2C16.9998903%20L14%2C16.9998903%20L14%2C15.9998537%20L13%2C15.9998537%20L13%2C16.9998903%20Z%20M11%2C16.9998903%20L12%2C16.9998903%20L12%2C15.9998537%20L11%2C15.9998537%20L11%2C16.9998903%20Z%20M13.18%2C14.884813%20L10.18%2C12.3847215%20C10.065%2C12.288718%2010%2C12.1487129%2010%2C11.9997075%20C10%2C11.851702%2010.065%2C11.7106969%2010.18%2C11.6156934%20L13.18%2C9.11560199%20L13.82%2C9.88463011%20L11.281%2C11.9997075%20L13.82%2C14.1157848%20L13.18%2C14.884813%20Z%22%20id%3D%22Amazon-API-Gateway_Icon_16_Squid%22%20fill%3D%22%23FFFFFF%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E", + "layout": [ + { + "h": 6, + "i": "b27e332f-8e3f-487a-845d-e332dc1464c3", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "d0a54459-0841-467f-88f7-e135b8c86fc7", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "210dc175-fbb7-44ef-88e0-b8530da4eaca", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "8efb6639-6168-4d8b-9b4f-5b5c82dea333", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 6, + "i": "88f56881-7744-41e9-9c19-9f5446e291dc", + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "d3b4ad8b-7b52-4bea-9bc7-47e18da7f38c", + "w": 6, + "x": 6, + "y": 12 + } + ], + "panelMap": {}, + "tags": [], + "title": "API Gateway Overview", + "uploadedGrafana": false, + "variables": { + "Account": { + "allSelected": false, + "customValue": "", + "description": "AWS Account", + "id": "93447e60-3b35-407c-a86c-97254f641628", + "key": "93447e60-3b35-407c-a86c-97254f641628", + "modificationUUID": "5e1f8a79-e9b5-4230-af48-f2c117805b31", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.account.id') as `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_ApiGateway_Count_sum'\nGROUP BY `cloud.account.id`\n\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "Region": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "613f7913-ace1-4cf5-bb4c-df91878ec40e", + "key": "613f7913-ace1-4cf5-bb4c-df91878ec40e", + "modificationUUID": "bb86427a-e4da-4440-93d3-0f53e65214ed", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.region') as `cloud.region`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_ApiGateway_Count_sum'\n and JSONExtractString(labels, 'cloud.account.id') IN {{.Account}}\nGROUP BY `cloud.region`\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The total number API requests in a given period.\n\nSee Count at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "b27e332f-8e3f-487a-845d-e332dc1464c3", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_Count_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_Count_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d3e9ea95", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "64c4ab5b", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "2f4571a4", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "be3cf524", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "81918ce2", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "114c7ff4", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9fea4bca-7c22-49b6-8d24-43c985d89ac3", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Requests", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration latency and other API Gateway overhead.\n\nSee Latency at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "d0a54459-0841-467f-88f7-e135b8c86fc7", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_Latency_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_Latency_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "4b55a919", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "01c610d9", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "f102e7f0", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "0053bd12", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "3c67d1fc", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "e2a96f23", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7b85940b-ac14-40da-9764-0fbb9c3cad31", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Latency", + "yAxisUnit": "ms" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of server-side errors captured in a given period.\n\nSee 5XXError at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "210dc175-fbb7-44ef-88e0-b8530da4eaca", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_5XXError_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_5XXError_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3e4a6042", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "5702170a", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "9835e4d9", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "c986fbbe", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "b3ebaf28", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "f2030d94", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ec0786eb-fb13-46eb-813b-c516bac57395", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "5XX Errors", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The time between when API Gateway relays a request to the backend and when it receives a response from the backend.\n\nSee IntegrationLatency at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "8efb6639-6168-4d8b-9b4f-5b5c82dea333", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_IntegrationLatency_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_IntegrationLatency_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1a3f91b4", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "33d0afbd", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "f818f0fc", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "a090cf40", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "5f2f2892", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "960ee6d2", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c1c0f0e6-712d-430e-9e76-af752b1dc09f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Integration Latency", + "yAxisUnit": "ms" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of requests served from the API cache in a given period.\n\nSee CacheHitCount at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "88f56881-7744-41e9-9c19-9f5446e291dc", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_CacheHitCount_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_CacheHitCount_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "8016ef52", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "6abb9f32", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "86a54806", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "1e5b50b4", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "8ec09e30", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "d1622884", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "39a206dd-298c-4560-b3da-83a029cf3423", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Cache Hits", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of requests served from the backend in a given period, when API caching is enabled.\n\nSee CacheMissCount at https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html for more details", + "fillSpans": false, + "id": "d3b4ad8b-7b52-4bea-9bc7-47e18da7f38c", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ApiGateway_CacheMissCount_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ApiGateway_CacheMissCount_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6cbbb46e", + "key": { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "4dfbfe25", + "key": { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "24f91927", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "f03b27a8", + "key": { + "dataType": "string", + "id": "Method--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Method", + "type": "tag" + }, + "op": "nexists", + "value": "" + }, + { + "id": "f02d484d", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4d8ddc75", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ApiName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ApiName", + "type": "tag" + }, + { + "dataType": "string", + "id": "Stage--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Stage", + "type": "tag" + } + ], + "having": [], + "legend": "{{ApiName}} - {{Stage}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a5ef38e5-16a0-41c1-82b3-b6480ec4e524", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Cache Misses", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/dynamodb/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/dynamodb/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..8d29059660 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/dynamodb/assets/dashboards/overview_dot.json @@ -0,0 +1,2657 @@ +{ + "description": "View DynamoDB metrics with an out-of-the-box dashboard.", + "image":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDY0ICg5MzUzNykgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+SWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tRHluYW1vREJfNjQ8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjAlIiB5MT0iMTAwJSIgeDI9IjEwMCUiIHkyPSIwJSIgaWQ9ImxpbmVhckdyYWRpZW50LTEiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMkUyN0FEIiBvZmZzZXQ9IjAlIj48L3N0b3A+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiM1MjdGRkYiIG9mZnNldD0iMTAwJSI+PC9zdG9wPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0iSWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tRHluYW1vREJfNjQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJJY29uLUFyY2hpdGVjdHVyZS1CRy82NC9EYXRhYmFzZSIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSI+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUiIHg9IjAiIHk9IjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCI+PC9yZWN0PgogICAgICAgIDwvZz4KICAgICAgICA8cGF0aCBkPSJNNTIuMDg1OTUyNSw1NC44NTAyNTA2IEM0OC43NDc5NTY5LDU3LjU0OTAzMzggNDEuNzQ0OTY2MSw1OC45NzUyOTI3IDM1LjA0Mzk3NDksNTguOTc1MjkyNyBDMjguMzQxOTgzOCw1OC45NzUyOTI3IDIxLjMzNjk5Myw1Ny41NDgwNDIgMTcuOTk5OTk3NCw1NC44NDkyNTg4IEwxNy45OTk5OTc0LDYwLjI4NDUxNSBMMTguMDAwOTk3NCw2MC4yODQ1MTUgQzE4LjAwMDk5NzQsNjIuOTk1MjAwMiAyNC45OTk5OTc0LDY2LjAxNjMyOTkgMzUuMDQzOTc0OSw2Ni4wMTYzMjk5IEM0NS4wNzk5NjE3LDY2LjAxNjMyOTkgNTIuMDc0OTUyNSw2Mi45OTkxNjc2IDUyLjA4NTk1MjUsNjAuMjkwNDY2IEw1Mi4wODU5NTI1LDU0Ljg1MDI1MDYgWiBNNTIuMDg2OTUyNSw0NC41MjIyNzIgTDU0LjA4Njk0OTksNDQuNTExMzYxOCBMNTQuMDg2OTQ5OSw0NC41MjIyNzIgQzU0LjA4Njk0OTksNDUuNzMwMzI3MSA1My40ODE5NTA3LDQ2Ljg1ODA0MzYgNTIuMzAzOTUyMiw0Ny44OTA1NDM5IEM1My43MzE5NTAzLDQ5LjE0NzE5OSA1NC4wODY5NDk5LDUwLjM4MDA0OTkgNTQuMDg2OTQ5OSw1MS4yNTc4MjQgQzU0LjA4Njk0OTksNTEuMjYzNzc1IDU0LjA4NTk0OTksNTEuMjY4NzM0MiA1NC4wODU5NDk5LDUxLjI3NDY4NTIgTDU0LjA4NTk0OTksNjAuMjg0NTE1IEw1NC4wODY5NDk5LDYwLjI4NDUxNSBDNTQuMDg2OTQ5OSw2NS4yOTUyNjU4IDQ0LjI3NDk2MjgsNjggMzUuMDQzOTc0OSw2OCBDMjUuODM0OTg3MSw2OCAxNi4wNDk5OTk5LDY1LjMwNzE2NzggMTYuMDAzLDYwLjMxOTIyOTIgQzE2LjAwMyw2MC4zMTQyNyAxNiw2MC4zMDkzMTA5IDE2LDYwLjMwNDM1MTcgTDE2LDUxLjI1NDg0ODUgQzE2LDUxLjI1Mjg2NDggMTYuMDAyLDUxLjI0OTg4OTMgMTYuMDAyLDUxLjI0NjkxMzggQzE2LjAwNSw1MC4zNjkxMzk4IDE2LjM2MDk5OTUsNDkuMTQxMjQ3OSAxNy43ODY5OTc2LDQ3Ljg4NzU2ODQgQzE2LjM2OTk5OTUsNDYuNjM1ODcyNSAxNi4wMSw0NS40MTQ5MjM2IDE2LjAwMSw0NC41NDQwOTI0IEwxNi4wMDIsNDQuNTQ0MDkyNCBDMTYuMDAyLDQ0LjU0MDEyNSAxNiw0NC41MzcxNDk1IDE2LDQ0LjUzMzE4MjIgTDE2LDM1LjQ4MzY3OSBDMTYsMzUuNDgwNzAzNSAxNi4wMDIsMzUuNDc3NzI4IDE2LjAwMiwzNS40NzQ3NTI1IEMxNi4wMDUsMzQuNTk2OTc4NCAxNi4zNjE5OTk1LDMzLjM2OTA4NjYgMTcuNzg3OTk3NiwzMi4xMTczOTA4IEMxNi4zNjk5OTk1LDMwLjg2NDcwMzEgMTYuMDEsMjkuNjQyNzYyMyAxNi4wMDEsMjguNzcyOTIyOSBMMTYuMDAyLDI4Ljc3MjkyMjkgQzE2LjAwMiwyOC43Njg5NTU2IDE2LDI4Ljc2NDk4ODIgMTYsMjguNzYxMDIwOSBMMTYsMTkuNzEyNTA5NSBDMTYsMTkuNzA5NTM0IDE2LjAwMiwxOS43MDY1NTg1IDE2LjAwMiwxOS43MDM1ODMgQzE2LjAxOSwxNC42OTk3NzUxIDI1LjgxOTk4NzEsMTIgMzUuMDQzOTc0OSwxMiBDNDAuMjU0OTY4MSwxMiA0NS4yNjA5NjE1LDEyLjgyODE4MjMgNDguNzc3OTU2OSwxNC4yNzIyOTQxIEw0OC4wMTI5NTc5LDE2LjEwNTIwNTQgQzQ0LjcyOTk2MjIsMTQuNzU3MzAxNSA0MC4wMDI5Njg0LDEzLjk4MzY3MDEgMzUuMDQzOTc0OSwxMy45ODM2NzAxIEMyNC45OTk5ODgyLDEzLjk4MzY3MDEgMTguMDAwOTk3NCwxNy4wMDQ3OTk4IDE4LjAwMDk5NzQsMTkuNzE3NDY4NyBDMTguMDAwOTk3NCwyMi40MjkxNDU4IDI0Ljk5OTk4ODIsMjUuNDUwMjc1NCAzNS4wNDM5NzQ5LDI1LjQ1MDI3NTQgQzM1LjMxNDk3NDYsMjUuNDUzMjUwOSAzNS41Nzk5NzQyLDI1LjQ1MDI3NTQgMzUuODQ3OTczOSwyNS40NDAzNTcxIEwzNS45MzE5NzM4LDI3LjQyMjA0MzUgQzM1LjYzNTk3NDIsMjcuNDMzOTQ1NiAzNS4zMzk5NzQ1LDI3LjQzMzk0NTYgMzUuMDQzOTc0OSwyNy40MzM5NDU2IEMyOC4zNDE5ODM4LDI3LjQzMzk0NTYgMjEuMzM2OTkzLDI2LjAwNjY5NDkgMTgsMjMuMzA3OTExNyBMMTgsMjguNzQwMTkyMyBMMTguMDAwOTk3NCwyOC43NDAxOTIzIEwxOC4wMDA5OTc0LDI4Ljc2MzAwNDYgQzE4LjAxMDk5NzQsMjkuODAzNDM5NSAxOS4wNzc5OTU5LDMwLjcxMTk2MDUgMTkuOTcxOTk0OCwzMS4yODkyMDg1IEMyMi42NjE5OTEyLDMzLjAwNDA5MTMgMjcuNDgxOTg0OSwzNC4xNzU0NDg1IDMyLjg1Njk3NzgsMzQuNDE4NDQ4MSBMMzIuNzY1OTc3OSwzNi40MDAxMzQ2IEMyNy4zMjA5ODUxLDM2LjE1MzE2NzcgMjIuNTUyOTkxNCwzNS4wMjM0Njc1IDE5LjQ4Mzk5NTQsMzMuMjkxNzIzNSBDMTguNzI3OTk2NCwzMy44NTcwNjk1IDE4LjAwMDk5NzQsMzQuNjIxNzc0MyAxOC4wMDA5OTc0LDM1LjQ4ODYzODIgQzE4LjAwMDk5NzQsMzguMjAwMzE1MyAyNC45OTk5ODgyLDQxLjIyMTQ0NDkgMzUuMDQzOTc0OSw0MS4yMjE0NDQ5IEMzNi4wMjg5NzM2LDQxLjIyMTQ0NDkgMzcuMDA2OTcyMyw0MS4xODg3MTQzIDM3Ljk1MTk3MTEsNDEuMTIzMjUzMiBMMzguMDkwOTcwOSw0My4xMDE5NjQyIEMzNy4xMDA5NzIyLDQzLjE3MDQwMDggMzYuMDc0OTczNiw0My4yMDUxMTUgMzUuMDQzOTc0OSw0My4yMDUxMTUgQzI4LjM0MTk4MzgsNDMuMjA1MTE1IDIxLjMzNjk5Myw0MS43Nzc4NjQ0IDE4LDM5LjA3OTA4MTEgTDE4LDQ0LjUxMTM2MTggTDE4LjAwMDk5NzQsNDQuNTExMzYxOCBDMTguMDEwOTk3NCw0NS41NzQ2MDkgMTkuMDc3OTk1OSw0Ni40ODIxMzgxIDE5Ljk3MTk5NDgsNDcuMDYwMzc4IEMyMy4wNDc5OTA3LDQ5LjAyMzIxOTYgMjguODIzOTgzMSw1MC4yNDUxNjA0IDM1LjA0Mzk3NDksNTAuMjQ1MTYwNCBMMzUuNDgzOTc0NCw1MC4yNDUxNjA0IEwzNS40ODM5NzQ0LDUyLjIyODgzMDUgTDM1LjA0Mzk3NDksNTIuMjI4ODMwNSBDMjguNzI0OTgzMiw1Mi4yMjg4MzA1IDIyLjk4MTk5MDgsNTEuMDU1NDg5NiAxOS40Njk5OTU0LDQ5LjA3MjgxMTMgQzE4LjcxNzk5NjQsNDkuNjM3MTY1NSAxOC4wMDA5OTc0LDUwLjM5NzkwMyAxOC4wMDA5OTc0LDUxLjI1NzgyNCBDMTguMDAwOTk3NCw1My45Njk1MDExIDI0Ljk5OTk4ODIsNTYuOTkxNjIyNSAzNS4wNDM5NzQ5LDU2Ljk5MTYyMjUgQzQ1LjA3OTk2MTcsNTYuOTkxNjIyNSA1Mi4wNzQ5NTI1LDUzLjk3NDQ2MDIgNTIuMDg1OTUyNSw1MS4yNjQ3NjY4IEw1Mi4wODU5NTI1LDUxLjI1NDg0ODUgTDUyLjA4NTk1MjUsNTEuMjUzODU2NiBDNTIuMDgzOTUyNSw1MC4zOTE5NTIgNTEuMzYzOTUzNCw0OS42MzEyMTQ1IDUwLjYwOTk1NDQsNDkuMDY2ODYwMyBDNTAuMTIxOTU1MSw0OS4zNDM1ODIzIDQ5LjU5ODk1NTgsNDkuNjEwMzg1OSA0OS4wMDM5NTY2LDQ5Ljg1NTM2OTIgTDQ4LjIzNzk1NzYsNDguMDIyNDU4IEM0OC45NjM5NTY2LDQ3LjcyMzkxNTYgNDkuNTkzOTU1OCw0Ny40MDE1NjkyIDUwLjExMDk1NTEsNDcuMDYyMzYxNiBDNTEuMDEyOTUzOSw0Ni40NzQyMDM0IDUyLjA4Njk1MjUsNDUuNTU0NzcyMyA1Mi4wODY5NTI1LDQ0LjUyMjI3MiBMNTIuMDg2OTUyNSw0NC41MjIyNzIgWiBNNjAuNjUyOTQxMiwzMC4wMTY2ODQxIEw1NS4wNDg5NDg2LDMwLjAxNjY4NDEgQzU0LjcxNzk0OSwzMC4wMTY2ODQxIDU0LjQwNjk0OTQsMjkuODU0MDIzMSA1NC4yMjE5NDk3LDI5LjU4MjI2MDMgQzU0LjAzNDk0OTksMjkuMzEwNDk3NSA1My45OTY5NSwyOC45NjQzNDcxIDU0LjExODk0OTgsMjguNjU5ODUzNyBMNTcuNTI3OTQ1MywyMC4xMzgwMDY4IEw0NC42MTg5NzAyLDIwLjEzODAwNjggTDM4LjYxODk3MDIsMzIuMDQwMDI3NiBMNDUuMDAwOTYxOCwzMi4wNDAwMjc2IEM0NS4zMTk5NjE0LDMyLjA0MDAyNzYgNDUuNjE5OTYxLDMyLjE5MTc3ODQgNDUuODA4OTYwOCwzMi40NDY2OCBDNDUuOTk1OTYwNSwzMi43MDI1NzM1IDQ2LjA1MDk2MDQsMzMuMDMwODcwOSA0NS45NTM5NjA2LDMzLjMzMzM4MDYgTDQwLjI1Nzk2ODEsNTEuMDg5MjEyIEw2MC42NTI5NDEyLDMwLjAxNjY4NDEgWiBNNjMuNzIxOTM3MiwyOS43MTIxOTA3IEwzOC43MjI5NzAxLDU1LjUzOTU3NiBDMzguNTI3OTcwMyw1NS43Mzk5MjY3IDM4LjI2NTk3MDcsNTUuODQ0MDY5NCAzOC4wMDA5NzEsNTUuODQ0MDY5NCBDMzcuODI0OTcxMyw1NS44NDQwNjk0IDM3LjY0Nzk3MTUsNTUuNzk5NDM2OCAzNy40ODk5NzE3LDU1LjcwNTIxMjQgQzM3LjA4OTk3MjIsNTUuNDY5MTU1NyAzNi45MDY5NzI1LDU0Ljk5MjA4MyAzNy4wNDc5NzIzLDU0LjU1MTcwODMgTDQzLjYzMzk2MzYsMzQuMDIzNjk3OCBMMzcuMDAwOTcyNCwzNC4wMjM2OTc4IEMzNi42NTM5NzI4LDM0LjAyMzY5NzggMzYuMzMyOTczMiwzMy44NDYxNTkzIDM2LjE0OTk3MzUsMzMuNTUzNTY3OSBDMzUuOTY3OTczNywzMy4yNjA5NzY2IDM1Ljk1MDk3MzcsMzIuODk1OTgxMyAzNi4xMDY5NzM1LDMyLjU4ODUxMjQgTDQzLjEwNjk2NDMsMTguNzAyODIxNCBDNDMuMjc1OTY0MSwxOC4zNjY1ODkzIDQzLjYyMTk2MzYsMTguMTU0MzM2NiA0NC4wMDA5NjMxLDE4LjE1NDMzNjYgTDU5LjAwMDk0MzQsMTguMTU0MzM2NiBDNTkuMzMxOTQzLDE4LjE1NDMzNjYgNTkuNjQyOTQyNSwxOC4zMTc5ODk0IDU5LjgyNzk0MjMsMTguNTg4NzYwNCBDNjAuMDE0OTQyMSwxOC44NjE1MTUgNjAuMDUyOTQyLDE5LjIwNjY3MzYgNTkuOTMwOTQyMiwxOS41MTIxNTg4IEw1Ni41MjE5NDY3LDI4LjAzMzAxMzkgTDYyLjk5OTkzODEsMjguMDMzMDEzOSBDNjMuMzk5OTM3NiwyOC4wMzMwMTM5IDYzLjc2MjkzNzEsMjguMjcxMDU0NCA2My45MTk5MzY5LDI4LjYzNjA0OTcgQzY0LjA3NjkzNjcsMjkuMDAyMDM2OCA2My45OTg5MzY4LDI5LjQyNTU1MDQgNjMuNzIxOTM3MiwyOS43MTIxOTA3IEw2My43MjE5MzcyLDI5LjcxMjE5MDcgWiBNMTkuNDU0OTk1NSw2MC42NzQzMDYyIEMyMC44NzE5OTM2LDYxLjQ3MjczMzQgMjIuNjU1OTkxMiw2Mi4xNDQyMDU3IDI0Ljc1Njk4ODUsNjIuNjY3ODk0NyBMMjUuMjQ0OTg3OCw2MC43NDM3MzQ2IEMyMy4zNDU5OTAzLDYwLjI3MDYyOTMgMjEuNjg1OTkyNSw1OS42NDk3NDA1IDIwLjQ0Mjk5NDIsNTguOTQ5NTA1IEwxOS40NTQ5OTU1LDYwLjY3NDMwNjIgWiBNMjQuNzU2OTg4NSw0Ni43OTg1MzM1IEwyNS4yNDQ5ODc4LDQ0Ljg3NTM2NTMgQzIzLjM0NTk5MDMsNDQuNDAxMjY4MSAyMS42ODU5OTI1LDQzLjc4MDM3OTQgMjAuNDQyOTk0Miw0My4wODAxNDM4IEwxOS40NTQ5OTU1LDQ0LjgwNDk0NSBDMjAuODcxOTkzNiw0NS42MDMzNzIyIDIyLjY1NDk5MTIsNDYuMjc0ODQ0NiAyNC43NTY5ODg1LDQ2Ljc5ODUzMzUgTDI0Ljc1Njk4ODUsNDYuNzk4NTMzNSBaIE0xOS40NTQ5OTU1LDI4LjkzNTU4MzkgTDIwLjQ0Mjk5NDIsMjcuMjEwNzgyNyBDMjEuNjgzOTkyNSwyNy45MTEwMTgyIDIzLjM0NDk5MDMsMjguNTMwOTE1MSAyNS4yNDQ5ODc4LDI5LjAwNjAwNDEgTDI0Ljc1Njk4ODUsMzAuOTI5MTcyMyBDMjIuNjUyOTkxMiwzMC40MDQ0OTE2IDIwLjg2OTk5MzYsMjkuNzMzMDE5MyAxOS40NTQ5OTU1LDI4LjkzNTU4MzkgTDE5LjQ1NDk5NTUsMjguOTM1NTgzOSBaIiBpZD0iQW1hem9uLUR5bmFtb0RCX0ljb25fNjRfU3F1aWQiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+", + "layout": [ + { + "h": 6, + "i": "9e1d91ec-fb66-4cff-b5c5-282270ebffb5", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "9a2daf2e-39bc-445d-947f-617c27fadd0f", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "5b50997d-3bca-466a-bdeb-841b2e49fd65", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "889c36ab-4d0c-4328-9c3c-6558aad6be89", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 6, + "i": "0c3b97fe-56e0-4ce6-99f4-fd1cbd24f93e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "70980d38-ee3c-47be-9520-e371df3b021a", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + }, + { + "h": 6, + "i": "fe1b71b5-1a3f-41c0-b6c2-46bf934787ad", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 18 + }, + { + "h": 6, + "i": "cc0938a5-af82-4bd8-b10e-67eabe717ee0", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 18 + }, + { + "h": 6, + "i": "4bb63c27-5eb4-4904-9947-42ffce15e92e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 24 + }, + { + "h": 6, + "i": "5ffbe527-8cf3-4ed8-ac2d-8739fa7fa9af", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 24 + }, + { + "h": 6, + "i": "a02f64ac-e73e-4d4c-a26b-fcfc4265c148", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 30 + }, + { + "h": 6, + "i": "014e377d-b7c1-4469-a137-be34d7748f31", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 30 + }, + { + "h": 6, + "i": "b1b75926-7308-43b3-bcad-60f369715f0b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 36 + }, + { + "h": 6, + "i": "90f4d19d-8785-4a7a-97cf-c967108e1487", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 36 + }, + { + "h": 6, + "i": "5412cdad-174b-462b-916e-4e3de477446b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 42 + } + ], + "panelMap": {}, + "tags": [], + "title": "DynamoDB Overview", + "uploadedGrafana": false, + "variables": { + "1f7a94df-9735-4bfa-a1b8-dca8ac29f945": { + "allSelected": false, + "customValue": "", + "description": "Account Region", + "id": "1f7a94df-9735-4bfa-a1b8-dca8ac29f945", + "key": "1f7a94df-9735-4bfa-a1b8-dca8ac29f945", + "modificationUUID": "8ef772a1-7df9-46a2-84e7-ab0c0bfc6886", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name like '%aws_DynamoDB%' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "93ee15bf-baab-4abf-8828-fe6e75518417": { + "allSelected": false, + "customValue": "", + "description": "AWS Account ID", + "id": "93ee15bf-baab-4abf-8828-fe6e75518417", + "key": "93ee15bf-baab-4abf-8828-fe6e75518417", + "modificationUUID": "409e6a7e-1ec1-4611-8624-492a3aac6ca0", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name like '%aws_DynamoDB%' GROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "fd28f0e0-d4ec-4bcd-9c45-32395cb0c55b": { + "allSelected": true, + "customValue": "", + "description": "DynamoDB Tables", + "id": "fd28f0e0-d4ec-4bcd-9c45-32395cb0c55b", + "modificationUUID": "8ebb9032-7e56-4981-8036-efdfc413f8a8", + "multiSelect": true, + "name": "Table", + "order": 2, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'TableName') AS table FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name like '%aws_DynamoDB%' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} AND JSONExtractString(labels, 'cloud.region') IN {{.Region}} and table != '' GROUP BY table\n", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "9e1d91ec-fb66-4cff-b5c5-282270ebffb5", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountMaxReads_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountMaxReads_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "fc55895c", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "8b3f3e0b", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "4fdb1c6c-8c7f-4f8b-a468-9326c811981a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Max Reads", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "5b50997d-3bca-466a-bdeb-841b2e49fd65", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountMaxTableLevelReads_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountMaxTableLevelReads_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f7b176f8", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "9a023ab7", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "310efa3b-d68a-4630-b279-bcbc22ddbefb", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Max Table Level Reads", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "889c36ab-4d0c-4328-9c3c-6558aad6be89", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountMaxTableLevelWrites_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountMaxTableLevelWrites_max", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "ec5ebf95", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "5b2fb00e", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "473de955-bc5c-4a66-aa8d-2e37502c5643", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Max Table Level Writes", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "9a2daf2e-39bc-445d-947f-617c27fadd0f", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountMaxWrites_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountMaxWrites_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3815cf09", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "a783bd91", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "1115aaa1-fdb0-47a1-af79-8c6d439747d4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Max Writes", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "0c3b97fe-56e0-4ce6-99f4-fd1cbd24f93e", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountProvisionedReadCapacityUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountProvisionedReadCapacityUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "edcbcb83", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "224766cb", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d42bc3cd-f457-42eb-936e-c931b0c77f61", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Provisioned Read Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "70980d38-ee3c-47be-9520-e371df3b021a", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_AccountProvisionedWriteCapacityUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_AccountProvisionedWriteCapacityUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c237482a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "e3a117d5", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d06d2f3d-8878-4c53-a8f1-10024091887a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Account Provisioned Write Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "fe1b71b5-1a3f-41c0-b6c2-46bf934787ad", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_ConsumedReadCapacityUnits_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_ConsumedReadCapacityUnits_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b867513b", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "9c10cbaa", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "4ff7fb7c", + "key": { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Table" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TableName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "32c9f178-073c-4d1f-8193-76f804776df0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Consumed Read Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "cc0938a5-af82-4bd8-b10e-67eabe717ee0", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_ConsumedWriteCapacityUnits_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_ConsumedWriteCapacityUnits_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7e2aa806", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "dd49e062", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "e7ada865", + "key": { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Table" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TableName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "40397368-92df-42b9-b0e6-0e7dc7984bc4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Consumed Write Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "4bb63c27-5eb4-4904-9947-42ffce15e92e", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_MaxProvisionedTableReadCapacityUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_MaxProvisionedTableReadCapacityUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b3e029fa", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "e6764d50", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6a33d44a-a337-422f-a964-89b88804343f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Provisioned Table Read Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "5ffbe527-8cf3-4ed8-ac2d-8739fa7fa9af", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_MaxProvisionedTableWriteCapacityUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_MaxProvisionedTableWriteCapacityUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "80ba9142", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "9c802cf0", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a98b7d13-63d3-46cf-b4e7-686b3be7d9f9", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Provisioned Table Write Capacity", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "a02f64ac-e73e-4d4c-a26b-fcfc4265c148", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_ReturnedItemCount_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_ReturnedItemCount_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "db6edb77", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "8b86de4a", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a8d39d03", + "key": { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Table" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TableName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6322f225-471d-43a2-b13e-f2312c1a7b57", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Returned Item Count", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "014e377d-b7c1-4469-a137-be34d7748f31", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_SuccessfulRequestLatency_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_SuccessfulRequestLatency_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "93bef7f0", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4a293ec8", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "2e2286c6", + "key": { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Table" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TableName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6ad1cbfe-9581-4d99-a14e-50bc5fef699f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Successful Request Latency", + "yAxisUnit": "ms" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "b1b75926-7308-43b3-bcad-60f369715f0b", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_ThrottledRequests_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_ThrottledRequests_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "28fcd3cd", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "619578e5", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a6bc481e", + "key": { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Table" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TableName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TableName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TableName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "fd358cf0-a0b0-4106-a89c-a5196297c23b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Throttled Requests", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "5412cdad-174b-462b-916e-4e3de477446b", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_UserErrors_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_UserErrors_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5a060b5e", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "3a1cb5ff", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "17db2e6d-d9dc-4568-85ea-ea4b373dfc5e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "User Errors", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "90f4d19d-8785-4a7a-97cf-c967108e1487", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_DynamoDB_WriteThrottleEvents_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_DynamoDB_WriteThrottleEvents_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "58bc06b3", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "d6d7a8fb", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "713c6c70-3a62-4b67-8a67-7917ca9d4fbf", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Write Throttle Events", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/ec2/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/ec2/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..72ed3d5103 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/ec2/assets/dashboards/overview_dot.json @@ -0,0 +1,1446 @@ +{ + "description": "Overview of EC2 instances", + "image": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSJub25lIj4KICA8cGF0aCBmaWxsPSIjOUQ1MDI1IiBkPSJNMS43MDIgMi45OEwxIDMuMzEydjkuMzc2bC43MDIuMzMyIDIuODQyLTQuNzc3TDEuNzAyIDIuOTh6IiAvPgogIDxwYXRoIGZpbGw9IiNGNTg1MzYiIGQ9Ik0zLjMzOSAxMi42NTdsLTEuNjM3LjM2M1YyLjk4bDEuNjM3LjM1M3Y5LjMyNHoiIC8+CiAgPHBhdGggZmlsbD0iIzlENTAyNSIgZD0iTTIuNDc2IDIuNjEybC44NjMtLjQwNiA0LjA5NiA2LjIxNi00LjA5NiA1LjM3Mi0uODYzLS40MDZWMi42MTJ6IiAvPgogIDxwYXRoIGZpbGw9IiNGNTg1MzYiIGQ9Ik01LjM4IDEzLjI0OGwtMi4wNDEuNTQ2VjIuMjA2bDIuMDQuNTQ4djEwLjQ5NHoiIC8+CiAgPHBhdGggZmlsbD0iIzlENTAyNSIgZD0iTTQuMyAxLjc1bDEuMDgtLjUxMiA2LjA0MyA3Ljg2NC02LjA0MyA1LjY2LTEuMDgtLjUxMVYxLjc0OXoiIC8+CiAgPHBhdGggZmlsbD0iI0Y1ODUzNiIgZD0iTTcuOTk4IDEzLjg1NmwtMi42MTguOTA2VjEuMjM4bDIuNjE4LjkwOHYxMS43MXoiIC8+CiAgPHBhdGggZmlsbD0iIzlENTAyNSIgZD0iTTYuNjAyLjY2TDcuOTk4IDBsNi41MzggOC40NTNMNy45OTggMTZsLTEuMzk2LS42NlYuNjZ6IiAvPgogIDxwYXRoIGZpbGw9IiNGNTg1MzYiIGQ9Ik0xNSAxMi42ODZMNy45OTggMTZWMEwxNSAzLjMxNHY5LjM3MnoiIC8+Cjwvc3ZnPg==", + "layout": [ + { + "h": 5, + "i": "b8a20569-7e4f-40d0-ada6-7736cfadae06", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "b668ba49-d126-4f2d-9eb5-b4cfbfaf94d1", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "6fced7be-8a73-4b9b-8440-f2142230268c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "20dbaec7-9a16-47ad-af3b-f56375db8e69", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "827a354b-1fff-400b-8172-c41e4c830eb5", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "05de543a-73a2-4221-b784-263749d39b1e", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + } + ], + "panelMap": {}, + "tags": [], + "title": "EC2 Overview", + "uploadedGrafana": false, + "variables": { + "11b96105-b752-47ef-88bc-832f248cf855": { + "allSelected": false, + "customValue": "", + "description": "AWS Account", + "id": "11b96105-b752-47ef-88bc-832f248cf855", + "key": "11b96105-b752-47ef-88bc-832f248cf855", + "modificationUUID": "23866855-0966-45ae-99cd-53fab002a1fa", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.account.id') as `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_EC2_CPUUtilization_sum'\nGROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "63a394bf-4acd-4f14-bf0a-f9dc5e4f00c2": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "63a394bf-4acd-4f14-bf0a-f9dc5e4f00c2", + "modificationUUID": "d3060c9c-fa76-4fc3-bcfa-e417c90717fa", + "multiSelect": false, + "name": "Region", + "order": 0, + "queryValue": "\nSELECT JSONExtractString(labels, 'cloud.region') as `cloud.region`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_EC2_CPUUtilization_sum'\n and JSONExtractString(labels, 'cloud.account.id') IN {{.Account}}\nGROUP BY `cloud.region`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "b8a20569-7e4f-40d0-ada6-7736cfadae06", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_CPUUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_CPUUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d302d50d", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "e6c54e87", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "7907211a", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "170f1610-b7d0-4628-aca4-207c122b3709", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU Utilization", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "Percentage of available CPU credits that were utilizaed", + "fillSpans": false, + "id": "b668ba49-d126-4f2d-9eb5-b4cfbfaf94d1", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_CPUCreditUsage_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_CPUCreditUsage_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "30ded0dc", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "c935f6ec", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "d092fef8", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0643cc76-eedd-4101-bd7a-ec810a3e9b8a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU Credits Utilization", + "yAxisUnit": "percentunit" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "6fced7be-8a73-4b9b-8440-f2142230268c", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_EBSReadBytes_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_EBSReadBytes_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a5fbfa4a", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "87071f13", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "c84a88c4", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}} - Reads", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_EBSWriteBytes_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_EBSWriteBytes_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "4d10ca4b", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "fc2db932", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "a3fd74c0", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}} - Writes", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "43627952-52aa-40fd-9c04-cb0e3c123f98", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBS Read/Write Bytes", + "yAxisUnit": "binBps" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "20dbaec7-9a16-47ad-af3b-f56375db8e69", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_EBSReadOps_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_EBSReadOps_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "85d84806", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "f2074606", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "134c7ca9", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}} - Reads", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_EBSWriteOps_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_EBSWriteOps_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "47e0c00f", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "0a157dfe", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "a7d1e8df", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}} - Writes", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a70e41d1-27dc-4e91-bf13-23d8bd2f3c49", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBS Read/Write Ops", + "yAxisUnit": "cps" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "827a354b-1fff-400b-8172-c41e4c830eb5", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_NetworkIn_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_NetworkIn_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "12d6748d", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "df3a8da1", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "81ec53f4", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ac2ce4a6-f595-4d2a-bc22-ddc51c2d59ff", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Incoming", + "yAxisUnit": "binBps" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "05de543a-73a2-4221-b784-263749d39b1e", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_EC2_NetworkOut_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_EC2_NetworkOut_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d301aaa7", + "key": { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + "op": "!=", + "value": "" + }, + { + "id": "e8afaa3b", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "d67487ab", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "service.instance.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "service.instance.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + } + ], + "having": [], + "legend": "{{service.instance.id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "94027537-0da8-4ac5-a880-532b975a818c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Outgoing", + "yAxisUnit": "binBps" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/ecs/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/ecs/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..ffb80b4c33 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/ecs/assets/dashboards/overview_dot.json @@ -0,0 +1,851 @@ +{ + "description": "View key AWS ECS metrics with an out of the box dashboard.\n", + "image":"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20width%3D%2280px%22%20height%3D%2280px%22%20viewBox%3D%220%200%2080%2080%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3C!--%20Generator%3A%20Sketch%2064%20(93537)%20-%20https%3A%2F%2Fsketch.com%20--%3E%3Ctitle%3EIcon-Architecture%2F64%2FArch_Amazon-Elastic-Container-Service_64%3C%2Ftitle%3E%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%3Cdefs%3E%3ClinearGradient%20x1%3D%220%25%22%20y1%3D%22100%25%22%20x2%3D%22100%25%22%20y2%3D%220%25%22%20id%3D%22linearGradient-1%22%3E%3Cstop%20stop-color%3D%22%23C8511B%22%20offset%3D%220%25%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23FF9900%22%20offset%3D%22100%25%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cg%20id%3D%22Icon-Architecture%2F64%2FArch_Amazon-Elastic-Container-Service_64%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20id%3D%22Icon-Architecture-BG%2F64%2FContainers%22%20fill%3D%22url(%23linearGradient-1)%22%3E%3Crect%20id%3D%22Rectangle%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2280%22%20height%3D%2280%22%3E%3C%2Frect%3E%3C%2Fg%3E%3Cpath%20d%3D%22M64%2C48.2340095%20L56%2C43.4330117%20L56%2C32.0000169%20C56%2C31.6440171%2055.812%2C31.3150172%2055.504%2C31.1360173%20L44%2C24.4260204%20L44%2C14.7520248%20L64%2C26.5710194%20L64%2C48.2340095%20Z%20M65.509%2C25.13902%20L43.509%2C12.139026%20C43.199%2C11.9560261%2042.818%2C11.9540261%2042.504%2C12.131026%20C42.193%2C12.3090259%2042%2C12.6410257%2042%2C13.0000256%20L42%2C25.0000201%20C42%2C25.3550199%2042.189%2C25.6840198%2042.496%2C25.8640197%20L54%2C32.5740166%20L54%2C44.0000114%20C54%2C44.3510113%2054.185%2C44.6770111%2054.486%2C44.857011%20L64.486%2C50.8570083%20C64.644%2C50.9520082%2064.822%2C51%2065%2C51%20C65.17%2C51%2065.34%2C50.9570082%2065.493%2C50.8700083%20C65.807%2C50.6930084%2066%2C50.3600085%2066%2C50%20L66%2C26.0000196%20C66%2C25.6460198%2065.814%2C25.31902%2065.509%2C25.13902%20L65.509%2C25.13902%20Z%20M40.445%2C66.863001%20L17%2C54.3990067%20L17%2C26.5710194%20L37%2C14.7520248%20L37%2C24.4510204%20L26.463%2C31.1560173%20C26.175%2C31.3400172%2026%2C31.6580171%2026%2C32.0000169%20L26%2C49.0000091%20C26%2C49.373009%2026.208%2C49.7150088%2026.538%2C49.8870087%20L39.991%2C56.8870055%20C40.28%2C57.0370055%2040.624%2C57.0380055%2040.912%2C56.8880055%20L53.964%2C50.1440086%20L61.996%2C54.9640064%20L40.445%2C66.863001%20Z%20M64.515%2C54.1420068%20L54.515%2C48.1420095%20C54.217%2C47.9640096%2053.849%2C47.9520096%2053.541%2C48.1120095%20L40.455%2C54.8730065%20L28%2C48.3930094%20L28%2C32.5490167%20L38.537%2C25.8440197%20C38.825%2C25.6600198%2039%2C25.3420199%2039%2C25.0000201%20L39%2C13.0000256%20C39%2C12.6410257%2038.808%2C12.3090259%2038.496%2C12.131026%20C38.184%2C11.9540261%2037.802%2C11.9560261%2037.491%2C12.139026%20L15.491%2C25.13902%20C15.187%2C25.31902%2015%2C25.6460198%2015%2C26.0000196%20L15%2C55%20C15%2C55.3690062%2015.204%2C55.7090061%2015.53%2C55.883006%20L39.984%2C68.8830001%20C40.131%2C68.961%2040.292%2C69%2040.453%2C69%20C40.62%2C69%2040.786%2C68.958%2040.937%2C68.8750001%20L64.484%2C55.875006%20C64.797%2C55.7020061%2064.993%2C55.3750062%2065.0001416%2C55.0180064%20C65.006%2C54.6600066%2064.821%2C54.3260067%2064.515%2C54.1420068%20L64.515%2C54.1420068%20Z%22%20id%3D%22Amazon-Elastic-Container-Service_Icon_64_Squid%22%20fill%3D%22%23FFFFFF%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E", + "layout": [ + { + "h": 6, + "i": "f78becf8-0328-48b4-84b6-ff4dac325940", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "2b4eac06-b426-4f78-b874-2e1734c4104b", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "5bea2bc0-13a2-4937-bccb-60ffe8a43ad5", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "6fac67b0-50ec-4b43-ac4b-320a303d0369", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + } + ], + "panelMap": {}, + "tags": [], + "title": "AWS ECS Overview", + "uploadedGrafana": false, + "variables": { + "51f4fa2b-89c7-47c2-9795-f32cffaab985": { + "allSelected": false, + "customValue": "", + "description": "AWS Account ID", + "id": "51f4fa2b-89c7-47c2-9795-f32cffaab985", + "key": "51f4fa2b-89c7-47c2-9795-f32cffaab985", + "modificationUUID": "7b814d17-8fff-4ed6-a4ea-90e3b1a97584", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_ECS_MemoryUtilization_max' GROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0": { + "allSelected": false, + "customValue": "", + "description": "Account Region", + "id": "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0", + "key": "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0", + "modificationUUID": "3b5f499b-22a3-4c8a-847c-8d3811c9e6b2", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_ECS_MemoryUtilization_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "bfbdbcbe-a168-4d81-b108-36339e249116": { + "allSelected": true, + "customValue": "", + "description": "ECS Cluster Name", + "id": "bfbdbcbe-a168-4d81-b108-36339e249116", + "key": "bfbdbcbe-a168-4d81-b108-36339e249116", + "modificationUUID": "9fb0d63c-ac6c-497d-82b3-17d95944e245", + "multiSelect": true, + "name": "Cluster", + "order": 2, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'ClusterName') AS cluster\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_ECS_MemoryUtilization_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} AND JSONExtractString(labels, 'cloud.region') IN {{.Region}}\nGROUP BY cluster", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "f78becf8-0328-48b4-84b6-ff4dac325940", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ECS_MemoryUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ECS_MemoryUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "26ac617d", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "57172ed9", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "49b9f85e", + "key": { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ServiceName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ServiceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + } + ], + "having": [], + "legend": "{{ServiceName}} ({{ClusterName}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "56068fdd-d523-4117-92fa-87c6518ad07c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Maximum Memory Utilization", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "2b4eac06-b426-4f78-b874-2e1734c4104b", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ECS_MemoryUtilization_min--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ECS_MemoryUtilization_min", + "type": "Gauge" + }, + "aggregateOperator": "min", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "cd4b8848", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "aa5115c6", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "f60677b6", + "key": { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ServiceName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ServiceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + } + ], + "having": [], + "legend": "{{ServiceName}} ({{ClusterName}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "min", + "stepInterval": 60, + "timeAggregation": "min" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "fb19342e-cbde-40d8-b12f-ad108698356b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Minimum Memory Utilization", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "5bea2bc0-13a2-4937-bccb-60ffe8a43ad5", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ECS_CPUUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ECS_CPUUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "2c13c8ee", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "f489f6a8", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "94012320", + "key": { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ServiceName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ServiceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + } + ], + "having": [], + "legend": "{{ServiceName}} ({{ClusterName}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "273e0a76-c780-4b9a-9b03-2649d4227173", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Maximum CPU Utilization", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "6fac67b0-50ec-4b43-ac4b-320a303d0369", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ECS_CPUUtilization_min--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ECS_CPUUtilization_min", + "type": "Gauge" + }, + "aggregateOperator": "min", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "758ba906", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "4ffe6bf7", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "53d98059", + "key": { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "ServiceName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ServiceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "ClusterName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "ClusterName", + "type": "tag" + } + ], + "having": [], + "legend": "{{ServiceName}} ({{ClusterName}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "min", + "stepInterval": 60, + "timeAggregation": "min" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c89482b3-5a98-4e2c-be0d-ef036d7dac05", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Minimum CPU Utilization", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/elasticache/assets/dashboards/redis_overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/elasticache/assets/dashboards/redis_overview_dot.json new file mode 100644 index 0000000000..4cfbd83db2 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/elasticache/assets/dashboards/redis_overview_dot.json @@ -0,0 +1,2706 @@ +{ + "description": "Redis Overview for AWS ElastiCache", + "image": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDY0ICg5MzUzNykgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+SWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tRWxhc3RpQ2FjaGVfNjQ8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz4KICAgICAgICA8bGluZWFyR3JhZGllbnQgeDE9IjAlIiB5MT0iMTAwJSIgeDI9IjEwMCUiIHkyPSIwJSIgaWQ9ImxpbmVhckdyYWRpZW50LTEiPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjMkUyN0FEIiBvZmZzZXQ9IjAlIj48L3N0b3A+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiM1MjdGRkYiIG9mZnNldD0iMTAwJSI+PC9zdG9wPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8L2RlZnM+CiAgICA8ZyBpZD0iSWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tRWxhc3RpQ2FjaGVfNjQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJJY29uLUFyY2hpdGVjdHVyZS1CRy82NC9EYXRhYmFzZSIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSI+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUiIHg9IjAiIHk9IjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCI+PC9yZWN0PgogICAgICAgIDwvZz4KICAgICAgICA8cGF0aCBkPSJNNTEsNjEuNTU1NDg2NCBMNTEsNTUuNzAyOTM0MiBDNDguNDY2LDU3LjM0MDA4ODcgNDMuOTA0LDU4LjExMzE2MTYgMzkuNTU2LDU4LjExMzE2MTYgQzM0LjgxNiw1OC4xMTMxNjE2IDMxLjEyMSw1Ny4yODYwODM2IDI5LDU1Ljg2Nzk0OTggTDI5LDYxLjU1NTQ4NjQgQzI5LDYzLjI0ODY0NjEgMzIuOTQ4LDY0Ljk5OTgxMTMgMzkuNTU2LDY0Ljk5OTgxMTMgQzQ2LjMsNjQuOTk5ODExMyA1MSw2My4xODQ2NDAxIDUxLDYxLjU1NTQ4NjQgTDUxLDYxLjU1NTQ4NjQgWiBNMzkuNTU2LDQ5LjIyMDMyMjcgQzM0LjgxNiw0OS4yMjAzMjI3IDMxLjEyMSw0OC4zOTQyNDQ3IDI5LDQ2Ljk3NjExMSBMMjksNTIuNjg2NjQ5NyBDMjkuMDMxLDU0LjM3MzgwODggMzIuOTczLDU2LjExMjk3MjkgMzkuNTU2LDU2LjExMjk3MjkgQzQ2LjI3OSw1Ni4xMTI5NzI5IDUwLjk2OSw1NC4zMDg4MDI3IDUxLDUyLjY4MjY0OTMgTDUxLDQ2LjgxMDA5NTMgQzQ4LjQ2Niw0OC40NDgyNDk4IDQzLjkwNCw0OS4yMjAzMjI3IDM5LjU1Niw0OS4yMjAzMjI3IEwzOS41NTYsNDkuMjIwMzIyNyBaIE01MSw0My43OTA4MTA1IEw1MSwzNy4wMjkxNzI2IEM0OC40NjYsMzguNjY2MzI3IDQzLjkwNCwzOS40MzkzOTk5IDM5LjU1NiwzOS40MzkzOTk5IEMzNC44MTYsMzkuNDM5Mzk5OSAzMS4xMjEsMzguNjEzMzIyIDI5LDM3LjE5NTE4ODIgTDI5LDQzLjc5NDgxMDggQzI5LjAzMSw0NS40ODE5NyAzMi45NzMsNDcuMjIwMTM0IDM5LjU1Niw0Ny4yMjAxMzQgQzQ2LjI3OSw0Ny4yMjAxMzQgNTAuOTY5LDQ1LjQxNTk2MzggNTEsNDMuNzkwODEwNSBMNTEsNDMuNzkwODEwNSBaIE0yOC45OTcsMzMuOTkyODg2MSBDMjguOTk3LDMzLjk5NTg4NjQgMjguOTk4LDMzLjk5ODg4NjcgMjguOTk4LDM0LjAwMTg4NyBMMjksMzQuMDAxODg3IEwyOSwzNC4wMTI4ODggQzI5LjAzMSwzNS43MDAwNDcyIDMyLjk3MywzNy40MzkyMTEyIDM5LjU1NiwzNy40MzkyMTEyIEM0Ni44OTgsMzcuNDM5MjExMiA1MC45NjksMzUuNDE3MDIwNSA1MSwzNC4wMDk4ODc3IEw1MSwzNC4wMDE4ODcgTDUxLjAwMiwzNC4wMDE4ODcgQzUxLjAwMiwzMy45OTg4ODY3IDUxLjAwMywzMy45OTU4ODY0IDUxLjAwMywzMy45OTI4ODYxIEM1MS4wMDMsMzIuNTg0NzUzMyA0Ni45MjcsMzAuNTQ2NTYxIDM5LjU1NiwzMC41NDY1NjEgQzMyLjk0NiwzMC41NDY1NjEgMjguOTk3LDMyLjI5ODcyNjMgMjguOTk3LDMzLjk5Mjg4NjEgTDI4Ljk5NywzMy45OTI4ODYxIFogTTUzLDM0LjAxNzg4ODUgTDUzLDQzLjc3MzgwODggTDUzLjAwMyw0My43NzM4MDg4IEM1My4wMDMsNDMuNzgyODA5NyA1Myw0My43ODk4MTA0IDUzLDQzLjc5ODgxMTIgTDUzLDUyLjY2NjY0NzggTDUzLjAwMyw1Mi42NjY2NDc4IEM1My4wMDMsNTIuNjc1NjQ4NiA1Myw1Mi42ODI2NDkzIDUzLDUyLjY5MTY1MDIgTDUzLDYxLjU1NTQ4NjQgQzUzLDY1LjI5NjgzOTMgNDYuMDMxLDY3IDM5LjU1Niw2NyBDMzEuOTI5LDY3IDI3LDY0Ljg2Mjc5ODQgMjcsNjEuNTU1NDg2NCBMMjcsNTIuNjk3NjUwNyBDMjcsNTIuNjg2NjQ5NyAyNi45OTcsNTIuNjc3NjQ4OCAyNi45OTcsNTIuNjY2NjQ3OCBMMjcsNTIuNjY2NjQ3OCBMMjcsNDMuODA0ODExOCBDMjcsNDMuNzk0ODEwOCAyNi45OTcsNDMuNzg0ODA5OSAyNi45OTcsNDMuNzczODA4OCBMMjcsNDMuNzczODA4OCBMMjcsMzQuMDIzODg5IEMyNywzNC4wMTI4ODggMjYuOTk3LDM0LjAwMzg4NzIgMjYuOTk3LDMzLjk5Mjg4NjEgQzI2Ljk5NywzMC42ODQ1NzQgMzEuOTI3LDI4LjU0NjM3MjMgMzkuNTU2LDI4LjU0NjM3MjMgQzQ2LjAzMiwyOC41NDYzNzIzIDUzLjAwMywzMC4yNTA1MzMxIDUzLjAwMywzMy45OTI4ODYxIEM1My4wMDMsMzQuMDAxODg3IDUzLDM0LjAwODg4NzYgNTMsMzQuMDE3ODg4NSBMNTMsMzQuMDE3ODg4NSBaIE02NywyMS4xMjA2NzE4IEM2Ny41NTMsMjEuMTIwNjcxOCA2OCwyMC42NzI2Mjk1IDY4LDIwLjEyMDU3NzQgTDY4LDE1LjAwMDA5NDMgQzY4LDE0LjQ0NzA0MjIgNjcuNTUzLDE0IDY3LDE0IEwxMywxNCBDMTIuNDQ3LDE0IDEyLDE0LjQ0NzA0MjIgMTIsMTUuMDAwMDk0MyBMMTIsMjAuMTIwNTc3NCBDMTIsMjAuNjcyNjI5NSAxMi40NDcsMjEuMTIwNjcxOCAxMywyMS4xMjA2NzE4IEMxNC4yMjEsMjEuMTIwNjcxOCAxNS4yMTQsMjIuMTA3NzY0OSAxNS4yMTQsMjMuMzIwODc5MyBDMTUuMjE0LDI0LjUzMzk5MzggMTQuMjIxLDI1LjUyMTA4NjkgMTMsMjUuNTIxMDg2OSBDMTIuNDQ3LDI1LjUyMTA4NjkgMTIsMjUuOTY5MTI5MiAxMiwyNi41MjExODEyIEwxMiw0Ny4wMDMxMTM1IEMxMiw0Ny41NTUxNjU2IDEyLjQ0Nyw0OC4wMDMyMDc4IDEzLDQ4LjAwMzIwNzggTDIzLDQ4LjAwMzIwNzggTDIzLDQ2LjAwMzAxOTIgTDE4LDQ2LjAwMzAxOTIgTDE4LDQzLjAwMjczNjEgTDIzLDQzLjAwMjczNjEgTDIzLDQxLjAwMjU0NzQgTDE3LDQxLjAwMjU0NzQgQzE2LjQ0Nyw0MS4wMDI1NDc0IDE2LDQxLjQ0OTU4OTYgMTYsNDIuMDAyNjQxOCBMMTYsNDYuMDAzMDE5MiBMMTQsNDYuMDAzMDE5MiBMMTQsMjcuNDAxMjY0MyBDMTUuODQzLDI2Ljk1MjIyMTkgMTcuMjE0LDI1LjI5MzA2NTQgMTcuMjE0LDIzLjMyMDg3OTMgQzE3LjIxNCwyMS4zNDc2OTMyIDE1Ljg0MywxOS42ODg1MzY3IDE0LDE5LjIzOTQ5NDMgTDE0LDE2LjAwMDE4ODcgTDY2LDE2LjAwMDE4ODcgTDY2LDE5LjIzOTQ5NDMgQzY0LjE1NywxOS42ODg1MzY3IDYyLjc4NiwyMS4zNDc2OTMyIDYyLjc4NiwyMy4zMjA4NzkzIEM2Mi43ODYsMjUuMjkzMDY1NCA2NC4xNTcsMjYuOTUyMjIxOSA2NiwyNy40MDEyNjQzIEw2Niw0Ni4wMDMwMTkyIEw2NCw0Ni4wMDMwMTkyIEw2NCw0Mi4wMDI2NDE4IEM2NCw0MS40NDk1ODk2IDYzLjU1Myw0MS4wMDI1NDc0IDYzLDQxLjAwMjU0NzQgTDU3LDQxLjAwMjU0NzQgTDU3LDQzLjAwMjczNjEgTDYyLDQzLjAwMjczNjEgTDYyLDQ2LjAwMzAxOTIgTDU3LDQ2LjAwMzAxOTIgTDU3LDQ4LjAwMzIwNzggTDY3LDQ4LjAwMzIwNzggQzY3LjU1Myw0OC4wMDMyMDc4IDY4LDQ3LjU1NTE2NTYgNjgsNDcuMDAzMTEzNSBMNjgsMjYuNTIxMTgxMiBDNjgsMjUuOTY5MTI5MiA2Ny41NTMsMjUuNTIxMDg2OSA2NywyNS41MjEwODY5IEM2NS43NzksMjUuNTIxMDg2OSA2NC43ODYsMjQuNTMzOTkzOCA2NC43ODYsMjMuMzIwODc5MyBDNjQuNzg2LDIyLjEwNzc2NDkgNjUuNzc5LDIxLjEyMDY3MTggNjcsMjEuMTIwNjcxOCBMNjcsMjEuMTIwNjcxOCBaIE0yOCwyOC4wMDEzMjA5IEwyOCwyMC4wMDA1NjYxIEMyOCwxOS40NDc1MTM5IDI3LjU1MywxOS4wMDA0NzE3IDI3LDE5LjAwMDQ3MTcgTDIxLDE5LjAwMDQ3MTcgQzIwLjQ0NywxOS4wMDA0NzE3IDIwLDE5LjQ0NzUxMzkgMjAsMjAuMDAwNTY2MSBMMjAsMzcuMDAyMTcgQzIwLDM3LjU1NDIyMjEgMjAuNDQ3LDM4LjAwMjI2NDQgMjEsMzguMDAyMjY0NCBMMjQsMzguMDAyMjY0NCBMMjQsMzYuMDAyMDc1NyBMMjIsMzYuMDAyMDc1NyBMMjIsMjEuMDAwNjYwNCBMMjYsMjEuMDAwNjYwNCBMMjYsMjguMDAxMzIwOSBMMjgsMjguMDAxMzIwOSBaIE01OCwzNi4wMDIwNzU3IEw1NywzNi4wMDIwNzU3IEw1NywzOC4wMDIyNjQ0IEw1OSwzOC4wMDIyNjQ0IEM1OS41NTMsMzguMDAyMjY0NCA2MCwzNy41NTQyMjIxIDYwLDM3LjAwMjE3IEw2MCwyMC4wMDA1NjYxIEM2MCwxOS40NDc1MTM5IDU5LjU1MywxOS4wMDA0NzE3IDU5LDE5LjAwMDQ3MTcgTDUzLDE5LjAwMDQ3MTcgQzUyLjQ0NywxOS4wMDA0NzE3IDUyLDE5LjQ0NzUxMzkgNTIsMjAuMDAwNTY2MSBMNTIsMjguMDAxMzIwOSBMNTQsMjguMDAxMzIwOSBMNTQsMjEuMDAwNjYwNCBMNTgsMjEuMDAwNjYwNCBMNTgsMzYuMDAyMDc1NyBaIE01MCwyNy4wMDEyMjY1IEw1MCwyMC4wMDA1NjYxIEM1MCwxOS40NDc1MTM5IDQ5LjU1MywxOS4wMDA0NzE3IDQ5LDE5LjAwMDQ3MTcgTDQyLDE5LjAwMDQ3MTcgQzQxLjQ0NywxOS4wMDA0NzE3IDQxLDE5LjQ0NzUxMzkgNDEsMjAuMDAwNTY2MSBMNDEsMjYuMDAxMTMyMiBMNDMsMjYuMDAxMTMyMiBMNDMsMjEuMDAwNjYwNCBMNDgsMjEuMDAwNjYwNCBMNDgsMjcuMDAxMjI2NSBMNTAsMjcuMDAxMjI2NSBaIE0zNywyNi4wMDExMzIyIEwzNywyMS4wMDA2NjA0IEwzMiwyMS4wMDA2NjA0IEwzMiwyNy4wMDEyMjY1IEwzMCwyNy4wMDEyMjY1IEwzMCwyMC4wMDA1NjYxIEMzMCwxOS40NDc1MTM5IDMwLjQ0NywxOS4wMDA0NzE3IDMxLDE5LjAwMDQ3MTcgTDM4LDE5LjAwMDQ3MTcgQzM4LjU1MywxOS4wMDA0NzE3IDM5LDE5LjQ0NzUxMzkgMzksMjAuMDAwNTY2MSBMMzksMjYuMDAxMTMyMiBMMzcsMjYuMDAxMTMyMiBaIiBpZD0iQW1hem9uLUVsYXN0aUNhY2hlX0ljb25fNjRfU3F1aWQiIGZpbGw9IiNGRkZGRkYiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+", + "layout": [ + { + "h": 5, + "i": "00d78996-1ba9-42d9-b22b-5818fc3bde4c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "203637d1-df44-4032-beae-1e0302d61c2a", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "6a56afd1-6205-4afe-90fe-86befc3fb55e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "af269a1c-95a3-46b3-8d3b-322c194450e2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "f9b0f03a-8d78-4c26-a037-daae69650eb6", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "18798789-b67a-4c90-8127-f6bb63f012b2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "b3cdeb88-6988-419c-9e94-4a6bccfdd467", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "3604137c-12fe-4205-b7fc-f10d6143583b", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 5, + "i": "5e69ac87-580f-4dc2-becd-943296e5cd1d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 20 + }, + { + "h": 5, + "i": "e5c9ccb6-31de-4b80-8f4c-220ea2e874d0", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 20 + }, + { + "h": 5, + "i": "dccdd9c3-3864-4aef-a98f-6fb0e30baf0c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 25 + }, + { + "h": 5, + "i": "79723065-b871-4c79-83eb-b32f025c7642", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 25 + }, + { + "h": 5, + "i": "8eba8049-2af5-4998-b0e1-cbc2235f9b40", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 30 + }, + { + "h": 5, + "i": "47432f6e-e37c-416a-b517-b66931c9e907", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 30 + } + ], + "panelMap": {}, + "tags": [], + "title": "ElastiCache Redis Overview", + "uploadedGrafana": false, + "variables": { + "50910278-a96b-4bae-a3b4-4c5b9e7cdefc": { + "allSelected": false, + "customValue": "", + "description": "Cache Cluster", + "id": "50910278-a96b-4bae-a3b4-4c5b9e7cdefc", + "modificationUUID": "3903938d-b7aa-4cea-b0f3-bbd704374e31", + "multiSelect": true, + "name": "Cluster", + "order": 2, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'CacheClusterId') AS cluster FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name = 'aws_ElastiCache_CPUUtilization_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} AND JSONExtractString(labels, 'cloud.region') IN {{.Region}} AND cluster != '' GROUP BY cluster", + "showALLOption": true, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "6357cfda-7432-4286-ae5c-fa665ba4ad13": { + "allSelected": false, + "customValue": "", + "description": "AWS Account Region", + "id": "6357cfda-7432-4286-ae5c-fa665ba4ad13", + "key": "6357cfda-7432-4286-ae5c-fa665ba4ad13", + "modificationUUID": "7934dec7-34c6-417e-bcf6-5d9685874f41", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name = 'aws_ElastiCache_CPUUtilization_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "dbed9d28-86e7-4c79-9b05-931cc3697416": { + "allSelected": false, + "customValue": "", + "description": "AWS Cloud Account ID", + "id": "dbed9d28-86e7-4c79-9b05-931cc3697416", + "key": "dbed9d28-86e7-4c79-9b05-931cc3697416", + "modificationUUID": "e50566ae-eabf-4ca0-8c84-f9026747d538", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS cloud.account.id FROM signoz_metrics.distributed_time_series_v4_1day WHERE metric_name = 'aws_ElastiCache_CPUUtilization_max' GROUP BY cloud.account.id", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "b3cdeb88-6988-419c-9e94-4a6bccfdd467", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_DatabaseMemoryUsagePercentage_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_DatabaseMemoryUsagePercentage_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1de28cd7", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "a2e662bc", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b7391c4e", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "4e4a59d3-5255-4540-82e1-1892ffc0d444", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Database Memory Usage Percentage", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "18798789-b67a-4c90-8127-f6bb63f012b2", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_DatabaseCapacityUsagePercentage_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_DatabaseCapacityUsagePercentage_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "42feb786", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "0c3a5e7a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "de00d7b3", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "3199dc90-ba5d-451a-9430-2d4d0ebf37bc", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Database Capacity Usage Percentage", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "af269a1c-95a3-46b3-8d3b-322c194450e2", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_CacheHitRate_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_CacheHitRate_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6e9c7a26", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "7087d8df", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "26bd4c51", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e12cd857-4cec-4328-9155-5e4f9c00fc43", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Cache Hit Rate", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "f9b0f03a-8d78-4c26-a037-daae69650eb6", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_MemoryFragmentationRatio_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_MemoryFragmentationRatio_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "21a13195", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "63918715", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "647e4dbe", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d7ec3399-edbf-4fbc-8cf6-e7e349fdbab5", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Memory Fragmentation Ratio", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "dccdd9c3-3864-4aef-a98f-6fb0e30baf0c", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_SwapUsage_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_SwapUsage_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "8c18e738", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "72e562a1", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "26891e8d", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d0e5f558-3d07-4512-8611-243c4e86e84c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Swap Usage", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "3604137c-12fe-4205-b7fc-f10d6143583b", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_FreeableMemory_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_FreeableMemory_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0820e027", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "c6612aef", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b863daa8", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "4263a59a-367b-404e-ac59-48002f3123e6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Freeable Memory", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "5e69ac87-580f-4dc2-becd-943296e5cd1d", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_NetworkBytesIn_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_NetworkBytesIn_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "314b2895", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "05806d0e", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "edfe2e2c", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0a5800e1-f341-4880-b993-e5a7f1068ab0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Bytes In", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "e5c9ccb6-31de-4b80-8f4c-220ea2e874d0", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_NetworkBytesOut_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_NetworkBytesOut_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f2089c33", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "088c9b4a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "1a86c392", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c5ab1812-a9ec-4c8a-8b5b-49d5a43bf621", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Bytes Out", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "6a56afd1-6205-4afe-90fe-86befc3fb55e", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_CurrConnections_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_CurrConnections_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5ebba9ac", + "key": { + "dataType": "", + "isColumn": false, + "key": "CacheClusterId", + "type": "" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "10a254a8", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "310ce219", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5796d31c-fd59-4d8b-b6ff-5f9db5a2a4bd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Current Connections Maximum", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "8eba8049-2af5-4998-b0e1-cbc2235f9b40", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_ReplicationLag_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_ReplicationLag_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b5ed26b7", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "a3ab9c6c", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "cfd6d4ee", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2f6baca9-1700-4dcf-8875-3c45719f9ff7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Replication Lag", + "yAxisUnit": "s" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "79723065-b871-4c79-83eb-b32f025c7642", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_Evictions_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_Evictions_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e591ace7", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "0e7a0149", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "1440550c", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "aaa23f24-6fbf-439f-92a9-09bdde4ba8fc", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Evictions", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "00d78996-1ba9-42d9-b22b-5818fc3bde4c", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_CPUUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_CPUUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "43ef42eb", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "ce680e7d", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "4cc11182", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "eb5429dc-f591-4907-8394-ed3918bbe561", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU Utilization", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "203637d1-df44-4032-beae-1e0302d61c2a", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_EngineCPUUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_EngineCPUUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "87b3e146", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b0f9df50", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "07a5a0d1", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ba5afd9b-eb99-46bc-83f3-7c2f2feabf19", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Engine CPU Utilization", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "47432f6e-e37c-416a-b517-b66931c9e907", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_ElastiCache_CurrConnections_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_ElastiCache_CurrConnections_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6764e117", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4764b9eb", + "key": { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + }, + "op": "in", + "value": [ + "$Cluster" + ] + }, + { + "id": "a1c90d55", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "CacheClusterId--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "CacheClusterId", + "type": "tag" + } + ], + "having": [], + "legend": "{{CacheClusterId}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "018e439e-7c3c-4f6d-afe1-fd363e0f9a1d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Current Connections", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/lambda/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/lambda/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..85437c6bf4 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/lambda/assets/dashboards/overview_dot.json @@ -0,0 +1,1547 @@ +{ + "description": "Overview of AWS Lambda functions", + "image": "data:image/svg+xml,%3Csvg%20width%3D%22800px%22%20height%3D%22800px%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23FA7E14%22%20d%3D%22M7.983%208.37c-.053.073-.098.133-.141.194L5.775%2011.5c-.64.91-1.282%201.82-1.924%202.73a.128.128%200%2001-.092.051c-.906-.007-1.813-.017-2.719-.028-.01%200-.02-.003-.04-.006a.455.455%200%2001.025-.053%2013977.496%2013977.496%200%20015.446-8.146c.092-.138.188-.273.275-.413a.165.165%200%2000.018-.124c-.167-.515-.338-1.03-.508-1.543-.073-.22-.15-.44-.218-.66-.022-.072-.059-.094-.134-.093-.57.002-1.136.001-1.704.001-.108%200-.108%200-.108-.103%200-.674%200-1.347-.002-2.021%200-.075.026-.092.099-.092%201.143.002%202.286.002%203.43%200a.113.113%200%2001.076.017.107.107%200%2001.045.061%2018266.184%2018266.184%200%20003.92%209.51c.218.53.438%201.059.654%201.59.026.064.053.076.12.056.6-.178%201.2-.352%201.8-.531.075-.023.102-.008.126.064.204.62.412%201.239.62%201.858l.02.073c-.043.015-.083.032-.124.043l-4.085%201.25c-.065.02-.085%200-.106-.054l-1.25-3.048-1.226-2.984-.183-.449c-.01-.026-.023-.048-.043-.087z%22%2F%3E%3C%2Fsvg%3E", + "layout": [ + { + "h": 6, + "i": "877bb5c8-331c-492f-b666-2054c2ae39bd", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "b038520d-0756-4e46-a915-12a2f19a0254", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "2516c785-b025-49b3-aeb4-a4735ccb2709", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "6354ea62-e82b-4323-a33d-eef92519e843", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 6, + "i": "853d3a92-b396-4064-8762-18d7487989e0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "ae6d7c81-d921-4d4c-95ec-6b42d900ea45", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + }, + { + "h": 6, + "i": "4119a1e5-32a8-4859-96e9-a5451114782b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 18 + } + ], + "panelMap": {}, + "tags": [], + "title": "AWS Lambda Overview", + "uploadedGrafana": false, + "variables": { + "5c57a94c-e7a1-4c20-83a3-3a779b9da48e": { + "allSelected": false, + "customValue": "", + "description": "AWS Account", + "id": "5c57a94c-e7a1-4c20-83a3-3a779b9da48e", + "key": "5c57a94c-e7a1-4c20-83a3-3a779b9da48e", + "modificationUUID": "7113f462-0b71-459e-8226-f6292350b34a", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.account.id') as `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_Lambda_Invocations_sum'\nGROUP BY `cloud.account.id`\n\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "8e6124f0-077e-4a45-8a34-c5d5ce1c26c7": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "8e6124f0-077e-4a45-8a34-c5d5ce1c26c7", + "modificationUUID": "d090f070-1d58-4f55-87d2-91778e3fde00", + "multiSelect": false, + "name": "Region", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.region') as `cloud.region`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_Lambda_Invocations_sum'\n and JSONExtractString(labels, 'cloud.account.id') IN {{.Account}}\nGROUP BY `cloud.region`\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of times that your function code is invoked, including successful invocations and invocations that result in a function error. Invocations aren't recorded if the invocation request is throttled or otherwise results in an invocation error. The value of Invocations equals the number of requests billed.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "877bb5c8-331c-492f-b666-2054c2ae39bd", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_Invocations_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_Invocations_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "49d33567", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b9dfa1c9", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "86defeb5", + "key": { + "dataType": "", + "isColumn": false, + "key": "FunctionName", + "type": "" + }, + "op": "exists", + "value": "" + }, + { + "id": "f89a10c4", + "key": { + "dataType": "", + "isColumn": false, + "key": "Resource", + "type": "" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a0e81905-5968-4dbc-b601-29bd491dec11", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\",\"cloud.region\"=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Invocations", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The amount of time that your function code spends processing an event. The billed duration for an invocation is the value of Duration rounded up to the nearest millisecond. Duration does not include cold start time.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "b038520d-0756-4e46-a915-12a2f19a0254", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_Duration_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_Duration_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "af05252d", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "983efea5", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "88eb3092", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "a35c6406", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "cfde56b0-9052-4f97-aa31-63b03653f73e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\", \"cloud.region\"=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Duration", + "yAxisUnit": "ms" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of invocations that result in a function error. Function errors include exceptions that your code throws and exceptions that the Lambda runtime throws. The runtime returns errors for issues such as timeouts and configuration errors. To calculate the error rate, divide the value of Errors by the value of Invocations. Note that the timestamp on an error metric reflects when the function was invoked, not when the error occurred.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "2516c785-b025-49b3-aeb4-a4735ccb2709", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_Errors_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_Errors_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c67262c9", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "c5ccbbf4", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "c1b278d1", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "a45d80e1", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "edd02708-38ea-48ec-856e-25dade25acae", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\", \"cloud.region\"=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Errors", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of invocation requests that are throttled. When all function instances are processing requests and no concurrency is available to scale up, Lambda rejects additional requests with a TooManyRequestsException error. Throttled requests and other invocation errors don't count as either Invocations or Errors.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "6354ea62-e82b-4323-a33d-eef92519e843", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_Throttles_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_Throttles_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6c956b7d", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "5fef840b", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "6f892a9a", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "ce91320c", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d37ca92b-1ffa-4638-95fb-eece9fd4b1d8", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\",\"cloud.region\"=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Throttles", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of events that Lambda successfully queues for processing. This metric provides insight into the number of events that a Lambda function receives. Monitor this metric and set alarms for thresholds to check for issues. For example, to detect an undesirable number of events sent to Lambda, and to quickly diagnose issues resulting from incorrect trigger or function configurations. Mismatches between AsyncEventsReceived and Invocations can indicate a disparity in processing, events being dropped, or a potential queue backlog.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "853d3a92-b396-4064-8762-18d7487989e0", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_AsyncEventsReceived_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_AsyncEventsReceived_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f4c6246b", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "5b7a75a1", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "4e1ba051", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "5848f496", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "34a8224d-d977-46d4-bb10-c0064fcbdfb0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\",\"cloud.region=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Async events received", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The time between when Lambda successfully queues the event and when the function is invoked. The value of this metric increases when events are being retried due to invocation failures or throttling. Monitor this metric and set alarms for thresholds on different statistics for when a queue buildup occurs. To troubleshoot an increase in this metric, look at the Errors metric to identify function errors and the Throttles metric to identify concurrency issues.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "ae6d7c81-d921-4d4c-95ec-6b42d900ea45", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_AsyncEventAge_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_AsyncEventAge_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1aee3626", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "11631fda", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "c5ea0a17", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "1952b27e", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6d779378-7013-449e-9eb2-ef85649fa790", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\",\"cloud.region=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Max Async Event Age", + "yAxisUnit": "ms" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The number of events that are dropped without successfully executing the function. If you configure a dead-letter queue (DLQ) or OnFailure destination, then events are sent there before they're dropped. Events are dropped for various reasons. For example, events can exceed the maximum event age or exhaust the maximum retry attempts, or reserved concurrency might be set to 0. To troubleshoot why events are dropped, look at the Errors metric to identify function errors and the Throttles metric to identify concurrency issues.\n\nSee more at https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics-types.html", + "fillSpans": false, + "id": "4119a1e5-32a8-4859-96e9-a5451114782b", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Lambda_AsyncEventsDropped_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Lambda_AsyncEventsDropped_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a8c65389", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "2ab205c8", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "22d3c9b6", + "key": { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "1e7060a6", + "key": { + "dataType": "string", + "id": "Resource--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Resource", + "type": "tag" + }, + "op": "nexists", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "FunctionName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "FunctionName", + "type": "tag" + } + ], + "having": [], + "legend": "{{FunctionName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7866783d-942a-4d92-b390-6ddbcb717bad", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "{\"aws_Lambda_Invocations_sum\",\"cloud.region\"=\"us-east-2\"}" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Async events dropped", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/msk/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/msk/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..8e847b5bee --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/msk/assets/dashboards/overview_dot.json @@ -0,0 +1,1189 @@ +{ + "description": "Overview Dashboard for Amazon MSK", + "image": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDY0ICg5MzUzNykgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+SWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tTWFuYWdlZC1TdHJlYW1pbmctZm9yLUthZmthXzY0PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IHgxPSIwJSIgeTE9IjEwMCUiIHgyPSIxMDAlIiB5Mj0iMCUiIGlkPSJsaW5lYXJHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzREMjdBOCIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjQTE2NkZGIiBvZmZzZXQ9IjEwMCUiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPGcgaWQ9Ikljb24tQXJjaGl0ZWN0dXJlLzY0L0FyY2hfQW1hem9uLU1hbmFnZWQtU3RyZWFtaW5nLWZvci1LYWZrYV82NCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ikljb24tQXJjaGl0ZWN0dXJlLUJHLzY0L0FuYWx5dGljcyIgZmlsbD0idXJsKCNsaW5lYXJHcmFkaWVudC0xKSI+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUiIHg9IjAiIHk9IjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCI+PC9yZWN0PgogICAgICAgIDwvZz4KICAgICAgICA8cGF0aCBkPSJNMzYuMDA4MTM3MywzNi45NzcwODg4IEwzNi4wMDgxMzczLDI3Ljk4NjQ2MTYgTDM4LjAwNDA2ODYsMjcuOTg2NDYxNiBMMzguMDA0MDY4NiwzMS45ODIyOTU5IEw0MC42OTc1NzgsMjcuOTg2NDYxNiBMNDIuOTA3MDc0LDI3Ljk4NjQ2MTYgTDM5Ljc4NTQzNzQsMzIuMTkwMDc5MyBMNDMuMTY0NTQ5MiwzNi45NzcwODg4IEw0MC43OTczNzQ2LDM2Ljk3NzA4ODggTDM4LjAwNDA2ODYsMzIuNjMxNjE5IEwzOC4wMDQwNjg2LDM2Ljk3NzA4ODggTDM2LjAwODEzNzMsMzYuOTc3MDg4OCBaIE02Niw0OS4xMTc0MzI1IEw2NS4zMzEzNjMsNDkuNjk1ODI5NSBDNjMuOTg0MTA5Myw1MC44NzU1OTk2IDYyLjE3MTgwMzYsNTEuNDY1OTg0MSA2MC4zNTc1MDIsNTEuNDY1OTg0MSBDNTguNTQzMjAwNCw1MS40NjU5ODQxIDU2LjcyNzkwMDgsNTAuODc1NTk5NiA1NS4zNzg2NTEyLDQ5LjY5MjgzMjYgTDU0LjA0NTM2OTEsNDguNTM4MDM2NSBDNTIuMDg5MzU2Myw0Ni44MjM4MjM2IDQ4LjY2NTMzNiw0Ni44MjM4MjM2IDQ2LjcxMzMxNTIsNDguNTM0MDQwNiBMNDUuMzcyMDQ5Myw0OS42OTU4Mjk1IEM0Mi42Nzg1Mzk5LDUyLjA1NjM2ODYgMzguMTE2ODM4OCw1Mi4wNTgzNjY1IDM1LjQxOTMzNzUsNDkuNjkyODMyNiBMMzQuMDg2MDU1Myw0OC41MzgwMzY1IEMzMi4xMzAwNDI2LDQ2LjgyMzgyMzYgMjguNzA2MDIyMyw0Ni44MjM4MjM2IDI2Ljc1NDAwMTUsNDguNTM0MDQwNiBMMjUuNDEyNzM1Niw0OS42OTU4Mjk1IEMyMi43MTkyMjYyLDUyLjA1NjM2ODYgMTguMTU3NTI1LDUyLjA1ODM2NjUgMTUuNDYwMDIzOCw0OS42OTI4MzI2IEwxNC43OTUzNzg3LDQ5LjExNzQzMjUgTDE2LjEwMTcxNTcsNDcuNjA2MDA4MSBMMTYuNzcwMzUyNyw0OC4xODU0MDQxIEMxOC43MjczNjM1LDQ5Ljg5OTYxNyAyMi4xNTEzODM3LDQ5Ljg5OTYxNyAyNC4xMDI0MDY2LDQ4LjE4OTM5OTkgTDI1LjQ0MzY3MjUsNDcuMDI2NjEyMSBDMjguMTM3MTgxOSw0NC42NjcwNzIgMzIuNjk4ODgzLDQ0LjY2NzA3MiAzNS4zOTYzODQzLDQ3LjAzMDYwOCBMMzYuNzI5NjY2NCw0OC4xODU0MDQxIEMzOC42ODY2NzcyLDQ5Ljg5OTYxNyA0Mi4xMTA2OTc0LDQ5Ljg5OTYxNyA0NC4wNjE3MjAzLDQ4LjE4OTM5OTkgTDQ1LjQwMjk4NjIsNDcuMDI2NjEyMSBDNDguMDk2NDk1Niw0NC42NjcwNzIgNTIuNjU4MTk2OCw0NC42NjcwNzIgNTUuMzU1Njk4LDQ3LjAzMDYwOCBMNTYuNjg4OTgwMiw0OC4xODU0MDQxIEM1OC42NDQ5OTI5LDQ5Ljg5OTYxNyA2Mi4wNjkwMTMyLDQ5Ljg5OTYxNyA2NC4wMjEwMzQsNDguMTg5Mzk5OSBMNjQuNjkzNjYyOSw0Ny42MDYwMDgxIEw2Niw0OS4xMTc0MzI1IFogTTYzLjg5ODI4NDMsNjEuMTM5ODk5IEw2NS4yMDQ2MjEzLDYyLjY1MDMyNDQgTDY0LjUzNTk4NDMsNjMuMjI5NzIwMyBDNjMuMTg5NzI4Niw2NC40MDk0OTA0IDYxLjM3NzQyMjksNjQuOTk4ODc2IDU5LjU2NDExOTMsNjQuOTk4ODc2IEM1Ny43NDg4MTk3LDY0Ljk5ODg3NiA1NS45MzM1MjAxLDY0LjQwODQ5MTUgNTQuNTgzMjcyNiw2My4yMjU3MjQ1IEw1My4yNDk5OTA0LDYyLjA3MDkyODQgQzUxLjI5Mzk3NzcsNjAuMzU4NzEzNCA0Ny44Njk5NTc0LDYwLjM1ODcxMzQgNDUuOTE3OTM2NSw2Mi4wNjY5MzI2IEw0NC41NzY2NzA2LDYzLjIyOTcyMDMgQzQxLjg4NTE1NzIsNjUuNTkwMjU5NSAzNy4zMjM0NTYsNjUuNTkxMjU4NCAzNC42MjM5NTg5LDYzLjIyNTcyNDUgTDMzLjI5MDY3NjcsNjIuMDcwOTI4NCBDMzEuMzM1NjYxOSw2MC4zNTg3MTM0IDI3LjkxMTY0MTcsNjAuMzU4NzEzNCAyNS45NTg2MjI4LDYyLjA2NjkzMjYgTDI0LjYxNzM1NjksNjMuMjI5NzIwMyBDMjEuOTI0ODQ1NSw2NS41OTAyNTk1IDE3LjM2MzE0NDQsNjUuNTkxMjU4NCAxNC42NjQ2NDUxLDYzLjIyNTcyNDUgTDE0LDYyLjY1MDMyNDQgTDE1LjMwNjMzNzEsNjEuMTM5ODk5IEwxNS45NzQ5NzQxLDYxLjcxOTI5NSBDMTcuOTMxOTg0OCw2My40MzE1MSAyMS4zNTYwMDUxLDYzLjQzMjUwODkgMjMuMzA3MDI4LDYxLjcyMjI5MTggTDI0LjY0ODI5MzksNjAuNTYwNTAzIEMyNy4zNDI4MDEyLDU4LjIwMDk2MjggMzEuOTAyNTA2NCw1OC4xOTk5NjM5IDM0LjYwMTAwNTYsNjAuNTYzNDk5OSBMMzUuOTM0Mjg3OCw2MS43MTkyOTUgQzM3Ljg5MTI5ODUsNjMuNDMxNTEgNDEuMzE1MzE4OCw2My40MzI1MDg5IDQzLjI2NjM0MTcsNjEuNzIyMjkxOCBMNDQuNjA3NjA3Niw2MC41NjA1MDMgQzQ3LjMwMjExNDksNTguMjAwOTYyOCA1MS44NjE4MjAxLDU4LjE5OTk2MzkgNTQuNTYwMzE5Myw2MC41NjM0OTk5IEw1NS44OTM2MDE1LDYxLjcxOTI5NSBDNTcuODUwNjEyMiw2My40MzE1MSA2MS4yNzQ2MzI1LDYzLjQzMjUwODkgNjMuMjI1NjU1NCw2MS43MjIyOTE4IEw2My44OTgyODQzLDYxLjEzOTg5OSBaIE02My44OTgyODQzLDU0LjgwNjUwMTYgTDY1LjIwNDYyMTMsNTYuMzE1OTI4IEw2NC41MzU5ODQzLDU2Ljg5NTMyNCBDNjEuODQzNDcyOSw1OS4yNTY4NjIxIDU3LjI4MTc3MTgsNTkuMjU3ODYxIDU0LjU4MzI3MjYsNTYuODkyMzI3MSBMNTMuMjQ5OTkwNCw1NS43Mzc1MzEgQzUxLjI5Mzk3NzcsNTQuMDIzMzE4MSA0Ny44Njk5NTc0LDU0LjAyNDMxNyA0NS45MTc5MzY1LDU1LjczMzUzNTEgTDQ0LjU3NjY3MDYsNTYuODk2MzIyOSBDNDMuMjMwNDE0OSw1OC4wNzYwOTMgNDEuNDE3MTExMyw1OC42NjU0Nzg2IDM5LjYwNDgwNTYsNTguNjY1NDc4NiBDMzcuNzg5NTA2LDU4LjY2NTQ3ODYgMzUuOTc0MjA2NCw1OC4wNzUwOTQxIDM0LjYyMzk1ODksNTYuODkyMzI3MSBMMzMuMjkwNjc2Nyw1NS43Mzc1MzEgQzMxLjMzNTY2MTksNTQuMDIzMzE4MSAyNy45MTE2NDE3LDU0LjAyNDMxNyAyNS45NTg2MjI4LDU1LjczMzUzNTEgTDI0LjYxNzM1NjksNTYuODk2MzIyOSBDMjEuOTI1ODQzNSw1OS4yNTY4NjIxIDE3LjM2NDE0MjMsNTkuMjU2ODYyMSAxNC42NjQ2NDUxLDU2Ljg5MjMyNzEgTDE0LDU2LjMxNTkyOCBMMTUuMzA2MzM3MSw1NC44MDY1MDE2IEwxNS45NzQ5NzQxLDU1LjM4NTg5NzYgQzE3LjkzMTk4NDgsNTcuMTAwMTEwNSAyMS4zNTYwMDUxLDU3LjA5OTExMTUgMjMuMzA3MDI4LDU1LjM4ODg5NDQgTDI0LjY0ODI5MzksNTQuMjI3MTA1NiBDMjcuMzQyODAxMiw1MS44Njc1NjU0IDMxLjkwNDUwMjQsNTEuODY1NTY3NSAzNC42MDEwMDU2LDU0LjIzMDEwMjUgTDM1LjkzNDI4NzgsNTUuMzg0ODk4NiBDMzcuODkxMjk4NSw1Ny4xMDAxMTA1IDQxLjMxNTMxODgsNTcuMDk5MTExNSA0My4yNjYzNDE3LDU1LjM4ODg5NDQgTDQ0LjYwNzYwNzYsNTQuMjI3MTA1NiBDNDcuMzAyMTE0OSw1MS44Njc1NjU0IDUxLjg2MzgxNjEsNTEuODY1NTY3NSA1NC41NjAzMTkzLDU0LjIzMDEwMjUgTDU1Ljg5MzYwMTUsNTUuMzg0ODk4NiBDNTcuODUwNjEyMiw1Ny4xMDAxMTA1IDYxLjI3NDYzMjUsNTcuMDk5MTExNSA2My4yMjU2NTU0LDU1LjM4ODg5NDQgTDYzLjg5ODI4NDMsNTQuODA2NTAxNiBaIE0yNC4wMzI1NDksMzcuOTc2MDQ3NCBDMjUuMTMzMzA1MiwzNy45NzYwNDc0IDI2LjAyODQ4MDQsMzguODcyMTEzMiAyNi4wMjg0ODA0LDM5Ljk3Mzk2NDYgQzI2LjAyODQ4MDQsNDEuMDc1ODE1OSAyNS4xMzMzMDUyLDQxLjk3MTg4MTcgMjQuMDMyNTQ5LDQxLjk3MTg4MTcgQzIyLjkzMTc5MjksNDEuOTcxODgxNyAyMi4wMzY2MTc3LDQxLjA3NTgxNTkgMjIuMDM2NjE3NywzOS45NzM5NjQ2IEMyMi4wMzY2MTc3LDM4Ljg3MjExMzIgMjIuOTMxNzkyOSwzNy45NzYwNDc0IDI0LjAzMjU0OSwzNy45NzYwNDc0IEwyNC4wMzI1NDksMzcuOTc2MDQ3NCBaIE0zOS4wMDIwMzQzLDE2Ljk5NzkxNzIgQzQwLjEwMjc5MDUsMTYuOTk3OTE3MiA0MC45OTc5NjU3LDE3Ljg5Mzk4MyA0MC45OTc5NjU3LDE4Ljk5NTgzNDMgQzQwLjk5Nzk2NTcsMjAuMDk3Njg1NiA0MC4xMDI3OTA1LDIwLjk5Mzc1MTUgMzkuMDAyMDM0MywyMC45OTM3NTE1IEMzNy45MDEyNzgyLDIwLjk5Mzc1MTUgMzcuMDA2MTAyOSwyMC4wOTc2ODU2IDM3LjAwNjEwMjksMTguOTk1ODM0MyBDMzcuMDA2MTAyOSwxNy44OTM5ODMgMzcuOTAxMjc4MiwxNi45OTc5MTcyIDM5LjAwMjAzNDMsMTYuOTk3OTE3MiBMMzkuMDAyMDM0MywxNi45OTc5MTcyIFogTTU1Ljk2NzQ1MSwzOS45NzM5NjQ2IEM1NS45Njc0NTEsNDEuMDc1ODE1OSA1NS4wNzIyNzU3LDQxLjk3MTg4MTcgNTMuOTcxNTE5Niw0MS45NzE4ODE3IEM1Mi44NzA3NjM0LDQxLjk3MTg4MTcgNTEuOTc1NTg4Miw0MS4wNzU4MTU5IDUxLjk3NTU4ODIsMzkuOTczOTY0NiBDNTEuOTc1NTg4MiwzOC44NzIxMTMyIDUyLjg3MDc2MzQsMzcuOTc2MDQ3NCA1My45NzE1MTk2LDM3Ljk3NjA0NzQgQzU1LjA3MjI3NTcsMzcuOTc2MDQ3NCA1NS45Njc0NTEsMzguODcyMTEzMiA1NS45Njc0NTEsMzkuOTczOTY0NiBMNTUuOTY3NDUxLDM5Ljk3Mzk2NDYgWiBNMzkuMDAyMDM0MywyMi45OTE2Njg3IEMzOS42NjY2Nzk1LDIyLjk5MTY2ODcgNDAuMjg1NDE4MiwyMi44MTI4NTUxIDQwLjgzNzI5MzIsMjIuNTIzMTU3MSBMNTEuMDA0NTY3NiwzNy4zMjY3MjQzIEM1MC41ODg0MTU5LDM3Ljc5MjIzOSA1MC4yODMwMzg0LDM4LjM1MjY1NDggNTAuMTIyMzY1OSwzOC45NzUwMDYgTDI3Ljg4MTcwMjcsMzguOTc1MDA2IEMyNy43MjEwMzAyLDM4LjM1MjY1NDggMjcuNDE1NjUyNywzNy43OTIyMzkgMjYuOTk5NTAxLDM3LjMyNjcyNDMgTDM3LjE2Njc3NTQsMjIuNTIzMTU3MSBDMzcuNzE4NjUwNCwyMi44MTI4NTUxIDM4LjMzNzM4OTIsMjIuOTkxNjY4NyAzOS4wMDIwMzQzLDIyLjk5MTY2ODcgTDM5LjAwMjAzNDMsMjIuOTkxNjY4NyBaIE0yNC4wMzI1NDksNDMuOTY5Nzk4OSBDMjUuODg2NzY5Myw0My45Njk3OTg5IDI3LjQzNjYxLDQyLjY5MTEzMTkgMjcuODgxNzAyNyw0MC45NzI5MjMxIEw1MC4xMjIzNjU5LDQwLjk3MjkyMzEgQzUwLjU2NzQ1ODYsNDIuNjkxMTMxOSA1Mi4xMTcyOTk0LDQzLjk2OTc5ODkgNTMuOTcxNTE5Niw0My45Njk3OTg5IEM1Ni4xNzMwMzE5LDQzLjk2OTc5ODkgNTcuOTYzMzgyMyw0Mi4xNzc2NjcyIDU3Ljk2MzM4MjMsMzkuOTczOTY0NiBDNTcuOTYzMzgyMywzNy43NzAyNjE5IDU2LjE3MzAzMTksMzUuOTc4MTMwMiA1My45NzE1MTk2LDM1Ljk3ODEzMDIgQzUzLjUxMTQ1NzQsMzUuOTc4MTMwMiA1My4wNzYzNDQ0LDM2LjA3MjAzMjMgNTIuNjYzMTg2NiwzNi4yMTU4ODI0IEw0Mi4zMzcyMzU2LDIxLjE4MDU1NjcgQzQyLjc1MDM5MzQsMjAuNTUyMjExOCA0Mi45OTM4OTcxLDE5LjgwMjk5MjkgNDIuOTkzODk3MSwxOC45OTU4MzQzIEM0Mi45OTM4OTcxLDE2Ljc5MjEzMTcgNDEuMjAzNTQ2NiwxNSAzOS4wMDIwMzQzLDE1IEMzNi44MDA1MjIsMTUgMzUuMDEwMTcxNiwxNi43OTIxMzE3IDM1LjAxMDE3MTYsMTguOTk1ODM0MyBDMzUuMDEwMTcxNiwxOS44MDI5OTI5IDM1LjI1MzY3NTIsMjAuNTUyMjExOCAzNS42NjY4MzMsMjEuMTgwNTU2NyBMMjUuMzQwODgyLDM2LjIxNTg4MjQgQzI0LjkyNzcyNDMsMzYuMDcyMDMyMyAyNC40OTI2MTEyLDM1Ljk3ODEzMDIgMjQuMDMyNTQ5LDM1Ljk3ODEzMDIgQzIxLjgzMTAzNjcsMzUuOTc4MTMwMiAyMC4wNDA2ODYzLDM3Ljc3MDI2MTkgMjAuMDQwNjg2MywzOS45NzM5NjQ2IEMyMC4wNDA2ODYzLDQyLjE3NzY2NzIgMjEuODMxMDM2Nyw0My45Njk3OTg5IDI0LjAzMjU0OSw0My45Njk3OTg5IEwyNC4wMzI1NDksNDMuOTY5Nzk4OSBaIiBpZD0iQW1hem9uLU1hbmFnZWQtU3RyZWFtaW5nLWZvci1LYWZrYS1JY29uXzY0X1NxdWlkIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+CiAgICA8L2c+Cjwvc3ZnPg==", + "layout": [ + { + "h": 6, + "i": "238ff900-c0e4-4e29-83e3-d6acfcc9c6e5", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "e201e9c4-7a52-4558-a5f9-10d8686a6890", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "fcf5c63c-5da6-4f96-9243-5f42980df049", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "601ec1b7-f614-4678-b445-7f6b8fec2e16", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 6, + "i": "e2ab4538-bc01-4e96-b3e0-c7f73a2c972f", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "f15ba73d-d85e-48ac-b478-e6911965e9e3", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + } + ], + "panelMap": {}, + "tags": [], + "title": "Overview of Amazon MSK", + "uploadedGrafana": false, + "variables": { + "627dec44-a04e-44c7-9dd4-b0fdaf4b5b62": { + "allSelected": false, + "customValue": "", + "description": "Cloud Account ID of AWS", + "id": "627dec44-a04e-44c7-9dd4-b0fdaf4b5b62", + "key": "627dec44-a04e-44c7-9dd4-b0fdaf4b5b62", + "modificationUUID": "b23952ff-b081-468c-bf50-96a062383743", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_Kafka_KafkaDataLogsDiskUsed_max' GROUP BY `cloud.account.id`\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "c69e90bd-adaa-4f75-9108-1c6e91a00fbc": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "c69e90bd-adaa-4f75-9108-1c6e91a00fbc", + "modificationUUID": "07f23d13-c94e-452c-b917-04124f910942", + "multiSelect": false, + "name": "Region", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_Kafka_KafkaDataLogsDiskUsed_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region\n", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "238ff900-c0e4-4e29-83e3-d6acfcc9c6e5", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_KafkaDataLogsDiskUsed_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_KafkaDataLogsDiskUsed_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "be8452fb", + "key": { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "8b658843", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "9cbc21ee", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + }, + { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + } + ], + "having": [], + "legend": "Broker {{Broker_ID}} ({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "caafc0b7-fc3c-472d-87cd-ae176e4d9602", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk usage by (Cluster, Broker)", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "e201e9c4-7a52-4558-a5f9-10d8686a6890", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_CpuUser_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_CpuUser_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "03054a63", + "key": { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "754c3c99", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "09ad3a79", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + } + ], + "having": [], + "legend": "Broker {{Broker_ID}} ({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "476bd12d-7454-41e9-89b3-27406083bbaa", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU (User) usage by (Cluster, Broker)", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "fcf5c63c-5da6-4f96-9243-5f42980df049", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_CpuSystem_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_CpuSystem_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1c4feb03", + "key": { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "3e5db1d7", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "9e9bf94c", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + } + ], + "having": [], + "legend": "Broker {{Broker_ID}} ({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "91132e98-9068-48cf-ad89-af9a4bcb5a40", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU (System) usage by (Cluster, Broker)", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "601ec1b7-f614-4678-b445-7f6b8fec2e16", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_NetworkTxPackets_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_NetworkTxPackets_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "df3f9941", + "key": { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "2233f9a5", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "52bd69d4", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + } + ], + "having": [], + "legend": "Broker {{Broker_ID}} ({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "47d4e8b7-2ca3-412c-a48a-bfbd592b0709", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": " Network TX packets by (Cluster, Broker)", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "e2ab4538-bc01-4e96-b3e0-c7f73a2c972f", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_NetworkRxPackets_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_NetworkRxPackets_sum", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a00425be", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "726d60d7", + "key": { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + "op": "exists", + "value": "" + }, + { + "id": "02adea69", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Broker_ID--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Broker_ID", + "type": "tag" + }, + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + } + ], + "having": [], + "legend": "Broker {{Broker_ID}} ({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "1c6ec479-a7d2-4f8f-bb31-1bf2a6b6fc25", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network RX packets by (Cluster, Broker)", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "f15ba73d-d85e-48ac-b478-e6911965e9e3", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_Kafka_SumOffsetLag_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_Kafka_SumOffsetLag_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0626eebd", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "b633d867", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "Cluster_Name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "Cluster_Name", + "type": "tag" + } + ], + "having": [], + "legend": "({{Cluster_Name}})", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "49e4cbd5-d4d1-40a4-8724-7d6580dee56e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Lag Offset by Cluster", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/rds/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/rds/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..efd48de034 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/rds/assets/dashboards/overview_dot.json @@ -0,0 +1,1945 @@ +{ + "description": "Overview of RDS instances in a region", + "image": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICA8dGl0bGU+SWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tUkRTXzY0PC90aXRsZT4KICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCB4MT0iMCUiIHkxPSIxMDAlIiB4Mj0iMTAwJSIgeTI9IjAlIiBpZD0ibGluZWFyR3JhZGllbnQtMSI+CiAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiMyRTI3QUQiIG9mZnNldD0iMCUiPjwvc3RvcD4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzUyN0ZGRiIgb2Zmc2V0PSIxMDAlIj48L3N0b3A+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBpZD0iSWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BbWF6b24tUkRTXzY0IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIKICAgIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICA8ZyBpZD0iSWNvbi1BcmNoaXRlY3R1cmUtQkcvNjQvRGF0YWJhc2UiIGZpbGw9InVybCgjbGluZWFyR3JhZGllbnQtMSkiPgogICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlIiB4PSIwIiB5PSIwIiB3aWR0aD0iODAiIGhlaWdodD0iODAiPjwvcmVjdD4KICAgIDwvZz4KICAgIDxwYXRoCiAgICAgIGQ9Ik0xNS40MTQsMTQgTDI0LjcwNywyMy4yOTMgTDIzLjI5MywyNC43MDcgTDE0LDE1LjQxNCBMMTQsMjMgTDEyLDIzIEwxMiwxMyBDMTIsMTIuNDQ4IDEyLjQ0NywxMiAxMywxMiBMMjMsMTIgTDIzLDE0IEwxNS40MTQsMTQgWiBNNjgsMTMgTDY4LDIzIEw2NiwyMyBMNjYsMTUuNDE0IEw1Ni43MDcsMjQuNzA3IEw1NS4yOTMsMjMuMjkzIEw2NC41ODYsMTQgTDU3LDE0IEw1NywxMiBMNjcsMTIgQzY3LjU1MywxMiA2OCwxMi40NDggNjgsMTMgTDY4LDEzIFogTTY2LDU3IEw2OCw1NyBMNjgsNjcgQzY4LDY3LjU1MiA2Ny41NTMsNjggNjcsNjggTDU3LDY4IEw1Nyw2NiBMNjQuNTg2LDY2IEw1NS4yOTMsNTYuNzA3IEw1Ni43MDcsNTUuMjkzIEw2Niw2NC41ODYgTDY2LDU3IFogTTY1LjUsMzkuMjEzIEM2NS41LDM1Ljg5NCA2MS42NjgsMzIuNjE1IDU1LjI1LDMwLjQ0MiBMNTUuODkxLDI4LjU0OCBDNjMuMjY4LDMxLjA0NSA2Ny41LDM0LjkzMiA2Ny41LDM5LjIxMyBDNjcuNSw0My40OTUgNjMuMjY4LDQ3LjM4MyA1NS44OSw0OS44NzkgTDU1LjI0OSw0Ny45ODQgQzYxLjY2OCw0NS44MTIgNjUuNSw0Mi41MzQgNjUuNSwzOS4yMTMgTDY1LjUsMzkuMjEzIFogTTE0LjU1NiwzOS4yMTMgQzE0LjU1Niw0Mi4zOTMgMTguMTQzLDQ1LjU4NSAyNC4xNTIsNDcuNzUzIEwyMy40NzMsNDkuNjM0IEMxNi41MzUsNDcuMTMxIDEyLjU1Niw0My4zMzMgMTIuNTU2LDM5LjIxMyBDMTIuNTU2LDM1LjA5NCAxNi41MzUsMzEuMjk2IDIzLjQ3MywyOC43OTIgTDI0LjE1MiwzMC42NzMgQzE4LjE0MywzMi44NDIgMTQuNTU2LDM2LjAzNCAxNC41NTYsMzkuMjEzIEwxNC41NTYsMzkuMjEzIFogTTI0LjcwNyw1Ni43MDcgTDE1LjQxNCw2NiBMMjMsNjYgTDIzLDY4IEwxMyw2OCBDMTIuNDQ3LDY4IDEyLDY3LjU1MiAxMiw2NyBMMTIsNTcgTDE0LDU3IEwxNCw2NC41ODYgTDIzLjI5Myw1NS4yOTMgTDI0LjcwNyw1Ni43MDcgWiBNNDAsMzEuMjg2IEMzMi44NTQsMzEuMjg2IDI5LDI5LjQ0IDI5LDI4LjY4NiBDMjksMjcuOTMxIDMyLjg1NCwyNi4wODYgNDAsMjYuMDg2IEM0Ny4xNDUsMjYuMDg2IDUxLDI3LjkzMSA1MSwyOC42ODYgQzUxLDI5LjQ0IDQ3LjE0NSwzMS4yODYgNDAsMzEuMjg2IEw0MCwzMS4yODYgWiBNNDAuMDI5LDM5LjAzMSBDMzMuMTg3LDM5LjAzMSAyOSwzNy4xNjIgMjksMzYuMTQ1IEwyOSwzMS4yODQgQzMxLjQ2MywzMi42NDMgMzUuODMyLDMzLjI4NiA0MCwzMy4yODYgQzQ0LjE2OCwzMy4yODYgNDguNTM3LDMyLjY0MyA1MSwzMS4yODQgTDUxLDM2LjE0NSBDNTEsMzcuMTYzIDQ2LjgzNSwzOS4wMzEgNDAuMDI5LDM5LjAzMSBMNDAuMDI5LDM5LjAzMSBaIE00MC4wMjksNDYuNjY3IEMzMy4xODcsNDYuNjY3IDI5LDQ0Ljc5OCAyOSw0My43ODEgTDI5LDM4Ljg2MiBDMzEuNDMxLDQwLjI5MSAzNS43NDIsNDEuMDMxIDQwLjAyOSw0MS4wMzEgQzQ0LjI5Miw0MS4wMzEgNDguNTc4LDQwLjI5MiA1MSwzOC44NjcgTDUxLDQzLjc4MSBDNTEsNDQuNzk5IDQ2LjgzNSw0Ni42NjcgNDAuMDI5LDQ2LjY2NyBMNDAuMDI5LDQ2LjY2NyBaIE00MCw1My41MTggQzMyLjg4Myw1My41MTggMjksNTEuNjA1IDI5LDUwLjYyMiBMMjksNDYuNDk4IEMzMS40MzEsNDcuOTI3IDM1Ljc0Miw0OC42NjcgNDAuMDI5LDQ4LjY2NyBDNDQuMjkyLDQ4LjY2NyA0OC41NzgsNDcuOTI5IDUxLDQ2LjUwMyBMNTEsNTAuNjIyIEM1MSw1MS42MDUgNDcuMTE3LDUzLjUxOCA0MCw1My41MTggTDQwLDUzLjUxOCBaIE00MCwyNC4wODYgQzMzLjczOSwyNC4wODYgMjcsMjUuNTI1IDI3LDI4LjY4NiBMMjcsNTAuNjIyIEMyNyw1My44MzYgMzMuNTQsNTUuNTE4IDQwLDU1LjUxOCBDNDYuNDYsNTUuNTE4IDUzLDUzLjgzNiA1Myw1MC42MjIgTDUzLDI4LjY4NiBDNTMsMjUuNTI1IDQ2LjI2MSwyNC4wODYgNDAsMjQuMDg2IEw0MCwyNC4wODYgWiIKICAgICAgaWQ9IkFtYXpvbi1SRFNfSWNvbl82NF9TcXVpZCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogIDwvZz4KPC9zdmc+", + "layout": [ + { + "h": 5, + "i": "45856010-5998-4762-99ef-ffa799bf8e6d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "b533700b-71e8-4294-8f2a-db48a9c407b2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "d64bed38-c9c0-4fac-a30a-1d7e73b4ee55", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "b3c3fddc-5497-41e6-8f0e-e1802c9e43ae", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "e5f430cc-2b07-4844-8c7f-6543ea12875c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "a9f22b15-c22d-4505-a5b4-6f5878500565", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "71652346-286f-44f2-9edc-aab33fe514ec", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "7f8d7340-eeb5-47cb-a2b1-be653275c2d0", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + } + ], + "panelMap": {}, + "tags": [], + "title": "RDS Overview", + "uploadedGrafana": false, + "variables": { + "Account": { + "allSelected": false, + "customValue": "", + "description": "AWS Account", + "id": "d5e770d2-5ab7-4481-b677-189e8eca218c", + "key": "d5e770d2-5ab7-4481-b677-189e8eca218c", + "modificationUUID": "619393f3-4796-40ed-a4b1-8b98fd5ebc48", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.account.id') as `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_RDS_CPUUtilization_sum'\nGROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "Region": { + "allSelected": false, + "customValue": "", + "description": "AWS Region", + "id": "10aede9a-ef01-42f3-9946-2260dec2a398", + "key": "10aede9a-ef01-42f3-9946-2260dec2a398", + "modificationUUID": "c810775c-052f-45dd-948b-77fc3cc979e9", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT JSONExtractString(labels, 'cloud.region') as `cloud.region`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE \n metric_name like 'aws_RDS_CPUUtilization_sum'\n and JSONExtractString(labels, 'cloud.account.id') IN {{.Account}}\nGROUP BY `cloud.region`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "45856010-5998-4762-99ef-ffa799bf8e6d", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_CPUUtilization_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_CPUUtilization_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f8e72efc", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4e68256a", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a5082e1b", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0970e1f2-18fe-45c3-9045-6a5c254f8fe3", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU Utilization", + "yAxisUnit": "percent" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "The amount of available random access memory.\n\nFor MariaDB, MySQL, Oracle, and PostgreSQL DB instances, this metric reports the value of the MemAvailable field of /proc/meminfo.", + "fillSpans": false, + "id": "b533700b-71e8-4294-8f2a-db48a9c407b2", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_FreeableMemory_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_FreeableMemory_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "723ba84a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "f8227b55", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "3951e8ed", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "530a64c6-c4e2-416a-b172-a79fed4ab258", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Free Memory", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "d64bed38-c9c0-4fac-a30a-1d7e73b4ee55", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_DatabaseConnections_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_DatabaseConnections_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "31191f74", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "aa644bbf", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "e5b31a18", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ade71dbc-c62b-487d-9bf5-a7fba2a73a86", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Database Connections", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "b3c3fddc-5497-41e6-8f0e-e1802c9e43ae", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_ReadLatency_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_ReadLatency_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "83f232af", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "2677873f", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "78eddd81", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Reads", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_WriteLatency_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_WriteLatency_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "e2df7981", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "6daad748", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "28057159", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Writes", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "3327c4aa-f47b-4019-8eed-1e0f68edc071", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk Read / Write Latency", + "yAxisUnit": "s" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "e5f430cc-2b07-4844-8c7f-6543ea12875c", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_ReadIOPS_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_ReadIOPS_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "17142c3d", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "27fcc87d", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "5510ad1d", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Reads", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_WriteIOPS_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_WriteIOPS_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "a050e23a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "6df80990", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "72bc50d0", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Writes", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e41982c2-d975-41c3-aca3-62259806c112", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk Read / Write IOPS", + "yAxisUnit": "cps" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "a9f22b15-c22d-4505-a5b4-6f5878500565", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_ReadThroughput_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_ReadThroughput_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a298d4bd", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "810c0586", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "fa40ae81", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Reads", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_WriteThroughput_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_WriteThroughput_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "d46f3f53", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4ec47a19", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a0e648d6", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}} - Writes", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "314ca22f-c50f-4b5a-9ab0-285488f0f220", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk Read / Write Throughput", + "yAxisUnit": "binBps" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "71652346-286f-44f2-9edc-aab33fe514ec", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_DiskQueueDepth_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_DiskQueueDepth_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f64f0096", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "18ad7c1e", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "5d3f4963", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f0c67967-a129-4e88-883f-01454c729864", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk Queue Depth", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "7f8d7340-eeb5-47cb-a2b1-be653275c2d0", + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_RDS_FreeStorageSpace_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_RDS_FreeStorageSpace_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7786e529", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "f27b4616", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "51ca6d55", + "key": { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + }, + "op": "!=", + "value": "" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + { + "dataType": "string", + "id": "DBInstanceIdentifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "DBInstanceIdentifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{DBInstanceIdentifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e3f55e7f-9701-4145-a177-672d6d380f3b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Free Storage Space", + "yAxisUnit": "bytes" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/sns/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/sns/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..d39f071df6 --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/sns/assets/dashboards/overview_dot.json @@ -0,0 +1,818 @@ +{ + "description": "View key AWS SNS metrics with an out of the box dashboard.", + "image": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iODBweCIgaGVpZ2h0PSI4MHB4IiB2aWV3Qm94PSIwIDAgODAgODAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDY0ICg5MzUzNykgLSBodHRwczovL3NrZXRjaC5jb20gLS0+CiAgICA8dGl0bGU+SWNvbi1BcmNoaXRlY3R1cmUvNjQvQXJjaF9BV1MtU2ltcGxlLU5vdGlmaWNhdGlvbi1TZXJ2aWNlXzY0PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IHgxPSIwJSIgeTE9IjEwMCUiIHgyPSIxMDAlIiB5Mj0iMCUiIGlkPSJsaW5lYXJHcmFkaWVudC0xIj4KICAgICAgICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI0IwMDg0RCIgb2Zmc2V0PSIwJSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSIjRkY0RjhCIiBvZmZzZXQ9IjEwMCUiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPGcgaWQ9Ikljb24tQXJjaGl0ZWN0dXJlLzY0L0FyY2hfQVdTLVNpbXBsZS1Ob3RpZmljYXRpb24tU2VydmljZV82NCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ikljb24tQXJjaGl0ZWN0dXJlLUJHLzY0L0FwcGxpY2F0aW9uLUludGVncmF0aW9uIiBmaWxsPSJ1cmwoI2xpbmVhckdyYWRpZW50LTEpIj4KICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZSIgeD0iMCIgeT0iMCIgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIj48L3JlY3Q+CiAgICAgICAgPC9nPgogICAgICAgIDxwYXRoIGQ9Ik0xNywzOCBDMTguMTAzLDM4IDE5LDM4Ljg5NyAxOSw0MCBDMTksNDEuMTAzIDE4LjEwMyw0MiAxNyw0MiBDMTUuODk3LDQyIDE1LDQxLjEwMyAxNSw0MCBDMTUsMzguODk3IDE1Ljg5NywzOCAxNywzOCBMMTcsMzggWiBNNDEsNjQgQzI5LjMxNCw2NCAxOS4yODksNTUuNDY2IDE3LjE5NCw0My45OCBDMTguOTY1LDQzLjg5NCAyMC40MjcsNDIuNjU5IDIwLjg1Nyw0MSBMMjcsNDEgTDI3LDM5IEwyMC44NTcsMzkgQzIwLjQyNywzNy4zNDIgMTguOTY2LDM2LjEwNyAxNy4xOTUsMzYuMDIgQzE5LjI4NSwyNC43MSAyOS41MTEsMTYgNDEsMTYgQzQ1LjMxMywxNiA0OS44MzIsMTcuNjIyIDU0LjQyOSwyMC44MjEgTDU1LjU3MSwxOS4xNzkgQzUwLjYzMywxNS43NDMgNDUuNzMsMTQgNDEsMTQgQzI4LjI3LDE0IDE2Ljk0OSwyMy44NjUgMTUuMDYzLDM2LjUyMSBDMTMuODM5LDM3LjIwNyAxMywzOC41IDEzLDQwIEMxMyw0MS41IDEzLjgzOSw0Mi43OTMgMTUuMDYzLDQzLjQ3OCBDMTYuOTcsNTYuMzQxIDI4LjA1Niw2NiA0MSw2NiBDNDYuNDA3LDY2IDUxLjk0Miw2NC4xNTcgNTYuNTg1LDYwLjgxMSBMNTUuNDE1LDU5LjE4OSBDNTEuMTEsNjIuMjkyIDQ1Ljk5MSw2NCA0MSw2NCBMNDEsNjQgWiBNMzAuMTAxLDM2LjQ0MiBDMzEuOTU1LDM2Ljg5NSAzNC4yNzUsMzcgMzYsMzcgQzM3LjY0MiwzNyAzOS44MjMsMzYuOTA1IDQxLjYyOSwzNi41MDYgTDM3LjEwNSw0NS41NTMgQzM3LjAzNiw0NS42OTEgMzcsNDUuODQ1IDM3LDQ2IEwzNyw1MC40NTMgQzM2LjE5OSw1MC45NjQgMzQuODMzLDUxLjgxMiAzNCw1MS45ODYgTDM0LDQ2IEMzNCw0NS44NjggMzMuOTc0LDQ1LjczNyAzMy45MjMsNDUuNjE1IEwzMC4xMDEsMzYuNDQyIFogTTM2LDMzIEM0MC4wMjUsMzMgNDIuMTc0LDMzLjYwNCA0Mi44NDEsMzQgQzQyLjE3NCwzNC4zOTYgNDAuMDI1LDM1IDM2LDM1IEMzMS45NzUsMzUgMjkuODI2LDM0LjM5NiAyOS4xNTksMzQgQzI5LjgyNiwzMy42MDQgMzEuOTc1LDMzIDM2LDMzIEwzNiwzMyBaIE0zMyw1NCBMMzQsNTQgQzM0LjA0Myw1NCAzNC4wODYsNTMuOTk3IDM0LjEyOCw1My45OTIgQzM1LjM1Miw1My44MzMgMzYuOTA5LDUyLjg4NyAzOC4yNzIsNTIuMDEzIEwzOC41MzUsNTEuODQ1IEMzOC44MjQsNTEuNjYxIDM5LDUxLjM0MiAzOSw1MSBMMzksNDYuMjM2IEw0NC41NTksMzUuMTIgQzQ0LjgzMywzNC44MDEgNDUsMzQuNDM0IDQ1LDM0IEM0NSwzMS4zOSAzOS4zNjEsMzEgMzYsMzEgQzMyLjYzOSwzMSAyNywzMS4zOSAyNywzNCBDMjcsMzQuMzY2IDI3LjEyLDM0LjY4NCAyNy4zMiwzNC45NjcgTDMyLDQ2LjIgTDMyLDUzIEMzMiw1My41NTIgMzIuNDQ3LDU0IDMzLDU0IEwzMyw1NCBaIE02Miw1MyBDNjMuMTAzLDUzIDY0LDUzLjg5NyA2NCw1NSBDNjQsNTYuMTAzIDYzLjEwMyw1NyA2Miw1NyBDNjAuODk3LDU3IDYwLDU2LjEwMyA2MCw1NSBDNjAsNTMuODk3IDYwLjg5Nyw1MyA2Miw1MyBMNjIsNTMgWiBNNjIsMjMgQzYzLjEwMywyMyA2NCwyMy44OTcgNjQsMjUgQzY0LDI2LjEwMyA2My4xMDMsMjcgNjIsMjcgQzYwLjg5NywyNyA2MCwyNi4xMDMgNjAsMjUgQzYwLDIzLjg5NyA2MC44OTcsMjMgNjIsMjMgTDYyLDIzIFogTTY0LDM4IEM2NS4xMDMsMzggNjYsMzguODk3IDY2LDQwIEM2Niw0MS4xMDMgNjUuMTAzLDQyIDY0LDQyIEM2Mi44OTcsNDIgNjIsNDEuMTAzIDYyLDQwIEM2MiwzOC44OTcgNjIuODk3LDM4IDY0LDM4IEw2NCwzOCBaIE01NCw0MSBMNjAuMTQzLDQxIEM2MC41ODksNDIuNzIgNjIuMTQyLDQ0IDY0LDQ0IEM2Ni4yMDYsNDQgNjgsNDIuMjA2IDY4LDQwIEM2OCwzNy43OTQgNjYuMjA2LDM2IDY0LDM2IEM2Mi4xNDIsMzYgNjAuNTg5LDM3LjI4IDYwLjE0MywzOSBMNTQsMzkgTDU0LDI2IEw1OC4xNDMsMjYgQzU4LjU4OSwyNy43MiA2MC4xNDIsMjkgNjIsMjkgQzY0LjIwNiwyOSA2NiwyNy4yMDYgNjYsMjUgQzY2LDIyLjc5NCA2NC4yMDYsMjEgNjIsMjEgQzYwLjE0MiwyMSA1OC41ODksMjIuMjggNTguMTQzLDI0IEw1MywyNCBDNTIuNDQ3LDI0IDUyLDI0LjQ0OCA1MiwyNSBMNTIsMzkgTDQ1LDM5IEw0NSw0MSBMNTIsNDEgTDUyLDU1IEM1Miw1NS41NTIgNTIuNDQ3LDU2IDUzLDU2IEw1OC4xNDMsNTYgQzU4LjU4OSw1Ny43MiA2MC4xNDIsNTkgNjIsNTkgQzY0LjIwNiw1OSA2Niw1Ny4yMDYgNjYsNTUgQzY2LDUyLjc5NCA2NC4yMDYsNTEgNjIsNTEgQzYwLjE0Miw1MSA1OC41ODksNTIuMjggNTguMTQzLDU0IEw1NCw1NCBMNTQsNDEgWiIgaWQ9IkFXUy1TaW1wbGUtTm90aWZpY2F0aW9uLVNlcnZpY2VfSWNvbl82NF9TcXVpZCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4=", + "layout": [ + { + "h": 6, + "i": "4eb87f89-0213-4773-9b06-6aecc6701898", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "7a010b4e-ea7c-4a45-a9eb-93af650c45b4", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "2299d4e3-6c40-4bf2-a550-c7bb8a7acd38", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "16eec8b7-de1a-4039-b180-24c7a6704b6e", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + } + ], + "panelMap": {}, + "tags": [], + "title": "SNS Overview", + "uploadedGrafana": false, + "variables": { + "51f4fa2b-89c7-47c2-9795-f32cffaab985": { + "allSelected": false, + "customValue": "", + "description": "AWS Account ID", + "id": "51f4fa2b-89c7-47c2-9795-f32cffaab985", + "key": "51f4fa2b-89c7-47c2-9795-f32cffaab985", + "modificationUUID": "b7a6b06b-fa1f-4fb8-b70e-6bd9b350f29e", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SNS_PublishSize_count' GROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0": { + "allSelected": false, + "customValue": "", + "description": "Account Region", + "id": "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0", + "key": "9faf0f4b-b245-4b3c-83a3-60cfa76dfeb0", + "modificationUUID": "8428a5de-bfd1-4a69-9601-63e3041cd556", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SNS_PublishSize_count' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "bfbdbcbe-a168-4d81-b108-36339e249116": { + "allSelected": true, + "customValue": "", + "description": "SNS Topic Name", + "id": "bfbdbcbe-a168-4d81-b108-36339e249116", + "modificationUUID": "dfed7272-16dc-4eb6-99bf-7c82fc8e04f0", + "multiSelect": true, + "name": "Topic", + "order": 2, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'TopicName') AS topic\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SNS_PublishSize_count' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} AND JSONExtractString(labels, 'cloud.region') IN {{.Region}}\nGROUP BY topic", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "4eb87f89-0213-4773-9b06-6aecc6701898", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SNS_NumberOfMessagesPublished_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SNS_NumberOfMessagesPublished_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "8fd51b53", + "key": { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Topic" + ] + }, + { + "id": "b18187c3", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "eebe4578", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TopicName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9c67615a-55f7-42da-835c-86922f2ff8bb", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Messages Published", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "7a010b4e-ea7c-4a45-a9eb-93af650c45b4", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SNS_PublishSize_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SNS_PublishSize_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1aa0d1a9", + "key": { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Topic" + ] + }, + { + "id": "62255cff", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "17c7153e", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TopicName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a635a15b-dfe6-4617-a82e-29d93e27deaf", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Published Message Size", + "yAxisUnit": "decbytes" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "2299d4e3-6c40-4bf2-a550-c7bb8a7acd38", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SNS_NumberOfNotificationsDelivered_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SNS_NumberOfNotificationsDelivered_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c96a4ac0", + "key": { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Topic" + ] + }, + { + "id": "8ca86829", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "8a444f66", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TopicName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0d2fc26c-9b21-4dfc-b631-64b7c8d3bd71", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Notifications Delivered", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "16eec8b7-de1a-4039-b180-24c7a6704b6e", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SNS_NumberOfNotificationsFailed_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SNS_NumberOfNotificationsFailed_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6175f3d5", + "key": { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Topic" + ] + }, + { + "id": "e2084931", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "0b05209a", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "TopicName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "TopicName", + "type": "tag" + } + ], + "having": [], + "legend": "{{TopicName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "526247af-6ac9-42ff-83e9-cce0e32a9e63", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Notifications Failed", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/definitions/aws/sqs/assets/dashboards/overview_dot.json b/pkg/query-service/app/cloudintegrations/services/definitions/aws/sqs/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..dea1a758cc --- /dev/null +++ b/pkg/query-service/app/cloudintegrations/services/definitions/aws/sqs/assets/dashboards/overview_dot.json @@ -0,0 +1,1761 @@ +{ + "description": "View SQS key Metrics them with an out of the box dashboard.", + "image":"data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3Csvg%20width%3D%2280px%22%20height%3D%2280px%22%20viewBox%3D%220%200%2080%2080%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3C!--%20Generator%3A%20Sketch%2064%20(93537)%20-%20https%3A%2F%2Fsketch.com%20--%3E%3Ctitle%3EIcon-Architecture%2F64%2FArch_AWS-Simple-Queue-Service_64%3C%2Ftitle%3E%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%3Cdefs%3E%3ClinearGradient%20x1%3D%220%25%22%20y1%3D%22100%25%22%20x2%3D%22100%25%22%20y2%3D%220%25%22%20id%3D%22linearGradient-1%22%3E%3Cstop%20stop-color%3D%22%23B0084D%22%20offset%3D%220%25%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23FF4F8B%22%20offset%3D%22100%25%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cg%20id%3D%22Icon-Architecture%2F64%2FArch_AWS-Simple-Queue-Service_64%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Cg%20id%3D%22Icon-Architecture-BG%2F64%2FApplication-Integration%22%20fill%3D%22url(%23linearGradient-1)%22%3E%3Crect%20id%3D%22Rectangle%22%20x%3D%220%22%20y%3D%220%22%20width%3D%2280%22%20height%3D%2280%22%3E%3C%2Frect%3E%3C%2Fg%3E%3Cpath%20d%3D%22M28.7169966%2C43.6876756%20L31.7189265%2C40.721826%20C31.9070474%2C40.5359011%2032.0131156%2C40.2833614%2032.0141233%2C40.019885%20C32.0151169%2C39.7564086%2031.9100493%2C39.5028747%2031.722929%2C39.3159556%20L28.7209992%2C36.3163014%20L27.3020871%2C37.7181948%20L28.5899149%2C39.0057494%20L24.0089701%2C39.0057494%20L24.0089701%2C40.9942506%20L28.6059252%2C40.9942506%20L27.3060896%2C42.2778282%20L28.7169966%2C43.6876756%20Z%20M51.627725%2C43.7781524%20L55.630298%2C40.793412%20C55.8804589%2C40.6054986%2056.0295547%2C40.3112004%2056.0295547%2C39.9990057%20C56.0295547%2C39.6858168%2055.8804589%2C39.3905244%2055.6292974%2C39.202611%20L51.6267243%2C36.2218476%20L50.4259524%2C37.8126486%20L52.0269816%2C39.0057494%20L48.0244085%2C39.0057494%20L48.0244085%2C40.9942506%20L52.025981%2C40.9942506%20L50.4249518%2C42.1873514%20L51.627725%2C43.7781524%20Z%20M35.2081695%2C40%20C35.2081695%2C42.1107941%2034.8429347%2C44.1012839%2034.160496%2C45.8332685%20C35.9606533%2C45.14127%2037.9909585%2C44.7952708%2040.0192624%2C44.7952708%20C42.0475663%2C44.7952708%2044.0778715%2C45.14127%2045.8770281%2C45.8332685%20C45.19559%2C44.1012839%2044.8303552%2C42.1107941%2044.8303552%2C40%20C44.8303552%2C37.8892059%2045.19559%2C35.8997104%2045.8770281%2C34.1667315%20C42.2777142%2C35.5497341%2037.7608105%2C35.5497341%2034.160496%2C34.1667315%20C34.8429347%2C35.8997104%2035.2081695%2C37.8892059%2035.2081695%2C40%20L35.2081695%2C40%20Z%20M30.3060182%2C49.6511909%20C30.1108927%2C49.4573121%2030.0128297%2C49.2027839%2030.0128297%2C48.9482557%20C30.0128297%2C48.6937276%2030.1108927%2C48.4391994%2030.3060182%2C48.2453205%20C32.1221857%2C46.4407556%2033.206883%2C43.3575844%2033.206883%2C40%20C33.206883%2C36.6424156%2032.1221857%2C33.5592444%2030.3060182%2C31.7546795%20C30.1108927%2C31.5608006%2030.0128297%2C31.3062724%2030.0128297%2C31.0517443%20C30.0128297%2C30.7972161%2030.1108927%2C30.5426879%2030.3060182%2C30.3488091%20C30.6972697%2C29.9600571%2031.3296762%2C29.9600571%2031.7209277%2C30.3488091%20C35.5984204%2C34.2015303%2044.4401044%2C34.2015303%2048.317597%2C30.3488091%20C48.7088485%2C29.9600571%2049.3412551%2C29.9600571%2049.7325066%2C30.3488091%20C49.927632%2C30.5426879%2050.0256951%2C30.7972161%2050.0256951%2C31.0517443%20C50.0256951%2C31.3062724%2049.927632%2C31.5608006%2049.7325066%2C31.7546795%20C47.9163391%2C33.5592444%2046.8316418%2C36.6424156%2046.8316418%2C40%20C46.8316418%2C43.3575844%2047.9163391%2C46.4407556%2049.7325066%2C48.2453205%20C49.927632%2C48.4391994%2050.0256951%2C48.6937276%2050.0256951%2C48.9482557%20C50.0256951%2C49.2027839%2049.927632%2C49.4573121%2049.7325066%2C49.6511909%20C49.5373812%2C49.8450698%2049.2812165%2C49.9425064%2049.0250518%2C49.9425064%20C48.7688871%2C49.9425064%2048.5127225%2C49.8450698%2048.317597%2C49.6511909%20C44.4401044%2C45.7984697%2035.5984204%2C45.7984697%2031.7209277%2C49.6511909%20C31.3296762%2C50.0399429%2030.6972697%2C50.0399429%2030.3060182%2C49.6511909%20L30.3060182%2C49.6511909%20Z%20M66.0009649%2C40.0049713%20C66.0009649%2C39.0783297%2065.6377314%2C38.2073661%2064.9783075%2C37.5521549%20C64.2978701%2C36.8750702%2063.403295%2C36.5380193%2062.5097205%2C36.5380193%20C61.6161461%2C36.5380193%2060.721571%2C36.8750702%2060.0411336%2C37.5521549%20C58.6792581%2C38.9043358%2058.6792581%2C41.1046125%2060.0411336%2C42.4577876%20C61.4020084%2C43.8099684%2063.6154313%2C43.8109627%2064.9783075%2C42.4577876%20C65.6377314%2C41.8025764%2066.0009649%2C40.9316128%2066.0009649%2C40.0049713%20L66.0009649%2C40.0049713%20Z%20M66.3932171%2C43.863658%20C65.3225288%2C44.9275062%2063.916625%2C45.4594303%2062.5097205%2C45.4594303%20C61.1028161%2C45.4594303%2059.6969123%2C44.9275062%2058.626224%2C43.863658%20C56.4838468%2C41.7359616%2056.4838468%2C38.2739809%2058.626224%2C36.1462845%20C60.7686012%2C34.0165997%2064.2528411%2C34.0185882%2066.3932171%2C36.1462845%20C68.5355943%2C38.2739809%2068.5355943%2C41.7359616%2066.3932171%2C43.863658%20L66.3932171%2C43.863658%20Z%20M20.9800229%2C40.027839%20C20.9800229%2C39.1011974%2020.6167894%2C38.2302339%2019.9573654%2C37.5750227%20C19.2979415%2C36.9198115%2018.421378%2C36.5588985%2017.4887785%2C36.5588985%20C16.5571796%2C36.5588985%2015.6806161%2C36.9198115%2015.0201916%2C37.5750227%20C14.3607676%2C38.2302339%2013.9985348%2C39.1011974%2013.9985348%2C40.027839%20C13.9985348%2C40.9534864%2014.3607676%2C41.8244499%2015.0201916%2C42.4806553%20C16.34004%2C43.7900834%2018.6385176%2C43.7900834%2019.9573654%2C42.4806553%20C20.6167894%2C41.8244499%2020.9800229%2C40.9534864%2020.9800229%2C40.027839%20L20.9800229%2C40.027839%20Z%20M21.372275%2C43.8865257%20C20.3015867%2C44.9503739%2018.8956829%2C45.482298%2017.4887785%2C45.482298%20C16.0828747%2C45.482298%2014.6769709%2C44.9503739%2013.605282%2C43.8865257%20C11.464906%2C41.7588294%2011.464906%2C38.2968487%2013.605282%2C36.1691523%20C15.7476592%2C34.0414559%2019.2308984%2C34.0414559%2021.372275%2C36.1691523%20C23.5136516%2C38.2968487%2023.5136516%2C41.7588294%2021.372275%2C43.8865257%20L21.372275%2C43.8865257%20Z%20M54.8958259%2C54.856093%20C50.901258%2C58.8261358%2045.5888428%2C61.0114987%2039.9392109%2C61.0114987%20C34.2875777%2C61.0114987%2028.9761632%2C58.8261358%2024.9815953%2C54.856093%20C22.241834%2C52.134829%2020.7338646%2C48.8826352%2019.9513616%2C46.6346345%20L18.0601458%2C47.2848744%20C18.9116932%2C49.730731%2020.5577514%2C53.273246%2023.5666857%2C56.2619634%20C27.9394968%2C60.607833%2033.7532342%2C63%2039.9392109%2C63%20C46.124187%2C63%2051.9379244%2C60.607833%2056.3107355%2C56.2619634%20C58.8373597%2C53.7534691%2060.8496533%2C50.563913%2061.9793796%2C47.2818917%20L60.0861625%2C46.6376173%20C59.0534987%2C49.6382657%2057.2103138%2C52.5573856%2054.8958259%2C54.856093%20L54.8958259%2C54.856093%20Z%20M19.9503609%2C33.3663597%20L18.0611465%2C32.7141313%20C19.2719248%2C29.2501621%2021.229183%2C26.0606061%2023.5726896%2C23.7330653%20C27.9434994%2C19.3911728%2033.7552355%2C17%2039.9392109%2C17%20C46.1231863%2C17%2051.9349225%2C19.3911728%2056.3047316%2C23.7330653%20C58.7713173%2C26.1838931%2060.8396469%2C29.4569662%2061.9773783%2C32.7141313%20L60.0881638%2C33.3663597%20C59.0444929%2C30.3836078%2057.1502752%2C27.3849479%2054.889822%2C25.1389357%20C50.898256%2C21.1718757%2045.5878422%2C18.9885013%2039.9392109%2C18.9885013%20C34.289579%2C18.9885013%2028.9801658%2C21.1718757%2024.9875992%2C25.1389357%20C22.8542277%2C27.2596723%2021.0650775%2C30.181775%2019.9503609%2C33.3663597%20L19.9503609%2C33.3663597%20Z%22%20id%3D%22AWS-Simple-Queue-Service_Icon_64_Squid%22%20fill%3D%22%23FFFFFF%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E", + "layout": [ + { + "h": 6, + "i": "9e1d91ec-fb66-4cff-b5c5-282270ebffb5", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "053a2c4f-d438-400c-9836-8d67ba2f0a81", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 6, + "i": "823947d5-ea6d-416b-8ec6-de58f5c4099a", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "de63b951-5445-4688-baf0-373479de3100", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 6, + "i": "f7f3a22b-be1b-437d-ba92-43ce0a2532cb", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "ab592416-9156-4e0a-b0b3-704992f5a57c", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + }, + { + "h": 6, + "i": "872a0925-f3d2-495c-8124-431627de55de", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 18 + }, + { + "h": 6, + "i": "b3663090-7d5f-4b39-8f22-6c50f8abd062", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 18 + }, + { + "h": 6, + "i": "2eb22d97-74a3-486b-965a-58e037275ce1", + "w": 6, + "x": 0, + "y": 24 + } + ], + "panelMap": {}, + "tags": [], + "title": "AWS SQS Overview", + "uploadedGrafana": false, + "variables": { + "11f2ffcf-6304-4484-9712-45046a97262f": { + "allSelected": true, + "customValue": "", + "description": "Queue Name", + "id": "11f2ffcf-6304-4484-9712-45046a97262f", + "modificationUUID": "59324736-39cc-4f86-b502-9c6ff7b06378", + "multiSelect": true, + "name": "Queue", + "order": 2, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'QueueName') AS queue\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SQS_ApproximateAgeOfOldestMessage_max' \nAND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} \nAND JSONExtractString(labels, 'cloud.region') IN {{.Region}} \nGROUP BY queue", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "1f7a94df-9735-4bfa-a1b8-dca8ac29f945": { + "allSelected": false, + "customValue": "", + "description": "Account Region", + "id": "1f7a94df-9735-4bfa-a1b8-dca8ac29f945", + "key": "1f7a94df-9735-4bfa-a1b8-dca8ac29f945", + "modificationUUID": "e64806ef-c7b9-44c7-aae5-997ac0a5f042", + "multiSelect": false, + "name": "Region", + "order": 1, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.region') AS region\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SQS_ApproximateAgeOfOldestMessage_max' AND JSONExtractString(labels, 'cloud.account.id') IN {{.Account}} GROUP BY region", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + }, + "93ee15bf-baab-4abf-8828-fe6e75518417": { + "allSelected": false, + "customValue": "", + "description": "AWS Account ID", + "id": "93ee15bf-baab-4abf-8828-fe6e75518417", + "key": "93ee15bf-baab-4abf-8828-fe6e75518417", + "modificationUUID": "dc7edb4b-9bb8-4338-80c9-b8f70187e7e5", + "multiSelect": false, + "name": "Account", + "order": 0, + "queryValue": "SELECT DISTINCT JSONExtractString(labels, 'cloud.account.id') AS `cloud.account.id`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'aws_SQS_ApproximateAgeOfOldestMessage_max' GROUP BY `cloud.account.id`", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "9e1d91ec-fb66-4cff-b5c5-282270ebffb5", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_ApproximateAgeOfOldestMessage_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_ApproximateAgeOfOldestMessage_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f3faf3d7", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "e9f94e6c", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "41729af9", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "58fb81eb-eff1-4b5a-b297-448b182e3e38", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Approximate Age of Oldest Message", + "yAxisUnit": "s" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "053a2c4f-d438-400c-9836-8d67ba2f0a81", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_ApproximateNumberOfMessagesDelayed_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_ApproximateNumberOfMessagesDelayed_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "bcad72b1", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "7e9fbca3", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "78dd8022", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a06e21bc-7bd7-460f-aa4f-7b2bf0c458a9", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Approximate Number of Messages Delayed", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "823947d5-ea6d-416b-8ec6-de58f5c4099a", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_ApproximateNumberOfMessagesNotVisible_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_ApproximateNumberOfMessagesNotVisible_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d20d64d4", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "072f1e3f", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a4b6e74a", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f2b0f843-509f-4ad3-a044-5655f1a64ea4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Approximate Number of Messages Not Visible", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "de63b951-5445-4688-baf0-373479de3100", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_ApproximateNumberOfMessagesVisible_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_ApproximateNumberOfMessagesVisible_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "20a35c55", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "4d702aca", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "b79460ae", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e461ab65-42e2-4e5b-8e86-8f0978936b6f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Approximate Number of Messages Visible", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "f7f3a22b-be1b-437d-ba92-43ce0a2532cb", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_NumberOfEmptyReceives_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_NumberOfEmptyReceives_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d6acfbea", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "c8f19331", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "81572809", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "8a236577-dc88-4ec0-a3c1-9598a3726e72", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Empty Receives", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "ab592416-9156-4e0a-b0b3-704992f5a57c", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_NumberOfMessagesDeleted_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_NumberOfMessagesDeleted_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0fe5e8bd", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "6702e7e6", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "bbf8087b", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "85d52d2e-1105-4ca3-8b9d-0c1096ef56a8", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Messages Deleted", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "872a0925-f3d2-495c-8124-431627de55de", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_NumberOfMessagesReceived_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_NumberOfMessagesReceived_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "52cf9dd8", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "35ebf39a", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "e5025b6e", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "56dc8388-653b-48b6-8141-0ab0f5adf6c3", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Messages Received", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "b3663090-7d5f-4b39-8f22-6c50f8abd062", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_NumberOfMessagesSent_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_NumberOfMessagesSent_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b8f487f1", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "e89032c8", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "ca655170", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "57010fc9-de8a-4fee-b772-0b77d6b982ac", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Number of Messages Sent", + "yAxisUnit": "none" + }, + { + "bucketCount": 30, + "bucketWidth": 0, + "columnUnits": {}, + "description": "", + "fillSpans": false, + "id": "2eb22d97-74a3-486b-965a-58e037275ce1", + "isLogScale": false, + "isStacked": false, + "mergeAllActiveQueries": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_SQS_SentMessageSize_max--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_SQS_SentMessageSize_max", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0711b803", + "key": { + "dataType": "string", + "id": "cloud.account.id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.account.id", + "type": "tag" + }, + "op": "=", + "value": "$Account" + }, + { + "id": "15f30a54", + "key": { + "dataType": "string", + "id": "cloud.region--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cloud.region", + "type": "tag" + }, + "op": "=", + "value": "$Region" + }, + { + "id": "a4527216", + "key": { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + }, + "op": "in", + "value": [ + "$Queue" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "QueueName--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "QueueName", + "type": "tag" + } + ], + "having": [], + "legend": "{{QueueName}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "max", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "98ed9e7b-fabf-4793-ac29-9286fc627e1a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "stackedBarChart": false, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Sent Message Size", + "yAxisUnit": "decbytes" + } + ] +} diff --git a/pkg/query-service/app/cloudintegrations/services/models.go b/pkg/query-service/app/cloudintegrations/services/models.go index 138470d5d7..09fe861e4e 100644 --- a/pkg/query-service/app/cloudintegrations/services/models.go +++ b/pkg/query-service/app/cloudintegrations/services/models.go @@ -1,7 +1,7 @@ package services import ( - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" ) type Metadata struct { @@ -82,10 +82,10 @@ type AWSLogsStrategy struct { } type Dashboard struct { - Id string `json:"id"` - Url string `json:"url"` - Title string `json:"title"` - Description string `json:"description"` - Image string `json:"image"` - Definition *types.DashboardData `json:"definition,omitempty"` + Id string `json:"id"` + Url string `json:"url"` + Title string `json:"title"` + Description string `json:"description"` + Image string `json:"image"` + Definition *dashboardtypes.StorableDashboardData `json:"definition,omitempty"` } diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.go index 8fff0690ad..c3e6c7fb32 100644 --- a/pkg/query-service/app/http_handler.go +++ b/pkg/query-service/app/http_handler.go @@ -20,6 +20,8 @@ import ( "text/template" "time" + "github.com/SigNoz/signoz/pkg/query-service/constants" + "github.com/SigNoz/signoz/pkg/alertmanager" "github.com/SigNoz/signoz/pkg/apis/fields" errorsV2 "github.com/SigNoz/signoz/pkg/errors" @@ -29,7 +31,6 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/app/cloudintegrations/services" "github.com/SigNoz/signoz/pkg/query-service/app/integrations" "github.com/SigNoz/signoz/pkg/query-service/app/metricsexplorer" - "github.com/SigNoz/signoz/pkg/query-service/constants" "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/valuer" "github.com/prometheus/prometheus/promql" @@ -55,12 +56,12 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder" tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3" tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4" - "github.com/SigNoz/signoz/pkg/query-service/auth" "github.com/SigNoz/signoz/pkg/query-service/contextlinks" v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" "github.com/SigNoz/signoz/pkg/query-service/postprocess" "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "github.com/SigNoz/signoz/pkg/types/featuretypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes" ruletypes "github.com/SigNoz/signoz/pkg/types/ruletypes" @@ -255,7 +256,7 @@ func NewAPIHandler(opts APIHandlerOpts) (*APIHandler, error) { aH.queryBuilder = queryBuilder.NewQueryBuilder(builderOpts) // TODO(nitya): remote this in later for multitenancy. - orgs, err := opts.Signoz.Modules.Organization.GetAll(context.Background()) + orgs, err := opts.Signoz.Modules.OrgGetter.ListByOwnedKeyRange(context.Background()) if err != nil { zap.L().Warn("unexpected error while fetching orgs while initializing base api handler", zap.Error(err)) } @@ -513,11 +514,12 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) { router.HandleFunc("/api/v1/downtime_schedules/{id}", am.EditAccess(aH.editDowntimeSchedule)).Methods(http.MethodPut) router.HandleFunc("/api/v1/downtime_schedules/{id}", am.EditAccess(aH.deleteDowntimeSchedule)).Methods(http.MethodDelete) - router.HandleFunc("/api/v1/dashboards", am.ViewAccess(aH.getDashboards)).Methods(http.MethodGet) - router.HandleFunc("/api/v1/dashboards", am.EditAccess(aH.createDashboards)).Methods(http.MethodPost) - router.HandleFunc("/api/v1/dashboards/{uuid}", am.ViewAccess(aH.getDashboard)).Methods(http.MethodGet) - router.HandleFunc("/api/v1/dashboards/{uuid}", am.EditAccess(aH.updateDashboard)).Methods(http.MethodPut) - router.HandleFunc("/api/v1/dashboards/{uuid}", am.EditAccess(aH.Signoz.Handlers.Dashboard.Delete)).Methods(http.MethodDelete) + router.HandleFunc("/api/v1/dashboards", am.ViewAccess(aH.List)).Methods(http.MethodGet) + router.HandleFunc("/api/v1/dashboards", am.EditAccess(aH.Signoz.Handlers.Dashboard.Create)).Methods(http.MethodPost) + router.HandleFunc("/api/v1/dashboards/{id}", am.ViewAccess(aH.Get)).Methods(http.MethodGet) + router.HandleFunc("/api/v1/dashboards/{id}", am.EditAccess(aH.Signoz.Handlers.Dashboard.Update)).Methods(http.MethodPut) + router.HandleFunc("/api/v1/dashboards/{id}", am.EditAccess(aH.Signoz.Handlers.Dashboard.Delete)).Methods(http.MethodDelete) + router.HandleFunc("/api/v1/dashboards/{id}/lock", am.EditAccess(aH.Signoz.Handlers.Dashboard.LockUnlock)).Methods(http.MethodPut) router.HandleFunc("/api/v2/variables/query", am.ViewAccess(aH.queryDashboardVarsV2)).Methods(http.MethodPost) router.HandleFunc("/api/v1/explorer/views", am.ViewAccess(aH.Signoz.Handlers.SavedView.List)).Methods(http.MethodGet) @@ -529,7 +531,6 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router, am *middleware.AuthZ) { router.HandleFunc("/api/v1/feedback", am.OpenAccess(aH.submitFeedback)).Methods(http.MethodPost) router.HandleFunc("/api/v1/event", am.ViewAccess(aH.registerEvent)).Methods(http.MethodPost) - // router.HandleFunc("/api/v1/get_percentiles", aH.getApplicationPercentiles).Methods(http.MethodGet) router.HandleFunc("/api/v1/services", am.ViewAccess(aH.getServices)).Methods(http.MethodPost) router.HandleFunc("/api/v1/services/list", am.ViewAccess(aH.getServicesList)).Methods(http.MethodGet) router.HandleFunc("/api/v1/service/top_operations", am.ViewAccess(aH.getTopOperations)).Methods(http.MethodPost) @@ -1085,77 +1086,6 @@ func (aH *APIHandler) listRules(w http.ResponseWriter, r *http.Request) { aH.Respond(w, rules) } -func (aH *APIHandler) getDashboards(w http.ResponseWriter, r *http.Request) { - claims, errv2 := authtypes.ClaimsFromContext(r.Context()) - if errv2 != nil { - render.Error(w, errv2) - return - } - - allDashboards, errv2 := aH.Signoz.Modules.Dashboard.List(r.Context(), claims.OrgID) - if errv2 != nil { - render.Error(w, errv2) - return - } - - ic := aH.IntegrationsController - installedIntegrationDashboards, err := ic.GetDashboardsForInstalledIntegrations(r.Context(), claims.OrgID) - if err != nil { - zap.L().Error("failed to get dashboards for installed integrations", zap.Error(err)) - } else { - allDashboards = append(allDashboards, installedIntegrationDashboards...) - } - - cloudIntegrationDashboards, err := aH.CloudIntegrationsController.AvailableDashboards(r.Context(), claims.OrgID) - if err != nil { - zap.L().Error("failed to get cloud dashboards", zap.Error(err)) - } else { - allDashboards = append(allDashboards, cloudIntegrationDashboards...) - } - - tagsFromReq, ok := r.URL.Query()["tags"] - if !ok || len(tagsFromReq) == 0 || tagsFromReq[0] == "" { - aH.Respond(w, allDashboards) - return - } - - tags2Dash := make(map[string][]int) - for i := 0; i < len(allDashboards); i++ { - tags, ok := (allDashboards)[i].Data["tags"].([]interface{}) - if !ok { - continue - } - - tagsArray := make([]string, len(tags)) - for i, v := range tags { - tagsArray[i] = v.(string) - } - - for _, tag := range tagsArray { - tags2Dash[tag] = append(tags2Dash[tag], i) - } - - } - - inter := make([]int, len(allDashboards)) - for i := range inter { - inter[i] = i - } - - for _, tag := range tagsFromReq { - inter = Intersection(inter, tags2Dash[tag]) - } - - filteredDashboards := []*types.Dashboard{} - for _, val := range inter { - dash := (allDashboards)[val] - filteredDashboards = append(filteredDashboards, dash) - } - - aH.Respond(w, filteredDashboards) - -} - func prepareQuery(r *http.Request) (string, error) { var postData *model.DashboardVars @@ -1198,7 +1128,139 @@ func prepareQuery(r *http.Request) (string, error) { if tmplErr != nil { return "", tmplErr } - return queryBuf.String(), nil + + if !constants.IsDotMetricsEnabled { + return queryBuf.String(), nil + } + + query = queryBuf.String() + + // Now handle $var replacements (simple string replace) + keys := make([]string, 0, len(vars)) + for k := range vars { + keys = append(keys, k) + } + + sort.Slice(keys, func(i, j int) bool { + return len(keys[i]) > len(keys[j]) + }) + + newQuery := query + for _, k := range keys { + placeholder := "$" + k + v := vars[k] + newQuery = strings.ReplaceAll(newQuery, placeholder, v) + } + + return newQuery, nil +} + +func (aH *APIHandler) Get(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + render.Error(rw, err) + return + } + + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } + + id := mux.Vars(r)["id"] + if id == "" { + render.Error(rw, errorsV2.Newf(errorsV2.TypeInvalidInput, errorsV2.CodeInvalidInput, "id is missing in the path")) + return + } + + dashboard := new(dashboardtypes.Dashboard) + if aH.CloudIntegrationsController.IsCloudIntegrationDashboardUuid(id) { + cloudintegrationDashboard, apiErr := aH.CloudIntegrationsController.GetDashboardById(ctx, orgID, id) + if apiErr != nil { + render.Error(rw, errorsV2.Wrapf(apiErr, errorsV2.TypeInternal, errorsV2.CodeInternal, "failed to get dashboard")) + return + } + dashboard = cloudintegrationDashboard + } else if aH.IntegrationsController.IsInstalledIntegrationDashboardID(id) { + integrationDashboard, apiErr := aH.IntegrationsController.GetInstalledIntegrationDashboardById(ctx, orgID, id) + if apiErr != nil { + render.Error(rw, errorsV2.Wrapf(apiErr, errorsV2.TypeInternal, errorsV2.CodeInternal, "failed to get dashboard")) + return + } + dashboard = integrationDashboard + } else { + dashboardID, err := valuer.NewUUID(id) + if err != nil { + render.Error(rw, err) + return + } + sqlDashboard, err := aH.Signoz.Modules.Dashboard.Get(ctx, orgID, dashboardID) + if err != nil { + render.Error(rw, err) + return + } + dashboard = sqlDashboard + } + + gettableDashboard, err := dashboardtypes.NewGettableDashboardFromDashboard(dashboard) + if err != nil { + render.Error(rw, err) + return + } + + render.Success(rw, http.StatusOK, gettableDashboard) +} + +func (aH *APIHandler) List(rw http.ResponseWriter, r *http.Request) { + ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second) + defer cancel() + + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + render.Error(rw, err) + return + } + + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + render.Error(rw, err) + return + } + + dashboards := make([]*dashboardtypes.Dashboard, 0) + sqlDashboards, err := aH.Signoz.Modules.Dashboard.List(ctx, orgID) + if err != nil && !errorsV2.Ast(err, errorsV2.TypeNotFound) { + render.Error(rw, err) + return + } + if sqlDashboards != nil { + dashboards = append(dashboards, sqlDashboards...) + } + + installedIntegrationDashboards, apiErr := aH.IntegrationsController.GetDashboardsForInstalledIntegrations(ctx, orgID) + if apiErr != nil { + zap.L().Error("failed to get dashboards for installed integrations", zap.Error(apiErr)) + } else { + dashboards = append(dashboards, installedIntegrationDashboards...) + } + + cloudIntegrationDashboards, apiErr := aH.CloudIntegrationsController.AvailableDashboards(ctx, orgID) + if apiErr != nil { + zap.L().Error("failed to get dashboards for cloud integrations", zap.Error(apiErr)) + } else { + dashboards = append(dashboards, cloudIntegrationDashboards...) + } + + gettableDashboards, err := dashboardtypes.NewGettableDashboardsFromDashboards(dashboards) + if err != nil { + render.Error(rw, err) + return + } + render.Success(rw, http.StatusOK, gettableDashboards) } func (aH *APIHandler) queryDashboardVarsV2(w http.ResponseWriter, r *http.Request) { @@ -1216,121 +1278,6 @@ func (aH *APIHandler) queryDashboardVarsV2(w http.ResponseWriter, r *http.Reques aH.Respond(w, dashboardVars) } -func (aH *APIHandler) updateDashboard(w http.ResponseWriter, r *http.Request) { - claims, errv2 := authtypes.ClaimsFromContext(r.Context()) - if errv2 != nil { - render.Error(w, errv2) - return - } - - uuid := mux.Vars(r)["uuid"] - - var postData map[string]interface{} - err := json.NewDecoder(r.Body).Decode(&postData) - if err != nil { - RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, "Error reading request body") - return - } - - err = aH.IsDashboardPostDataSane(&postData) - if err != nil { - RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, "Error reading request body") - return - } - - dashboard, apiError := aH.Signoz.Modules.Dashboard.Update(r.Context(), claims.OrgID, claims.Email, uuid, postData) - if apiError != nil { - render.Error(w, apiError) - return - } - - aH.Respond(w, dashboard) - -} - -func (aH *APIHandler) IsDashboardPostDataSane(data *map[string]interface{}) error { - val, ok := (*data)["title"] - if !ok || val == nil { - return fmt.Errorf("title not found in post data") - } - - return nil -} - -func (aH *APIHandler) getDashboard(w http.ResponseWriter, r *http.Request) { - - uuid := mux.Vars(r)["uuid"] - - claims, errv2 := authtypes.ClaimsFromContext(r.Context()) - if errv2 != nil { - render.Error(w, errv2) - return - } - dashboard, errv2 := aH.Signoz.Modules.Dashboard.Get(r.Context(), claims.OrgID, uuid) - - var apiError *model.ApiError - if errv2 != nil { - if !errorsV2.Ast(errv2, errorsV2.TypeNotFound) { - render.Error(w, errv2) - return - } - - if aH.CloudIntegrationsController.IsCloudIntegrationDashboardUuid(uuid) { - dashboard, apiError = aH.CloudIntegrationsController.GetDashboardById( - r.Context(), claims.OrgID, uuid, - ) - if apiError != nil { - RespondError(w, apiError, nil) - return - } - - } else { - dashboard, apiError = aH.IntegrationsController.GetInstalledIntegrationDashboardById( - r.Context(), claims.OrgID, uuid, - ) - if apiError != nil { - RespondError(w, apiError, nil) - return - } - - } - - } - - aH.Respond(w, dashboard) - -} - -func (aH *APIHandler) createDashboards(w http.ResponseWriter, r *http.Request) { - var postData map[string]interface{} - - err := json.NewDecoder(r.Body).Decode(&postData) - if err != nil { - RespondError(w, &model.ApiError{Typ: model.ErrorInternal, Err: err}, "Error reading request body") - return - } - - err = aH.IsDashboardPostDataSane(&postData) - if err != nil { - RespondError(w, &model.ApiError{Typ: model.ErrorInternal, Err: err}, "Error reading request body") - return - } - claims, errv2 := authtypes.ClaimsFromContext(r.Context()) - if errv2 != nil { - render.Error(w, errv2) - return - } - - dash, errv2 := aH.Signoz.Modules.Dashboard.Create(r.Context(), claims.OrgID, claims.Email, postData) - if errv2 != nil { - render.Error(w, errv2) - return - } - - aH.Respond(w, dash) - -} - func (aH *APIHandler) testRule(w http.ResponseWriter, r *http.Request) { claims, err := authtypes.ClaimsFromContext(r.Context()) if err != nil { @@ -1996,6 +1943,12 @@ func (aH *APIHandler) getFeatureFlags(w http.ResponseWriter, r *http.Request) { } } } + if constants.IsDotMetricsEnabled { + featureSet = append(featureSet, &featuretypes.GettableFeature{ + Name: featuretypes.DotMetricsEnabled, + Active: true, + }) + } aH.Respond(w, featureSet) } @@ -2032,9 +1985,9 @@ func (aH *APIHandler) registerUser(w http.ResponseWriter, r *http.Request) { return } - _, apiErr := auth.Register(context.Background(), &req, aH.Signoz.Alertmanager, aH.Signoz.Modules.Organization, aH.Signoz.Modules.User, aH.Signoz.Modules.QuickFilter) - if apiErr != nil { - RespondError(w, apiErr, nil) + _, errv2 := aH.Signoz.Modules.User.Register(r.Context(), &req) + if errv2 != nil { + render.Error(w, errv2) return } @@ -2503,6 +2456,12 @@ func (aH *APIHandler) onboardKafka(w http.ResponseWriter, r *http.Request) { } } } + var kafkaConsumerFetchLatencyAvg string = "kafka_consumer_fetch_latency_avg" + var kafkaConsumerLag string = "kafka_consumer_group_lag" + if constants.IsDotMetricsEnabled { + kafkaConsumerLag = "kafka.consumer_group.lag" + kafkaConsumerFetchLatencyAvg = "kafka.consumer.fetch_latency_avg" + } if !fetchLatencyState && !consumerLagState { entries = append(entries, kafka.OnboardingResponse{ @@ -2513,27 +2472,28 @@ func (aH *APIHandler) onboardKafka(w http.ResponseWriter, r *http.Request) { } if !fetchLatencyState { + entries = append(entries, kafka.OnboardingResponse{ - Attribute: "kafka_consumer_fetch_latency_avg", + Attribute: kafkaConsumerFetchLatencyAvg, Message: "Metric kafka_consumer_fetch_latency_avg is not present in the given time range.", Status: "0", }) } else { entries = append(entries, kafka.OnboardingResponse{ - Attribute: "kafka_consumer_fetch_latency_avg", + Attribute: kafkaConsumerFetchLatencyAvg, Status: "1", }) } if !consumerLagState { entries = append(entries, kafka.OnboardingResponse{ - Attribute: "kafka_consumer_group_lag", + Attribute: kafkaConsumerLag, Message: "Metric kafka_consumer_group_lag is not present in the given time range.", Status: "0", }) } else { entries = append(entries, kafka.OnboardingResponse{ - Attribute: "kafka_consumer_group_lag", + Attribute: kafkaConsumerLag, Status: "1", }) } @@ -4327,7 +4287,7 @@ func (aH *APIHandler) autocompleteAggregateAttributes(w http.ResponseWriter, r * switch req.DataSource { case v3.DataSourceMetrics: - response, err = aH.reader.GetMetricAggregateAttributes(r.Context(), orgID, req, true, false) + response, err = aH.reader.GetMetricAggregateAttributes(r.Context(), orgID, req, false) case v3.DataSourceLogs: response, err = aH.reader.GetLogAggregateAttributes(r.Context(), req) case v3.DataSourceTraces: @@ -5193,3 +5153,30 @@ func (aH *APIHandler) getDomainInfo(w http.ResponseWriter, r *http.Request) { } aH.Respond(w, resp) } + +// RegisterTraceFunnelsRoutes adds trace funnels routes +func (aH *APIHandler) RegisterTraceFunnelsRoutes(router *mux.Router, am *middleware.AuthZ) { + // Main trace funnels router + traceFunnelsRouter := router.PathPrefix("/api/v1/trace-funnels").Subrouter() + + // API endpoints + traceFunnelsRouter.HandleFunc("/new", + am.EditAccess(aH.Signoz.Handlers.TraceFunnel.New)). + Methods(http.MethodPost) + traceFunnelsRouter.HandleFunc("/list", + am.ViewAccess(aH.Signoz.Handlers.TraceFunnel.List)). + Methods(http.MethodGet) + traceFunnelsRouter.HandleFunc("/steps/update", + am.EditAccess(aH.Signoz.Handlers.TraceFunnel.UpdateSteps)). + Methods(http.MethodPut) + + traceFunnelsRouter.HandleFunc("/{funnel_id}", + am.ViewAccess(aH.Signoz.Handlers.TraceFunnel.Get)). + Methods(http.MethodGet) + traceFunnelsRouter.HandleFunc("/{funnel_id}", + am.EditAccess(aH.Signoz.Handlers.TraceFunnel.Delete)). + Methods(http.MethodDelete) + traceFunnelsRouter.HandleFunc("/{funnel_id}", + am.EditAccess(aH.Signoz.Handlers.TraceFunnel.UpdateFunnel)). + Methods(http.MethodPut) +} diff --git a/pkg/query-service/app/inframetrics/clusters.go b/pkg/query-service/app/inframetrics/clusters.go index b5425c9906..08860609fb 100644 --- a/pkg/query-service/app/inframetrics/clusters.go +++ b/pkg/query-service/app/inframetrics/clusters.go @@ -16,12 +16,12 @@ import ( ) var ( - metricToUseForClusters = "k8s_node_cpu_utilization" + metricToUseForClusters = GetDotMetrics("k8s_node_cpu_utilization") - clusterAttrsToEnrich = []string{"k8s_cluster_name"} + clusterAttrsToEnrich = []string{GetDotMetrics("k8s_cluster_name")} // TODO(srikanthccv): change this to k8s_cluster_uid after showing the missing data banner - k8sClusterUIDAttrKey = "k8s_cluster_name" + k8sClusterUIDAttrKey = GetDotMetrics("k8s_cluster_name") queryNamesForClusters = map[string][]string{ "cpu": {"A"}, diff --git a/pkg/query-service/app/inframetrics/common.go b/pkg/query-service/app/inframetrics/common.go index 8f7a6bab4b..7ee1edbd63 100644 --- a/pkg/query-service/app/inframetrics/common.go +++ b/pkg/query-service/app/inframetrics/common.go @@ -1,6 +1,7 @@ package inframetrics import ( + "fmt" "strings" "time" @@ -8,42 +9,239 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/model" ) +var dotMetricMap = map[string]string{ + "system_cpu_time": "system.cpu.time", + "system_memory_usage": "system.memory.usage", + "system_cpu_load_average_15m": "system.cpu.load_average.15m", + "host_name": "host.name", + "k8s_cluster_name": "k8s.cluster.name", + "k8s_node_name": "k8s.node.name", + "k8s_node_cpu_utilization": "k8s.node.cpu.utilization", + "k8s_pod_cpu_utilization": "k8s.pod.cpu.utilization", + "k8s_pod_memory_usage": "k8s.pod.memory.usage", + "k8s_pod_cpu_request_utilization": "k8s.pod.cpu_request_utilization", + "k8s_pod_memory_request_utilization": "k8s.pod.memory_request_utilization", + "k8s_pod_cpu_limit_utilization": "k8s.pod.cpu_limit_utilization", + "k8s_pod_memory_limit_utilization": "k8s.pod.memory_limit_utilization", + "k8s_container_restarts": "k8s.container.restarts", + "k8s_pod_phase": "k8s.pod.phase", + "k8s_node_allocatable_cpu": "k8s.node.allocatable_cpu", + "k8s_node_allocatable_memory": "k8s.node.allocatable_memory", + "k8s_node_memory_usage": "k8s.node.memory.usage", + "k8s_node_condition_ready": "k8s.node.condition_ready", + "k8s_daemonset_desired_scheduled_nodes": "k8s.daemonset.desired_scheduled_nodes", + "k8s_daemonset_current_scheduled_nodes": "k8s.daemonset.current_scheduled_nodes", + "k8s_deployment_desired": "k8s.deployment.desired", + "k8s_deployment_available": "k8s.deployment.available", + "k8s_job_desired_successful_pods": "k8s.job.desired_successful_pods", + "k8s_job_active_pods": "k8s.job.active_pods", + "k8s_job_failed_pods": "k8s.job.failed_pods", + "k8s_job_successful_pods": "k8s.job.successful_pods", + "k8s_statefulset_desired_pods": "k8s.statefulset.desired_pods", + "k8s_statefulset_current_pods": "k8s.statefulset.current_pods", + "k8s_namespace_name": "k8s.namespace.name", + "k8s_deployment_name": "k8s.deployment.name", + "k8s_cronjob_name": "k8s.cronjob.name", + "k8s_job_name": "k8s.job.name", + "k8s_daemonset_name": "k8s.daemonset.name", + "os_type": "os.type", + "process_cgroup": "process.cgroup", + "process_pid": "process.pid", + "process_parent_pid": "process.parent_pid", + "process_owner": "process.owner", + "process_executable_path": "process.executable.path", + "process_executable_name": "process.executable.name", + "process_command_line": "process.command_line", + "process_command": "process.command", + "process_memory_usage": "process.memory.usage", + "k8s_persistentvolumeclaim_name": "k8s.persistentvolumeclaim.name", + "k8s_volume_available": "k8s.volume.available", + "k8s_volume_capacity": "k8s.volume.capacity", + "k8s_volume_inodes": "k8s.volume.inodes", + "k8s_volume_inodes_free": "k8s.volume.inodes.free", + // add additional mappings as needed + + "k8s_pod_uid": "k8s.pod.uid", + "k8s_pod_name": "k8s.pod.name", + "k8s_container_name": "k8s.container.name", + "container_id": "container.id", + "k8s_volume_name": "k8s.volume.name", + "k8s_volume_type": "k8s.volume.type", + "aws_volume_id": "aws.volume.id", + "fs_type": "fs.type", + "partition": "partition", + "gce_pd_name": "gce.pd.name", + "glusterfs_endpoints_name": "glusterfs.endpoints.name", + "glusterfs_path": "glusterfs.path", + "interface": "interface", + "direction": "direction", + + "k8s_node_cpu_usage": "k8s.node.cpu.usage", + "k8s_node_cpu_time": "k8s.node.cpu.time", + "k8s_node_memory_available": "k8s.node.memory.available", + "k8s_node_memory_rss": "k8s.node.memory.rss", + "k8s_node_memory_working_set": "k8s.node.memory.working_set", + "k8s_node_memory_page_faults": "k8s.node.memory.page_faults", + "k8s_node_memory_major_page_faults": "k8s.node.memory.major_page_faults", + "k8s_node_filesystem_available": "k8s.node.filesystem.available", + "k8s_node_filesystem_capacity": "k8s.node.filesystem.capacity", + "k8s_node_filesystem_usage": "k8s.node.filesystem.usage", + "k8s_node_network_io": "k8s.node.network.io", + "k8s_node_network_errors": "k8s.node.network.errors", + "k8s_node_uptime": "k8s.node.uptime", + + "k8s_pod_cpu_usage": "k8s.pod.cpu.usage", + "k8s_pod_cpu_time": "k8s.pod.cpu.time", + "k8s_pod_memory_available": "k8s.pod.memory.available", + "k8s_pod_cpu_node_utilization": "k8s.pod.cpu.node.utilization", + "k8s_pod_memory_node_utilization": "k8s.pod.memory.node.utilization", + "k8s_pod_memory_rss": "k8s.pod.memory.rss", + "k8s_pod_memory_working_set": "k8s.pod.memory.working_set", + "k8s_pod_memory_page_faults": "k8s.pod.memory.page_faults", + "k8s_pod_memory_major_page_faults": "k8s.pod.memory.major_page_faults", + "k8s_pod_filesystem_available": "k8s.pod.filesystem.available", + "k8s_pod_filesystem_capacity": "k8s.pod.filesystem.capacity", + "k8s_pod_filesystem_usage": "k8s.pod.filesystem.usage", + "k8s_pod_network_io": "k8s.pod.network.io", + "k8s_pod_network_errors": "k8s.pod.network.errors", + "k8s_pod_uptime": "k8s.pod.uptime", + + "container_cpu_usage": "container.cpu.usage", + "container_cpu_utilization": "container.cpu.utilization", + "container_cpu_time": "container.cpu.time", + "container_memory_available": "container.memory.available", + "container_memory_usage": "container.memory.usage", + "k8s_container_cpu_node_utilization": "k8s.container.cpu.node.utilization", + "k8s_container_cpu_limit_utilization": "k8s.container.cpu_limit_utilization", + "k8s_container_cpu_request_utilization": "k8s.container.cpu_request_utilization", + "k8s_container_memory_node_utilization": "k8s.container.memory.node.utilization", + "k8s_container_memory_limit_utilization": "k8s.container.memory_limit_utilization", + "k8s_container_memory_request_utilization": "k8s.container.memory_request_utilization", + "container_memory_rss": "container.memory.rss", + "container_memory_working_set": "container.memory.working_set", + "container_memory_page_faults": "container.memory.page_faults", + "container_memory_major_page_faults": "container.memory.major_page_faults", + "container_filesystem_available": "container.filesystem.available", + "container_filesystem_capacity": "container.filesystem.capacity", + "container_filesystem_usage": "container.filesystem.usage", + "container_uptime": "container.uptime", + + "k8s_volume_inodes_used": "k8s.volume.inodes.used", + + "k8s_namespace_uid": "k8s.namespace.uid", + "container_image_name": "container.image.name", + "container_image_tag": "container.image.tag", + "k8s_pod_qos_class": "k8s.pod.qos_class", + "k8s_replicaset_name": "k8s.replicaset.name", + "k8s_replicaset_uid": "k8s.replicaset.uid", + "k8s_replicationcontroller_name": "k8s.replicationcontroller.name", + "k8s_replicationcontroller_uid": "k8s.replicationcontroller.uid", + "k8s_resourcequota_uid": "k8s.resourcequota.uid", + "k8s_resourcequota_name": "k8s.resourcequota.name", + "k8s_statefulset_uid": "k8s.statefulset.uid", + "k8s_statefulset_name": "k8s.statefulset.name", + "k8s_deployment_uid": "k8s.deployment.uid", + "k8s_cronjob_uid": "k8s.cronjob.uid", + "k8s_daemonset_uid": "k8s.daemonset.uid", + "k8s_hpa_uid": "k8s.hpa.uid", + "k8s_hpa_name": "k8s.hpa.name", + "k8s_hpa_scaletargetref_kind": "k8s.hpa.scaletargetref.kind", + "k8s_hpa_scaletargetref_name": "k8s.hpa.scaletargetref.name", + "k8s_hpa_scaletargetref_apiversion": "k8s.hpa.scaletargetref.apiversion", + "k8s_job_uid": "k8s.job.uid", + "k8s_kubelet_version": "k8s.kubelet.version", + "container_runtime": "container.runtime", + "container_runtime_version": "container.runtime.version", + "os_description": "os.description", + "openshift_clusterquota_uid": "openshift.clusterquota.uid", + "openshift_clusterquota_name": "openshift.clusterquota.name", + "k8s_container_status_last_terminated_reason": "k8s.container.status.last_terminated_reason", + + "resource": "resource", + "condition": "condition", + + "k8s_container_cpu_request": "k8s.container.cpu_request", + "k8s_container_cpu_limit": "k8s.container.cpu_limit", + "k8s_container_memory_request": "k8s.container.memory_request", + "k8s_container_memory_limit": "k8s.container.memory_limit", + "k8s_container_storage_request": "k8s.container.storage_request", + "k8s_container_storage_limit": "k8s.container.storage_limit", + "k8s_container_ephemeralstorage_request": "k8s.container.ephemeralstorage_request", + "k8s_container_ephemeralstorage_limit": "k8s.container.ephemeralstorage_limit", + "k8s_container_ready": "k8s.container.ready", + + "k8s_pod_status_reason": "k8s.pod.status_reason", + + "k8s_cronjob_active_jobs": "k8s.cronjob.active_jobs", + + "k8s_daemonset_misscheduled_nodes": "k8s.daemonset.misscheduled_nodes", + "k8s_daemonset_ready_nodes": "k8s.daemonset.ready_nodes", + + "k8s_hpa_max_replicas": "k8s.hpa.max_replicas", + "k8s_hpa_min_replicas": "k8s.hpa.min_replicas", + "k8s_hpa_current_replicas": "k8s.hpa.current_replicas", + "k8s_hpa_desired_replicas": "k8s.hpa.desired_replicas", + + "k8s_job_max_parallel_pods": "k8s.job.max_parallel_pods", + + "k8s_namespace_phase": "k8s.namespace.phase", + + "k8s_replicaset_desired": "k8s.replicaset.desired", + "k8s_replicaset_available": "k8s.replicaset.available", + + "k8s_replication_controller_desired": "k8s.replication_controller.desired", + "k8s_replication_controller_available": "k8s.replication_controller.available", + + "k8s_resource_quota_hard_limit": "k8s.resource_quota.hard_limit", + "k8s_resource_quota_used": "k8s.resource_quota.used", + + "k8s_statefulset_updated_pods": "k8s.statefulset.updated_pods", + + "k8s_node_condition": "k8s.node.condition", +} + +const fromWhereQuery = ` +FROM %s.%s +WHERE metric_name IN (%s) + AND unix_milli >= toUnixTimestamp(now() - toIntervalMinute(60)) * 1000 +` + var ( // TODO(srikanthccv): import metadata yaml from receivers and use generated files to check the metrics podMetricNamesToCheck = []string{ - "k8s_pod_cpu_utilization", - "k8s_pod_memory_usage", - "k8s_pod_cpu_request_utilization", - "k8s_pod_memory_request_utilization", - "k8s_pod_cpu_limit_utilization", - "k8s_pod_memory_limit_utilization", - "k8s_container_restarts", - "k8s_pod_phase", + GetDotMetrics("k8s_pod_cpu_utilization"), + GetDotMetrics("k8s_pod_memory_usage"), + GetDotMetrics("k8s_pod_cpu_request_utilization"), + GetDotMetrics("k8s_pod_memory_request_utilization"), + GetDotMetrics("k8s_pod_cpu_limit_utilization"), + GetDotMetrics("k8s_pod_memory_limit_utilization"), + GetDotMetrics("k8s_container_restarts"), + GetDotMetrics("k8s_pod_phase"), } nodeMetricNamesToCheck = []string{ - "k8s_node_cpu_utilization", - "k8s_node_allocatable_cpu", - "k8s_node_memory_usage", - "k8s_node_allocatable_memory", - "k8s_node_condition_ready", + GetDotMetrics("k8s_node_cpu_utilization"), + GetDotMetrics("k8s_node_allocatable_cpu"), + GetDotMetrics("k8s_node_memory_usage"), + GetDotMetrics("k8s_node_allocatable_memory"), + GetDotMetrics("k8s_node_condition_ready"), } clusterMetricNamesToCheck = []string{ - "k8s_daemonset_desired_scheduled_nodes", - "k8s_daemonset_current_scheduled_nodes", - "k8s_deployment_desired", - "k8s_deployment_available", - "k8s_job_desired_successful_pods", - "k8s_job_active_pods", - "k8s_job_failed_pods", - "k8s_job_successful_pods", - "k8s_statefulset_desired_pods", - "k8s_statefulset_current_pods", + GetDotMetrics("k8s_daemonset_desired_scheduled_nodes"), + GetDotMetrics("k8s_daemonset_current_scheduled_nodes"), + GetDotMetrics("k8s_deployment_desired"), + GetDotMetrics("k8s_deployment_available"), + GetDotMetrics("k8s_job_desired_successful_pods"), + GetDotMetrics("k8s_job_active_pods"), + GetDotMetrics("k8s_job_failed_pods"), + GetDotMetrics("k8s_job_successful_pods"), + GetDotMetrics("k8s_statefulset_desired_pods"), + GetDotMetrics("k8s_statefulset_current_pods"), } optionalPodMetricNamesToCheck = []string{ - "k8s_pod_cpu_request_utilization", - "k8s_pod_memory_request_utilization", - "k8s_pod_cpu_limit_utilization", - "k8s_pod_memory_limit_utilization", + GetDotMetrics("k8s_pod_cpu_request_utilization"), + GetDotMetrics("k8s_pod_memory_request_utilization"), + GetDotMetrics("k8s_pod_cpu_limit_utilization"), + GetDotMetrics("k8s_pod_memory_limit_utilization"), } // did they ever send _any_ pod metrics? @@ -68,22 +266,40 @@ var ( ` // there should be [cluster, node, namespace, one of (deployment, statefulset, daemonset, cronjob, job)] for each pod - isSendingRequiredMetadataQuery = ` - SELECT any(JSONExtractString(labels, 'k8s_cluster_name')) as k8s_cluster_name, - any(JSONExtractString(labels, 'k8s_node_name')) as k8s_node_name, - any(JSONExtractString(labels, 'k8s_namespace_name')) as k8s_namespace_name, - any(JSONExtractString(labels, 'k8s_deployment_name')) as k8s_deployment_name, - any(JSONExtractString(labels, 'k8s_statefulset_name')) as k8s_statefulset_name, - any(JSONExtractString(labels, 'k8s_daemonset_name')) as k8s_daemonset_name, - any(JSONExtractString(labels, 'k8s_cronjob_name')) as k8s_cronjob_name, - any(JSONExtractString(labels, 'k8s_job_name')) as k8s_job_name, - JSONExtractString(labels, 'k8s_pod_name') as k8s_pod_name - FROM %s.%s WHERE metric_name IN (%s) - AND (unix_milli >= (toUnixTimestamp(now() - toIntervalMinute(60)) * 1000)) - AND JSONExtractString(labels, 'k8s_namespace_name') NOT IN ('kube-system', 'kube-public', 'kube-node-lease', 'metallb-system') - GROUP BY k8s_pod_name - LIMIT 1 BY k8s_cluster_name, k8s_node_name, k8s_namespace_name -` + + selectQuery = fmt.Sprintf(` +SELECT + any(JSONExtractString(labels, '%s')) as k8s_cluster_name, + any(JSONExtractString(labels, '%s')) as k8s_node_name, + any(JSONExtractString(labels, '%s')) as k8s_namespace_name, + any(JSONExtractString(labels, '%s')) as k8s_deployment_name, + any(JSONExtractString(labels, '%s')) as k8s_statefulset_name, + any(JSONExtractString(labels, '%s')) as k8s_daemonset_name, + any(JSONExtractString(labels, '%s')) as k8s_cronjob_name, + any(JSONExtractString(labels, '%s')) as k8s_job_name, + JSONExtractString(labels, '%s') as k8s_pod_name +`, + GetDotMetrics("k8s_cluster_name"), + GetDotMetrics("k8s_node_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_deployment_name"), + GetDotMetrics("k8s_statefulset_name"), + GetDotMetrics("k8s_daemonset_name"), + GetDotMetrics("k8s_cronjob_name"), + GetDotMetrics("k8s_job_name"), + GetDotMetrics("k8s_pod_name"), + ) + + filterGroupQuery = fmt.Sprintf(` +AND JSONExtractString(labels, '%s') + NOT IN ('kube-system','kube-public','kube-node-lease','metallb-system') +GROUP BY k8s_pod_name +LIMIT 1 BY k8s_cluster_name, k8s_node_name, k8s_namespace_name +`, + GetDotMetrics("k8s_namespace_name"), + ) + + isSendingRequiredMetadataQuery = selectQuery + fromWhereQuery + filterGroupQuery ) // getParamsForTopItems returns the step, time series table name and samples table name @@ -181,3 +397,12 @@ func getParamsForTopVolumes(req model.VolumeListRequest) (int64, string, string) func localQueryToDistributedQuery(query string) string { return strings.Replace(query, ".time_series_v4", ".distributed_time_series_v4", 1) } + +func GetDotMetrics(key string) string { + if constants.IsDotMetricsEnabled { + if _, ok := dotMetricMap[key]; ok { + return dotMetricMap[key] + } + } + return key +} diff --git a/pkg/query-service/app/inframetrics/daemonsets.go b/pkg/query-service/app/inframetrics/daemonsets.go index c5a9aaee49..85b31248b2 100644 --- a/pkg/query-service/app/inframetrics/daemonsets.go +++ b/pkg/query-service/app/inframetrics/daemonsets.go @@ -16,18 +16,18 @@ import ( ) var ( - metricToUseForDaemonSets = "k8s_pod_cpu_utilization" - k8sDaemonSetNameAttrKey = "k8s_daemonset_name" + metricToUseForDaemonSets = GetDotMetrics("k8s_pod_cpu_utilization") + k8sDaemonSetNameAttrKey = GetDotMetrics("k8s_daemonset_name") metricNamesForDaemonSets = map[string]string{ - "desired_nodes": "k8s_daemonset_desired_scheduled_nodes", - "available_nodes": "k8s_daemonset_current_scheduled_nodes", + "desired_nodes": GetDotMetrics("k8s_daemonset_desired_scheduled_nodes"), + "available_nodes": GetDotMetrics("k8s_daemonset_current_scheduled_nodes"), } daemonSetAttrsToEnrich = []string{ - "k8s_daemonset_name", - "k8s_namespace_name", - "k8s_cluster_name", + GetDotMetrics("k8s_daemonset_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_cluster_name"), } queryNamesForDaemonSets = map[string][]string{ diff --git a/pkg/query-service/app/inframetrics/deployments.go b/pkg/query-service/app/inframetrics/deployments.go index 9865c2ccde..3645d1a33a 100644 --- a/pkg/query-service/app/inframetrics/deployments.go +++ b/pkg/query-service/app/inframetrics/deployments.go @@ -16,18 +16,18 @@ import ( ) var ( - metricToUseForDeployments = "k8s_pod_cpu_utilization" - k8sDeploymentNameAttrKey = "k8s_deployment_name" + metricToUseForDeployments = GetDotMetrics("k8s_pod_cpu_utilization") + k8sDeploymentNameAttrKey = GetDotMetrics("k8s_deployment_name") metricNamesForDeployments = map[string]string{ - "desired_pods": "k8s_deployment_desired", - "available_pods": "k8s_deployment_available", + "desired_pods": GetDotMetrics("k8s_deployment_desired"), + "available_pods": GetDotMetrics("k8s_deployment_available"), } deploymentAttrsToEnrich = []string{ - "k8s_deployment_name", - "k8s_namespace_name", - "k8s_cluster_name", + GetDotMetrics("k8s_deployment_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_cluster_name"), } queryNamesForDeployments = map[string][]string{ diff --git a/pkg/query-service/app/inframetrics/hosts.go b/pkg/query-service/app/inframetrics/hosts.go index db0f380238..82cf75f15d 100644 --- a/pkg/query-service/app/inframetrics/hosts.go +++ b/pkg/query-service/app/inframetrics/hosts.go @@ -41,15 +41,15 @@ var ( "mode", "mountpoint", "type", - "os_type", - "process_cgroup", - "process_command", - "process_command_line", - "process_executable_name", - "process_executable_path", - "process_owner", - "process_parent_pid", - "process_pid", + GetDotMetrics("os_type"), + GetDotMetrics("process_cgroup"), + GetDotMetrics("process_command"), + GetDotMetrics("process_command_line"), + GetDotMetrics("process_executable_name"), + GetDotMetrics("process_executable_path"), + GetDotMetrics("process_owner"), + GetDotMetrics("process_parent_pid"), + GetDotMetrics("process_pid"), } queryNamesForTopHosts = map[string][]string{ @@ -60,17 +60,17 @@ var ( } // TODO(srikanthccv): remove hardcoded metric name and support keys from any system metric - metricToUseForHostAttributes = "system_cpu_load_average_15m" - hostNameAttrKey = "host_name" + metricToUseForHostAttributes = GetDotMetrics("system_cpu_load_average_15m") + hostNameAttrKey = GetDotMetrics("host_name") agentNameToIgnore = "k8s-infra-otel-agent" hostAttrsToEnrich = []string{ - "os_type", + GetDotMetrics("os_type"), } metricNamesForHosts = map[string]string{ - "cpu": "system_cpu_time", - "memory": "system_memory_usage", - "load15": "system_cpu_load_average_15m", - "wait": "system_cpu_time", + "cpu": GetDotMetrics("system_cpu_time"), + "memory": GetDotMetrics("system_memory_usage"), + "load15": GetDotMetrics("system_cpu_load_average_15m"), + "wait": GetDotMetrics("system_cpu_time"), } ) @@ -351,13 +351,14 @@ func (h *HostsRepo) IsSendingK8SAgentMetrics(ctx context.Context, req model.Host constants.SIGNOZ_METRIC_DBNAME, constants.SIGNOZ_SAMPLES_V4_TABLENAME, namesStr) query := fmt.Sprintf(` - SELECT DISTINCT JSONExtractString(labels, 'k8s_cluster_name') as k8s_cluster_name, JSONExtractString(labels, 'k8s_node_name') as k8s_node_name + SELECT DISTINCT JSONExtractString(labels, '%s') as k8s_cluster_name, JSONExtractString(labels, '%s') as k8s_node_name FROM %s.%s WHERE metric_name IN (%s) AND unix_milli >= toUnixTimestamp(now() - INTERVAL 60 MINUTE) * 1000 - AND JSONExtractString(labels, 'host_name') LIKE '%%-otel-agent%%' + AND JSONExtractString(labels, '%s') LIKE '%%-otel-agent%%' AND fingerprint GLOBAL IN (%s)`, - constants.SIGNOZ_METRIC_DBNAME, constants.SIGNOZ_TIMESERIES_V4_TABLENAME, namesStr, queryForRecentFingerprints) + GetDotMetrics("k8s_cluster_name"), GetDotMetrics("k8s_node_name"), + constants.SIGNOZ_METRIC_DBNAME, constants.SIGNOZ_TIMESERIES_V4_TABLENAME, namesStr, GetDotMetrics("host_name"), queryForRecentFingerprints) result, err := h.reader.GetListResultV3(ctx, query) if err != nil { @@ -368,13 +369,13 @@ func (h *HostsRepo) IsSendingK8SAgentMetrics(ctx context.Context, req model.Host nodeNames := make(map[string]struct{}) for _, row := range result { - switch v := row.Data["k8s_cluster_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_cluster_name")].(type) { case string: clusterNames[v] = struct{}{} case *string: clusterNames[*v] = struct{}{} } - switch v := row.Data["k8s_node_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_node_name")].(type) { case string: nodeNames[v] = struct{}{} case *string: diff --git a/pkg/query-service/app/inframetrics/jobs.go b/pkg/query-service/app/inframetrics/jobs.go index 7f8aa61b70..654d633def 100644 --- a/pkg/query-service/app/inframetrics/jobs.go +++ b/pkg/query-service/app/inframetrics/jobs.go @@ -16,20 +16,20 @@ import ( ) var ( - metricToUseForJobs = "k8s_job_desired_successful_pods" - k8sJobNameAttrKey = "k8s_job_name" + metricToUseForJobs = GetDotMetrics("k8s_job_desired_successful_pods") + k8sJobNameAttrKey = GetDotMetrics("k8s_job_name") metricNamesForJobs = map[string]string{ - "desired_successful_pods": "k8s_job_desired_successful_pods", - "active_pods": "k8s_job_active_pods", - "failed_pods": "k8s_job_failed_pods", - "successful_pods": "k8s_job_successful_pods", + "desired_successful_pods": GetDotMetrics("k8s_job_desired_successful_pods"), + "active_pods": GetDotMetrics("k8s_job_active_pods"), + "failed_pods": GetDotMetrics("k8s_job_failed_pods"), + "successful_pods": GetDotMetrics("k8s_job_successful_pods"), } jobAttrsToEnrich = []string{ - "k8s_job_name", - "k8s_namespace_name", - "k8s_cluster_name", + GetDotMetrics("k8s_job_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_cluster_name"), } queryNamesForJobs = map[string][]string{ @@ -52,7 +52,7 @@ var ( QueryName: "H", DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: metricNamesForJobs["desired_successful_pods"], + Key: GetDotMetrics(metricNamesForJobs["desired_successful_pods"]), DataType: v3.AttributeKeyDataTypeFloat64, }, Temporality: v3.Unspecified, @@ -72,7 +72,7 @@ var ( QueryName: "I", DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: metricNamesForJobs["active_pods"], + Key: GetDotMetrics(metricNamesForJobs["active_pods"]), DataType: v3.AttributeKeyDataTypeFloat64, }, Temporality: v3.Unspecified, @@ -92,7 +92,7 @@ var ( QueryName: "J", DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: metricNamesForJobs["failed_pods"], + Key: GetDotMetrics(metricNamesForJobs["failed_pods"]), DataType: v3.AttributeKeyDataTypeFloat64, }, Temporality: v3.Unspecified, @@ -112,7 +112,7 @@ var ( QueryName: "K", DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: metricNamesForJobs["successful_pods"], + Key: GetDotMetrics(metricNamesForJobs["successful_pods"]), DataType: v3.AttributeKeyDataTypeFloat64, }, Temporality: v3.Unspecified, @@ -321,7 +321,7 @@ func (d *JobsRepo) GetJobList(ctx context.Context, orgID valuer.UUID, req model. } if req.OrderBy == nil { - req.OrderBy = &v3.OrderBy{ColumnName: "desired_pods", Order: v3.DirectionDesc} + req.OrderBy = &v3.OrderBy{ColumnName: GetDotMetrics("desired_pods"), Order: v3.DirectionDesc} } if req.GroupBy == nil { diff --git a/pkg/query-service/app/inframetrics/namespaces.go b/pkg/query-service/app/inframetrics/namespaces.go index b3c6249190..32606d7282 100644 --- a/pkg/query-service/app/inframetrics/namespaces.go +++ b/pkg/query-service/app/inframetrics/namespaces.go @@ -16,11 +16,11 @@ import ( ) var ( - metricToUseForNamespaces = "k8s_pod_cpu_utilization" + metricToUseForNamespaces = GetDotMetrics("k8s_pod_cpu_utilization") namespaceAttrsToEnrich = []string{ - "k8s_namespace_name", - "k8s_cluster_name", + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_cluster_name"), } queryNamesForNamespaces = map[string][]string{ @@ -31,11 +31,11 @@ var ( namespaceQueryNames = []string{"A", "D", "H", "I", "J", "K"} attributesKeysForNamespaces = []v3.AttributeKey{ - {Key: "k8s_namespace_name"}, - {Key: "k8s_cluster_name"}, + {Key: GetDotMetrics("k8s_namespace_name")}, + {Key: GetDotMetrics("k8s_cluster_name")}, } - k8sNamespaceNameAttrKey = "k8s_namespace_name" + k8sNamespaceNameAttrKey = GetDotMetrics("k8s_namespace_name") ) type NamespacesRepo struct { diff --git a/pkg/query-service/app/inframetrics/nodes.go b/pkg/query-service/app/inframetrics/nodes.go index 7e1cfeffce..df0095a791 100644 --- a/pkg/query-service/app/inframetrics/nodes.go +++ b/pkg/query-service/app/inframetrics/nodes.go @@ -3,10 +3,6 @@ package inframetrics import ( "context" "fmt" - "math" - "sort" - "strings" - "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v4/helpers" "github.com/SigNoz/signoz/pkg/query-service/common" "github.com/SigNoz/signoz/pkg/query-service/constants" @@ -16,14 +12,17 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/postprocess" "github.com/SigNoz/signoz/pkg/valuer" "golang.org/x/exp/slices" + "math" + "sort" + "strings" ) var ( - metricToUseForNodes = "k8s_node_cpu_utilization" + metricToUseForNodes = GetDotMetrics("k8s_node_cpu_utilization") - nodeAttrsToEnrich = []string{"k8s_node_name", "k8s_node_uid", "k8s_cluster_name"} + nodeAttrsToEnrich = []string{GetDotMetrics("k8s_node_name"), GetDotMetrics("k8s_node_uid"), GetDotMetrics("k8s_cluster_name")} - k8sNodeGroupAttrKey = "k8s_node_name" + k8sNodeGroupAttrKey = GetDotMetrics("k8s_node_name") queryNamesForNodes = map[string][]string{ "cpu": {"A"}, @@ -34,11 +33,11 @@ var ( nodeQueryNames = []string{"A", "B", "C", "D", "E", "F"} metricNamesForNodes = map[string]string{ - "cpu": "k8s_node_cpu_utilization", - "cpu_allocatable": "k8s_node_allocatable_cpu", - "memory": "k8s_node_memory_usage", - "memory_allocatable": "k8s_node_allocatable_memory", - "node_condition": "k8s_node_condition_ready", + "cpu": GetDotMetrics("k8s_node_cpu_utilization"), + "cpu_allocatable": GetDotMetrics("k8s_node_allocatable_cpu"), + "memory": GetDotMetrics("k8s_node_memory_usage"), + "memory_allocatable": GetDotMetrics("k8s_node_allocatable_memory"), + "node_condition": GetDotMetrics("k8s_node_condition_ready"), } ) diff --git a/pkg/query-service/app/inframetrics/pods.go b/pkg/query-service/app/inframetrics/pods.go index a895b75623..d3a5a32325 100644 --- a/pkg/query-service/app/inframetrics/pods.go +++ b/pkg/query-service/app/inframetrics/pods.go @@ -19,22 +19,22 @@ import ( ) var ( - metricToUseForPods = "k8s_pod_cpu_utilization" + metricToUseForPods = GetDotMetrics("k8s_pod_cpu_utilization") podAttrsToEnrich = []string{ - "k8s_pod_uid", - "k8s_pod_name", - "k8s_namespace_name", - "k8s_node_name", - "k8s_deployment_name", - "k8s_statefulset_name", - "k8s_daemonset_name", - "k8s_job_name", - "k8s_cronjob_name", - "k8s_cluster_name", + GetDotMetrics("k8s_pod_uid"), + GetDotMetrics("k8s_pod_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_node_name"), + GetDotMetrics("k8s_deployment_name"), + GetDotMetrics("k8s_statefulset_name"), + GetDotMetrics("k8s_daemonset_name"), + GetDotMetrics("k8s_job_name"), + GetDotMetrics("k8s_cronjob_name"), + GetDotMetrics("k8s_cluster_name"), } - k8sPodUIDAttrKey = "k8s_pod_uid" + k8sPodUIDAttrKey = GetDotMetrics("k8s_pod_uid") queryNamesForPods = map[string][]string{ "cpu": {"A"}, @@ -49,14 +49,14 @@ var ( podQueryNames = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"} metricNamesForPods = map[string]string{ - "cpu": "k8s_pod_cpu_utilization", - "cpu_request": "k8s_pod_cpu_request_utilization", - "cpu_limit": "k8s_pod_cpu_limit_utilization", - "memory": "k8s_pod_memory_usage", - "memory_request": "k8s_pod_memory_request_utilization", - "memory_limit": "k8s_pod_memory_limit_utilization", - "restarts": "k8s_container_restarts", - "pod_phase": "k8s_pod_phase", + "cpu": GetDotMetrics("k8s_pod_cpu_utilization"), + "cpu_request": GetDotMetrics("k8s_pod_cpu_request_utilization"), + "cpu_limit": GetDotMetrics("k8s_pod_cpu_limit_utilization"), + "memory": GetDotMetrics("k8s_pod_memory_usage"), + "memory_request": GetDotMetrics("k8s_pod_memory_request_utilization"), + "memory_limit": GetDotMetrics("k8s_pod_memory_limit_utilization"), + "restarts": GetDotMetrics("k8s_container_restarts"), + "pod_phase": GetDotMetrics("k8s_pod_phase"), } ) @@ -167,7 +167,7 @@ func (p *PodsRepo) SendingRequiredMetadata(ctx context.Context) ([]model.PodOnbo // for each pod, check if we have all the required metadata for _, row := range result { status := model.PodOnboardingStatus{} - switch v := row.Data["k8s_cluster_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_cluster_name")].(type) { case string: status.HasClusterName = true status.ClusterName = v @@ -175,7 +175,7 @@ func (p *PodsRepo) SendingRequiredMetadata(ctx context.Context) ([]model.PodOnbo status.HasClusterName = *v != "" status.ClusterName = *v } - switch v := row.Data["k8s_node_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_node_name")].(type) { case string: status.HasNodeName = true status.NodeName = v @@ -183,7 +183,7 @@ func (p *PodsRepo) SendingRequiredMetadata(ctx context.Context) ([]model.PodOnbo status.HasNodeName = *v != "" status.NodeName = *v } - switch v := row.Data["k8s_namespace_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_namespace_name")].(type) { case string: status.HasNamespaceName = true status.NamespaceName = v @@ -191,38 +191,38 @@ func (p *PodsRepo) SendingRequiredMetadata(ctx context.Context) ([]model.PodOnbo status.HasNamespaceName = *v != "" status.NamespaceName = *v } - switch v := row.Data["k8s_deployment_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_deployment_name")].(type) { case string: status.HasDeploymentName = true case *string: status.HasDeploymentName = *v != "" } - switch v := row.Data["k8s_statefulset_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_statefulset_name")].(type) { case string: status.HasStatefulsetName = true case *string: status.HasStatefulsetName = *v != "" } - switch v := row.Data["k8s_daemonset_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_daemonset_name")].(type) { case string: status.HasDaemonsetName = true case *string: status.HasDaemonsetName = *v != "" } - switch v := row.Data["k8s_cronjob_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_cronjob_name")].(type) { case string: status.HasCronjobName = true case *string: status.HasCronjobName = *v != "" } - switch v := row.Data["k8s_job_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_job_name")].(type) { case string: status.HasJobName = true case *string: status.HasJobName = *v != "" } - switch v := row.Data["k8s_pod_name"].(type) { + switch v := row.Data[GetDotMetrics("k8s_pod_name")].(type) { case string: status.PodName = v case *string: diff --git a/pkg/query-service/app/inframetrics/processes.go b/pkg/query-service/app/inframetrics/processes.go index 192b290cae..a088e6ad57 100644 --- a/pkg/query-service/app/inframetrics/processes.go +++ b/pkg/query-service/app/inframetrics/processes.go @@ -21,15 +21,15 @@ var ( "memory": {"C"}, } - processPIDAttrKey = "process_pid" + processPIDAttrKey = GetDotMetrics("process_pid") metricNamesForProcesses = map[string]string{ - "cpu": "process_cpu_time", - "memory": "process_memory_usage", + "cpu": GetDotMetrics("process_cpu_time"), + "memory": GetDotMetrics("process_memory_usage"), } - metricToUseForProcessAttributes = "process_memory_usage" - processNameAttrKey = "process_executable_name" - processCMDAttrKey = "process_command" - processCMDLineAttrKey = "process_command_line" + metricToUseForProcessAttributes = GetDotMetrics("process_memory_usage") + processNameAttrKey = GetDotMetrics("process_executable_name") + processCMDAttrKey = GetDotMetrics("process_command") + processCMDLineAttrKey = GetDotMetrics("process_command_line") ) type ProcessesRepo struct { @@ -44,7 +44,7 @@ func NewProcessesRepo(reader interfaces.Reader, querierV2 interfaces.Querier) *P func (p *ProcessesRepo) GetProcessAttributeKeys(ctx context.Context, req v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error) { // TODO(srikanthccv): remove hardcoded metric name and support keys from any system metric req.DataSource = v3.DataSourceMetrics - req.AggregateAttribute = "process_memory_usage" + req.AggregateAttribute = GetDotMetrics("process_memory_usage") if req.Limit == 0 { req.Limit = 50 } @@ -69,7 +69,7 @@ func (p *ProcessesRepo) GetProcessAttributeKeys(ctx context.Context, req v3.Filt func (p *ProcessesRepo) GetProcessAttributeValues(ctx context.Context, req v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error) { req.DataSource = v3.DataSourceMetrics - req.AggregateAttribute = "process_memory_usage" + req.AggregateAttribute = GetDotMetrics("process_memory_usage") if req.Limit == 0 { req.Limit = 50 } @@ -85,7 +85,7 @@ func (p *ProcessesRepo) getMetadataAttributes(ctx context.Context, req model.ProcessListRequest) (map[string]map[string]string, error) { processAttrs := map[string]map[string]string{} - keysToAdd := []string{"process_pid", "process_executable_name", "process_command", "process_command_line"} + keysToAdd := []string{GetDotMetrics("process_pid"), GetDotMetrics("process_executable_name"), GetDotMetrics("process_command"), GetDotMetrics("process_command_line")} for _, key := range keysToAdd { hasKey := false for _, groupByKey := range req.GroupBy { diff --git a/pkg/query-service/app/inframetrics/pvcs.go b/pkg/query-service/app/inframetrics/pvcs.go index 4ee51c6d8d..19f047e809 100644 --- a/pkg/query-service/app/inframetrics/pvcs.go +++ b/pkg/query-service/app/inframetrics/pvcs.go @@ -16,19 +16,19 @@ import ( ) var ( - metricToUseForVolumes = "k8s_volume_available" + metricToUseForVolumes = GetDotMetrics("k8s_volume_available") volumeAttrsToEnrich = []string{ - "k8s_pod_uid", - "k8s_pod_name", - "k8s_namespace_name", - "k8s_node_name", - "k8s_statefulset_name", - "k8s_cluster_name", - "k8s_persistentvolumeclaim_name", + GetDotMetrics("k8s_pod_uid"), + GetDotMetrics("k8s_pod_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_node_name"), + GetDotMetrics("k8s_statefulset_name"), + GetDotMetrics("k8s_cluster_name"), + GetDotMetrics("k8s_persistentvolumeclaim_name"), } - k8sPersistentVolumeClaimNameAttrKey = "k8s_persistentvolumeclaim_name" + k8sPersistentVolumeClaimNameAttrKey = GetDotMetrics("k8s_persistentvolumeclaim_name") queryNamesForVolumes = map[string][]string{ "available": {"A"}, @@ -42,11 +42,11 @@ var ( volumeQueryNames = []string{"A", "B", "C", "D", "E", "F1"} metricNamesForVolumes = map[string]string{ - "available": "k8s_volume_available", - "capacity": "k8s_volume_capacity", - "inodes": "k8s_volume_inodes", - "inodes_free": "k8s_volume_inodes_free", - "inodes_used": "k8s_volume_inodes_used", + "available": GetDotMetrics("k8s_volume_available"), + "capacity": GetDotMetrics("k8s_volume_capacity"), + "inodes": GetDotMetrics("k8s_volume_inodes"), + "inodes_free": GetDotMetrics("k8s_volume_inodes_free"), + "inodes_used": GetDotMetrics("k8s_volume_inodes_used"), } ) diff --git a/pkg/query-service/app/inframetrics/statefulsets.go b/pkg/query-service/app/inframetrics/statefulsets.go index 4881cd0195..db9a68ff7d 100644 --- a/pkg/query-service/app/inframetrics/statefulsets.go +++ b/pkg/query-service/app/inframetrics/statefulsets.go @@ -16,18 +16,18 @@ import ( ) var ( - metricToUseForStatefulSets = "k8s_pod_cpu_utilization" - k8sStatefulSetNameAttrKey = "k8s_statefulset_name" + metricToUseForStatefulSets = GetDotMetrics("k8s_pod_cpu_utilization") + k8sStatefulSetNameAttrKey = GetDotMetrics("k8s_statefulset_name") metricNamesForStatefulSets = map[string]string{ - "desired_pods": "k8s_statefulset_desired_pods", - "available_pods": "k8s_statefulset_current_pods", + "desired_pods": GetDotMetrics("k8s_statefulset_desired_pods"), + "available_pods": GetDotMetrics("k8s_statefulset_current_pods"), } statefulSetAttrsToEnrich = []string{ - "k8s_statefulset_name", - "k8s_namespace_name", - "k8s_cluster_name", + GetDotMetrics("k8s_statefulset_name"), + GetDotMetrics("k8s_namespace_name"), + GetDotMetrics("k8s_cluster_name"), } queryNamesForStatefulSets = map[string][]string{ diff --git a/pkg/query-service/app/inframetrics/workload_query.go b/pkg/query-service/app/inframetrics/workload_query.go index 435b23725b..0bc2a1f883 100644 --- a/pkg/query-service/app/inframetrics/workload_query.go +++ b/pkg/query-service/app/inframetrics/workload_query.go @@ -4,13 +4,13 @@ import v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" var ( metricNamesForWorkloads = map[string]string{ - "cpu": "k8s_pod_cpu_utilization", - "cpu_request": "k8s_pod_cpu_request_utilization", - "cpu_limit": "k8s_pod_cpu_limit_utilization", - "memory": "k8s_pod_memory_usage", - "memory_request": "k8s_pod_memory_request_utilization", - "memory_limit": "k8s_pod_memory_limit_utilization", - "restarts": "k8s_container_restarts", + "cpu": GetDotMetrics("k8s_pod_cpu_utilization"), + "cpu_request": GetDotMetrics("k8s_pod_cpu_request_utilization"), + "cpu_limit": GetDotMetrics("k8s_pod_cpu_limit_utilization"), + "memory": GetDotMetrics("k8s_pod_memory_usage"), + "memory_request": GetDotMetrics("k8s_pod_memory_request_utilization"), + "memory_limit": GetDotMetrics("k8s_pod_memory_limit_utilization"), + "restarts": GetDotMetrics("k8s_container_restarts"), } ) diff --git a/pkg/query-service/app/integrations/builtin.go b/pkg/query-service/app/integrations/builtin.go index 6ea1c41f3f..603dcfcce5 100644 --- a/pkg/query-service/app/integrations/builtin.go +++ b/pkg/query-service/app/integrations/builtin.go @@ -7,6 +7,8 @@ import ( "strings" "unicode" + "github.com/SigNoz/signoz/pkg/query-service/constants" + "encoding/base64" "encoding/json" "fmt" @@ -176,6 +178,19 @@ func HydrateFileUris(spec interface{}, fs embed.FS, basedir string) (interface{} if specMap, ok := spec.(map[string]interface{}); ok { result := map[string]interface{}{} for k, v := range specMap { + // Check if this is a dashboards slice and if dot metrics are enabled + if k == "dashboards" && constants.IsDotMetricsEnabled { + if dashboards, ok := v.([]interface{}); ok { + for i, dashboard := range dashboards { + if dashboardUri, ok := dashboard.(string); ok { + if strings.HasPrefix(dashboardUri, "file://") { + dashboards[i] = strings.Replace(dashboardUri, ".json", "_dot.json", 1) + } + } + } + v = dashboards + } + } hydrated, err := HydrateFileUris(v, fs, basedir) if err != nil { return nil, err @@ -200,7 +215,6 @@ func HydrateFileUris(spec interface{}, fs embed.FS, basedir string) (interface{} } return spec, nil - } func readFileIfUri(fs embed.FS, maybeFileUri string, basedir string) (interface{}, error) { diff --git a/pkg/query-service/app/integrations/builtin_integrations/aws_elasticache/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/aws_elasticache/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..62099bdfb2 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/aws_elasticache/assets/dashboards/overview_dot.json @@ -0,0 +1,2078 @@ +{ + "id": "elasticache-redis-overview", + "description": "Overview of ElastiCache CloudWatch metrics. Provides both host-level metrics (for example, CPU usage) and redis engine metrics", + "layout": [ + { + "h": 5, + "i": "00d78996-1ba9-42d9-b22b-5818fc3bde4c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "96c23215-c494-4650-9dc3-ae20858ce1f7", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "6a56afd1-6205-4afe-90fe-86befc3fb55e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "af269a1c-95a3-46b3-8d3b-322c194450e2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "f9b0f03a-8d78-4c26-a037-daae69650eb6", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "18798789-b67a-4c90-8127-f6bb63f012b2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "b3cdeb88-6988-419c-9e94-4a6bccfdd467", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "3604137c-12fe-4205-b7fc-f10d6143583b", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 5, + "i": "5e69ac87-580f-4dc2-becd-943296e5cd1d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 20 + }, + { + "h": 5, + "i": "e5c9ccb6-31de-4b80-8f4c-220ea2e874d0", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 20 + }, + { + "h": 5, + "i": "dccdd9c3-3864-4aef-a98f-6fb0e30baf0c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 25 + }, + { + "h": 5, + "i": "79723065-b871-4c79-83eb-b32f025c7642", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 25 + }, + { + "h": 5, + "i": "8eba8049-2af5-4998-b0e1-cbc2235f9b40", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 30 + } + ], + "panelMap": {}, + "tags": [ + "aws", + "cache", + "redis" + ], + "title": "AWS ElastiCache Redis", + "uploadedGrafana": false, + "uuid": "5c4832b2-7035-436e-a1c2-cb1f88d238ed", + "variables": { + "50910278-a96b-4bae-a3b4-4c5b9e7cdefc": { + "allSelected": true, + "customValue": "", + "description": "", + "id": "50910278-a96b-4bae-a3b4-4c5b9e7cdefc", + "modificationUUID": "635019d8-0e8f-48bc-8912-240c995a5251", + "multiSelect": true, + "name": "cache_cluster_id", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'cache_cluster_id') as cache_cluster_id\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name like 'aws_elasticache_%'\nGROUP BY cache_cluster_id", + "selectedValue": [ + "" + ], + "showALLOption": true, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "description": "", + "fillSpans": false, + "id": "96c23215-c494-4650-9dc3-ae20858ce1f7", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_engine_cpuutilization_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_engine_cpuutilization_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "18ac6939", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f31a92eb-aefb-4468-b163-95c2d29e3eaa", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Engine CPU Utilization", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "b3cdeb88-6988-419c-9e94-4a6bccfdd467", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_database_memory_usage_percentage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_database_memory_usage_percentage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6f82522a", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c863166f-7958-4f6c-a956-d5044c846973", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Database Memory Usage Percentage", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "18798789-b67a-4c90-8127-f6bb63f012b2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_database_capacity_usage_percentage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_database_capacity_usage_percentage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "80632329", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b659e4ed-5b6b-4ec8-911c-b906580b1ab5", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Database Capacity Usage Percentage", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "af269a1c-95a3-46b3-8d3b-322c194450e2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_cache_hits_sum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_cache_hits_sum", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "dd856067", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "", + "id": "cache_cluster_id------false", + "isColumn": false, + "key": "cache_cluster_id", + "type": "" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f2bc46b8-8d90-4d31-8e38-df61f7b58f55", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Cache Hit Rate", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "f9b0f03a-8d78-4c26-a037-daae69650eb6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_memory_fragmentation_ratio_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_memory_fragmentation_ratio_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "76d19eac", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "50b499c5-36dd-49e9-aae7-f1c225219434", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Memory Fragmentation Ratio", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "dccdd9c3-3864-4aef-a98f-6fb0e30baf0c", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_swap_usage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_swap_usage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "27530337", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "221b1817-b059-439e-bfaf-39089520344d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Swap Usage", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "3604137c-12fe-4205-b7fc-f10d6143583b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_freeable_memory_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_freeable_memory_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5f333785", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "cb158f83-72aa-4c36-bd26-9efc03d6ad15", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Freeable Memory", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "5e69ac87-580f-4dc2-becd-943296e5cd1d", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_network_bytes_in_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_network_bytes_in_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5c18156a", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a0114277-cb86-40b2-b002-71b021f81e39", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Bytes In", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "e5c9ccb6-31de-4b80-8f4c-220ea2e874d0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_network_bytes_out_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_network_bytes_out_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6f0c2153", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "51fd65b6-84f3-4ffd-81c3-5d581892cbad", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Bytes Out", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "6a56afd1-6205-4afe-90fe-86befc3fb55e", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_curr_connections_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_curr_connections_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "58582d67", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "1ee12dc9-a2f0-4c19-90ec-269cbece6fee", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Current Connections", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "8eba8049-2af5-4998-b0e1-cbc2235f9b40", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_replication_lag_maximum--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_replication_lag_maximum", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "69a98f19", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "95afdad6-29c3-4248-859f-bf142ad68f6a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Replication Lag", + "yAxisUnit": "s" + }, + { + "description": "", + "fillSpans": false, + "id": "79723065-b871-4c79-83eb-b32f025c7642", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_evictions_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_evictions_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "ea75b479", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "713cd286-0072-4c2b-b3cf-6631ca7c4958", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Evictions", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "00d78996-1ba9-42d9-b22b-5818fc3bde4c", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_elasticache_cpuutilization_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_elasticache_cpuutilization_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "028cb504", + "key": { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.cache_cluster_id}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "cache_cluster_id--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "cache_cluster_id", + "type": "tag" + } + ], + "having": [], + "legend": "{{cache_cluster_id}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "794f841f-4281-4e02-8b2d-97641b356e60", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU Utilization", + "yAxisUnit": "none" + } + ] + } \ No newline at end of file diff --git a/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/db_metrics_dot.json b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/db_metrics_dot.json new file mode 100644 index 0000000000..300853d648 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/db_metrics_dot.json @@ -0,0 +1,2935 @@ +{ + "id": "aws_rds_mysql_db_metrics", + "description": "", + "layout": [ + { + "h": 1, + "i": "a1da815a-c8b8-4e86-8630-a3265e3be002", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "121f2894-dd86-423a-8bb8-93f853aad93e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 1 + }, + { + "h": 6, + "i": "0dc8699d-35d7-4c73-b25e-ce2c05e1574b", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 1 + }, + { + "h": 6, + "i": "19da4480-77f3-4999-9cd5-f76c02cb4e8d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 7 + }, + { + "h": 6, + "i": "864ac52b-87aa-423a-aafb-975207baa3af", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 7 + }, + { + "h": 6, + "i": "11d5c39c-d780-4752-a868-a88d95e2a264", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 13 + }, + { + "h": 6, + "i": "c65eccc5-568b-4da3-8dee-90cf46cfbdcb", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 13 + }, + { + "h": 6, + "i": "b0ccb2fd-865a-422c-821f-4c8e4058e575", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 19 + }, + { + "h": 6, + "i": "942b5e3c-733a-454a-b7f7-b4256696483a", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 19 + }, + { + "h": 6, + "i": "ee89777a-111f-4c4e-bef5-3348b6a07b45", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 25 + }, + { + "h": 6, + "i": "b1e49f1a-8f97-4174-9cc7-0e4e4d2309f6", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 25 + }, + { + "h": 1, + "i": "52d4e290-ebe9-4e17-9e0d-57c4537996a2", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 31 + }, + { + "h": 6, + "i": "26d0b9f5-9dee-49ff-a8b5-baad92bd85ee", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 32 + }, + { + "h": 6, + "i": "2c1421c3-6d09-43d3-b5fc-bea817595786", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 32 + }, + { + "h": 1, + "i": "2b3c134c-ef8e-40a3-be5b-1c2b31f5f774", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 38 + }, + { + "h": 5, + "i": "9f188ac9-7b6c-4f23-85df-442c90fb1e98", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 39 + }, + { + "h": 5, + "i": "bc6a7150-bb0b-4fb5-b132-217f20b4cd06", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 39 + }, + { + "h": 5, + "i": "b99182d7-efd4-43a5-bd61-3a35d9f88a0e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 44 + }, + { + "h": 5, + "i": "18f8b51f-074c-45e3-8f25-6e70cb8ad222", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 44 + } + ], + "panelMap": { + "2b3c134c-ef8e-40a3-be5b-1c2b31f5f774": { + "collapsed": false, + "widgets": [ + { + "h": 5, + "i": "9f188ac9-7b6c-4f23-85df-442c90fb1e98", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 23 + }, + { + "h": 5, + "i": "bc6a7150-bb0b-4fb5-b132-217f20b4cd06", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 23 + }, + { + "h": 5, + "i": "b99182d7-efd4-43a5-bd61-3a35d9f88a0e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 28 + }, + { + "h": 5, + "i": "18f8b51f-074c-45e3-8f25-6e70cb8ad222", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 28 + } + ] + }, + "52d4e290-ebe9-4e17-9e0d-57c4537996a2": { + "collapsed": false, + "widgets": [ + { + "h": 6, + "i": "26d0b9f5-9dee-49ff-a8b5-baad92bd85ee", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 43 + }, + { + "h": 5, + "i": "18f8b51f-074c-45e3-8f25-6e70cb8ad222", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 43 + }, + { + "h": 6, + "i": "2c1421c3-6d09-43d3-b5fc-bea817595786", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 48 + } + ] + }, + "a1da815a-c8b8-4e86-8630-a3265e3be002": { + "collapsed": false, + "widgets": [ + { + "h": 6, + "i": "942b5e3c-733a-454a-b7f7-b4256696483a", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 6, + "i": "19da4480-77f3-4999-9cd5-f76c02cb4e8d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 6, + "i": "b0ccb2fd-865a-422c-821f-4c8e4058e575", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 6, + "i": "0dc8699d-35d7-4c73-b25e-ce2c05e1574b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 18 + }, + { + "h": 6, + "i": "ee89777a-111f-4c4e-bef5-3348b6a07b45", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 24 + }, + { + "h": 6, + "i": "c65eccc5-568b-4da3-8dee-90cf46cfbdcb", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 30 + }, + { + "h": 6, + "i": "121f2894-dd86-423a-8bb8-93f853aad93e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 36 + }, + { + "h": 6, + "i": "b1e49f1a-8f97-4174-9cc7-0e4e4d2309f6", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 42 + }, + { + "h": 6, + "i": "864ac52b-87aa-423a-aafb-975207baa3af", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 48 + }, + { + "h": 6, + "i": "11d5c39c-d780-4752-a868-a88d95e2a264", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 54 + } + ] + } + }, + "tags": [ + "mysql" + ], + "title": "MySQL", + "uploadedGrafana": false, + "variables": { + "31d3f13b-27d5-4291-9fb3-d5d5708a72f3": { + "allSelected": false, + "customValue": "", + "description": "", + "id": "31d3f13b-27d5-4291-9fb3-d5d5708a72f3", + "modificationUUID": "e4a9edf1-acd0-48b7-8a35-1b4bb668408d", + "multiSelect": false, + "name": "mysql.instance.endpoint", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'mysql.instance.endpoint') as `mysql.instance.endpoint`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'mysql.uptime'\nGROUP BY `mysql.instance.endpoint`", + "selectedValue": "", + "showALLOption": false, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "description": "", + "fillSpans": false, + "id": "9f188ac9-7b6c-4f23-85df-442c90fb1e98", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.buffer_pool.pages--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.buffer_pool.pages", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d0ece7c5", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "status--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "status", + "type": "tag" + } + ], + "having": [], + "legend": "{{status}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "41139bf9-846d-4aff-b31b-43c8d42f6aea", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Buffer pool usage by status", + "yAxisUnit": "bytes" + }, + { + "description": "", + "id": "2b3c134c-ef8e-40a3-be5b-1c2b31f5f774", + "panelTypes": "row", + "title": "Buffer pool" + }, + { + "description": "", + "fillSpans": false, + "id": "b99182d7-efd4-43a5-bd61-3a35d9f88a0e", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.buffer_pool.pages--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.buffer_pool.pages", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5a3714e3", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [], + "legend": "{{kind}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0fe54f66-5f01-4468-9681-b0fd52ea7d01", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Buffer pool pages by kind", + "yAxisUnit": "short" + }, + { + "description": "", + "fillSpans": false, + "id": "bc6a7150-bb0b-4fb5-b132-217f20b4cd06", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.buffer_pool.data_pages--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.buffer_pool.data_pages", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "fb2c8b1f", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "status--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "status", + "type": "tag" + } + ], + "having": [], + "legend": "{{status}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ce9c23bd-8a9d-4bce-af85-9696360d4431", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Data pages by status", + "yAxisUnit": "short" + }, + { + "description": "", + "fillSpans": false, + "id": "18f8b51f-074c-45e3-8f25-6e70cb8ad222", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.buffer_pool.page_flushes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.buffer_pool.page_flushes", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "aaed0865", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0a94bead-a3e4-4ae8-a500-77d50a4c6b17", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total buffer pool page flushes", + "yAxisUnit": "none" + }, + { + "description": "", + "id": "52d4e290-ebe9-4e17-9e0d-57c4537996a2", + "panelTypes": "row", + "title": "Table" + }, + { + "description": "", + "fillSpans": false, + "id": "ca688417-3ded-4482-aa4d-73dd9ce4e715", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.table.io.wait.count--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.table.io.wait.count", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "416ad837", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "table--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "table", + "type": "tag" + } + ], + "having": [], + "legend": "Count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6608d3ce-0058-44ed-9f76-3474ab0765aa", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "count of I/O wait events", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "26d0b9f5-9dee-49ff-a8b5-baad92bd85ee", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.table.io.wait.count--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.table.io.wait.count", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3773e4f8", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "table--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "table", + "type": "tag" + } + ], + "having": [], + "legend": "count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f02c5c6d-d5c0-4fb5-9d9d-5e8037a7824e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "count of table I/O wait events", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "2c1421c3-6d09-43d3-b5fc-bea817595786", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.table.io.wait.count--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.table.io.wait.count", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3773e4f8", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "table--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "table", + "type": "tag" + } + ], + "having": [], + "legend": "count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f02c5c6d-d5c0-4fb5-9d9d-5e8037a7824e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "count of table I/O wait events", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "11d5c39c-d780-4752-a868-a88d95e2a264", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.handlers--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.handlers", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "ac5632dc", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [ + { + "columnName": "SUM(`mysql.handlers`)", + "op": ">", + "value": 0 + } + ], + "legend": "{{kind}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d30af321-a7f6-49da-81a9-ba9577606dfd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Count by handlers", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "864ac52b-87aa-423a-aafb-975207baa3af", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.locks--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.locks", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e2692b23", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [], + "legend": "{{kind}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "71dbfc3f-10e3-4a23-b5c8-dd2c15ae800a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "MySQL locks", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "b1e49f1a-8f97-4174-9cc7-0e4e4d2309f6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.log_operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.log_operations", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b2ce5aae", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + } + ], + "having": [], + "legend": "count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c31ca2ae-8a6e-4293-a8e1-c544c093dcfd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "InnoDB log operations", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "121f2894-dd86-423a-8bb8-93f853aad93e", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.connection.count--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.connection.count", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7ba56364", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Connection count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.connection.errors--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.connection.errors", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "ed85e243", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "error--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "error", + "type": "tag" + } + ], + "having": [ + { + "columnName": "SUM(mysql.connection.errors)", + "op": ">", + "value": 0 + } + ], + "legend": "Error count: {{error}}", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "bde94864-1375-4617-9e62-2767981b57fc", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Connection/Errors", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "c65eccc5-568b-4da3-8dee-90cf46cfbdcb", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.opened_resources--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.opened_resources", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "517c903b", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [ + { + "columnName": "SUM(mysql.opened_resources)", + "op": ">", + "value": 0 + } + ], + "legend": "{{kind}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "62325340-e5db-4717-a55b-a0ff2dff77be", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Open resources count", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "ee89777a-111f-4c4e-bef5-3348b6a07b45", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.operations", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "99fe0131", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + } + ], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2825eb5d-e03e-42d7-980b-d2e4ded149a4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Count of operations", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "0dc8699d-35d7-4c73-b25e-ce2c05e1574b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.row_locks--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.row_locks", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7ed07e24", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [], + "legend": "{{kind}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "8598c0ff-d274-445f-8a3c-53c02595e0ff", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Row locks", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "b0ccb2fd-865a-422c-821f-4c8e4058e575", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.threads--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.threads", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "93e5a9ee", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "kind--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "kind", + "type": "tag" + } + ], + "having": [], + "legend": "count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5970ac20-a757-4d1b-80da-b6ec01fbe553", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Thread type count", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "19da4480-77f3-4999-9cd5-f76c02cb4e8d", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.row_operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.row_operations", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "bd45ea2f", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + } + ], + "having": [], + "legend": "{{operation}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "68287f23-55e3-4d02-9ce3-0107abb17412", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Row operations", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "942b5e3c-733a-454a-b7f7-b4256696483a", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mysql.prepared_statements--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mysql.prepared_statements", + "type": "Sum" + }, + "aggregateOperator": "increase", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "32634e42", + "key": { + "dataType": "string", + "id": "mysql.instance.endpoint--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mysql.instance.endpoint", + "type": "tag" + }, + "op": "=", + "value": "{{.mysql.instance.endpoint}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "command--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "command", + "type": "tag" + } + ], + "having": [], + "legend": "count", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "increase" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "3fa25e4b-30f9-41d8-8acc-a97aab8a18cd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Prepared statement count", + "yAxisUnit": "none" + }, + { + "description": "", + "id": "a1da815a-c8b8-4e86-8630-a3265e3be002", + "panelTypes": "row", + "title": "Resources" + } + ], + "uuid": "0a5a35a0-01f8-4597-8ece-74824c5e9e80" + } diff --git a/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..0e89b8a957 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_mysql/assets/dashboards/overview_dot.json @@ -0,0 +1,2602 @@ +{ + "id": "aws_rds_mysql", + "description": "", + "layout": [ + { + "h": 5, + "i": "8d22c6a7-b22e-4ad2-b242-e15de32ddc0f", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "94fe032e-3ffc-4cdc-aae6-f851fa47d957", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "6807e631-4894-4de8-8a55-686c8fa08d4b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "d599a942-4dbf-4e29-a3ac-a3142399b557", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "d16d8683-8c69-4526-a9cd-cc21ae5c60af", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "845ee717-bbd1-424c-8293-f49e76aa43b3", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "31c78945-ea1e-4ae1-b0fb-6f1c9de2c016", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "ae099f6e-5d6c-4127-ac70-2da9741837d7", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 5, + "i": "03c1f0bd-6713-4355-b8e3-6ef781af32c2", + "moved": false, + "static": false, + "w": 4, + "x": 0, + "y": 20 + }, + { + "h": 5, + "i": "37aabb43-fd8b-47c5-9444-0cd77f9ac435", + "moved": false, + "static": false, + "w": 4, + "x": 4, + "y": 20 + }, + { + "h": 5, + "i": "c6939628-3c4c-48fb-a2cf-46f6cb358359", + "moved": false, + "static": false, + "w": 4, + "x": 8, + "y": 20 + }, + { + "h": 5, + "i": "7854afc7-0cd5-4792-a760-be98a2e2f96b", + "moved": false, + "static": false, + "w": 4, + "x": 0, + "y": 25 + }, + { + "h": 5, + "i": "8126584b-eaa9-4b79-ba8e-a00c394544d8", + "moved": false, + "static": false, + "w": 4, + "x": 4, + "y": 25 + }, + { + "h": 5, + "i": "3d0a6717-1fd0-4810-b0e9-fe5190d5809f", + "moved": false, + "static": false, + "w": 4, + "x": 8, + "y": 25 + }, + { + "h": 5, + "i": "ffc39591-288f-4b28-87ee-43456d5d0667", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 30 + }, + { + "h": 5, + "i": "c5189b72-1055-4d6a-b18d-fa23bd9c28d6", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 30 + } + ], + "panelMap": {}, + "tags": [ + "aws", + "rds", + "mysql" + ], + "title": "AWS RDS MySQL", + "uploadedGrafana": false, + "uuid": "7799e6c9-9b37-4617-9b01-3033665e6605", + "variables": { + "5ae02d7b-d201-4481-ad6f-ffb9d53e1b3e": { + "allSelected": false, + "customValue": "", + "description": "This is the unique key that identifies a DB instance", + "id": "5ae02d7b-d201-4481-ad6f-ffb9d53e1b3e", + "modificationUUID": "1ecf21e3-488a-41e7-92f2-7dc75c9de49a", + "multiSelect": true, + "name": "dbinstance_identifier", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'dbinstance_identifier') as dbinstance_identifier\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name like 'aws_rds_database_connections_average'\nGROUP BY dbinstance_identifier", + "selectedValue": "", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "description": "The number of client network connections to the database instance.", + "fillSpans": false, + "id": "94fe032e-3ffc-4cdc-aae6-f851fa47d957", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_database_connections_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_database_connections_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "4e451ffc", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b6816e82-3e9b-4dc6-9fc0-047ef50e47d4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "DatabaseConnections", + "yAxisUnit": "short" + }, + { + "description": "The percentage of CPU utilization.", + "fillSpans": false, + "id": "8d22c6a7-b22e-4ad2-b242-e15de32ddc0f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_cpuutilization_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_cpuutilization_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f0a48ddc", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0318116a-ba6b-405c-b2c0-8dfb321f3ad0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPUUtilization", + "yAxisUnit": "percent" + }, + { + "description": "The amount of available random access memory. This metric reports the value of the MemAvailable field of /proc/meminfo", + "fillSpans": false, + "id": "d599a942-4dbf-4e29-a3ac-a3142399b557", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_freeable_memory_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_freeable_memory_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b738d056", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5a1e0e0d-3190-4a38-8030-b48d24ebe0f1", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "FreeableMemory", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "c6939628-3c4c-48fb-a2cf-46f6cb358359", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_latency_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_latency_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d0ac5956", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "794a5db3-b75c-4354-a509-ab24b5daeba4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadLatency", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "03c1f0bd-6713-4355-b8e3-6ef781af32c2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "bdc062ed", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6915105d-17eb-4863-8ccd-88c6a56d9ad7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "aws_rds_read_throughput_average" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadThroughput", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "37aabb43-fd8b-47c5-9444-0cd77f9ac435", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_iops_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_iops_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "74504cdf", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0ab52186-6617-4f8b-a3fc-3778c09b6faf", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadIOPS", + "yAxisUnit": "none" + }, + { + "description": "The amount of available storage space.", + "fillSpans": false, + "id": "6807e631-4894-4de8-8a55-686c8fa08d4b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_free_storage_space_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_free_storage_space_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3cfa657c", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b7f7c9e9-0fdf-462e-b465-57025785e98f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "FreeStorageSpace", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "7854afc7-0cd5-4792-a760-be98a2e2f96b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "05330793", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d6be5165-c686-412f-80f7-4a81a28cae7d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteThroughput", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "8126584b-eaa9-4b79-ba8e-a00c394544d8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_iops_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_iops_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0606e3a2", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "253e440a-b13d-411c-a069-d4da1f4c84d7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteIOPS", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "ffc39591-288f-4b28-87ee-43456d5d0667", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_network_transmit_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_network_transmit_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d5e2f293", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "n/w transmit", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_network_receive_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_network_receive_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "e968f079", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "n/w receive", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "sum" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2c6be01b-25d9-4480-80c9-f180edad6bf9", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network transmit/receive", + "yAxisUnit": "Bps" + }, + { + "description": "The number of outstanding I/Os (read/write requests) waiting to access the disk.", + "fillSpans": false, + "id": "845ee717-bbd1-424c-8293-f49e76aa43b3", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_disk_queue_depth_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_disk_queue_depth_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "96c73381", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "afe73a96-1c56-451e-bca6-2c41c62d47a8", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "DiskQueueDepth", + "yAxisUnit": "none" + }, + { + "description": "The percentage of throughput credits remaining in the burst bucket of your RDS database. ", + "fillSpans": false, + "id": "ae099f6e-5d6c-4127-ac70-2da9741837d7", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_ebsiobalance__average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_ebsiobalance__average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e88eb970", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "1d8b8b67-0646-4ebc-aa8b-1c10643ddfa0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBSByteBalance%", + "yAxisUnit": "none" + }, + { + "description": "The percentage of I/O credits remaining in the burst bucket of your RDS database.", + "fillSpans": false, + "id": "31c78945-ea1e-4ae1-b0fb-6f1c9de2c016", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_ebsiobalance__average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_ebsiobalance__average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c8d78684", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a0f7c676-ae5f-4db9-bb73-26dbb9db7fab", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBSIOBalance%", + "yAxisUnit": "none" + }, + { + "description": "The amount of disk space occupied by binary logs. If automatic backups are enabled for MySQL and MariaDB instances, including read replicas, binary logs are created.", + "fillSpans": false, + "id": "d16d8683-8c69-4526-a9cd-cc21ae5c60af", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_bin_log_disk_usage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_bin_log_disk_usage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1707f954", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "dbinstance_identifier", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "334d7c5d-4851-419a-90b2-86ebe21befff", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "BinLogDiskUsage", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "3d0a6717-1fd0-4810-b0e9-fe5190d5809f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_latency_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_latency_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5b97fb87", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7533cf12-7ee3-49e8-8fcd-c1f82ea317ab", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteLatency", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "c5189b72-1055-4d6a-b18d-fa23bd9c28d6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_swap_usage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_swap_usage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "afabe318", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "61ecb019-0fbf-44f1-a9db-995b86ee4805", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "SwapUsage", + "yAxisUnit": "decbytes" + } + ] +} \ No newline at end of file diff --git a/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/db_metrics_overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/db_metrics_overview_dot.json new file mode 100644 index 0000000000..2dec4648aa --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/db_metrics_overview_dot.json @@ -0,0 +1,1820 @@ +{ + "description": "This dashboard provides a high-level overview of your PostgreSQL databases. It includes replication, locks, and throughput etc...", + "id": "postgres_overview_metrics", + "layout": [ + { + "h": 1, + "i": "3bd16024-b9ff-4f02-8107-1fd817604d5f", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "8638a199-20a0-4255-b0a2-3b1ba06c485b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 1 + }, + { + "h": 1, + "i": "7df9b6d2-8f7f-48d4-80d6-ae07d47746d6", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 6 + }, + { + "h": 5, + "i": "191d09a6-40b0-4de8-a5b0-aa4254454b99", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 7 + }, + { + "h": 5, + "i": "fa941c00-ce19-49cc-baf2-c38598767dee", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 7 + }, + { + "h": 5, + "i": "114fcf80-e1de-4716-b1aa-0e0738dba10e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 5, + "i": "667428ef-9b9a-4e91-bd1e-938e0dc1ff32", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + }, + { + "h": 5, + "i": "bada7864-1d23-4d49-a868-c6b8a93c738f", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 17 + }, + { + "h": 1, + "i": "b437186f-d112-4fb9-bed5-5bea2b5f4b60", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 22 + }, + { + "h": 5, + "i": "6b700035-e3c2-4c48-99fa-ebfd6202eed3", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 23 + }, + { + "h": 5, + "i": "e9341e70-ccb3-47fc-af95-56ba8942c4f2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 23 + }, + { + "h": 1, + "i": "4b94cfd8-7a28-46f9-a618-0a186908f0d5", + "maxH": 1, + "minH": 1, + "minW": 12, + "moved": false, + "static": false, + "w": 12, + "x": 0, + "y": 28 + }, + { + "h": 6, + "i": "9552123d-6265-48a7-8624-3f4a3fc3c9c0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 29 + }, + { + "h": 5, + "i": "d7838815-4f5b-4454-86fd-f658b201f3a9", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 29 + }, + { + "h": 5, + "i": "f9a6f683-7455-4643-acc8-467cc5ea52cf", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 35 + } + ], + "name": "", + "panelMap": { + "3bd16024-b9ff-4f02-8107-1fd817604d5f": { + "collapsed": false, + "widgets": [] + }, + "4b94cfd8-7a28-46f9-a618-0a186908f0d5": { + "collapsed": true, + "widgets": [] + }, + "7df9b6d2-8f7f-48d4-80d6-ae07d47746d6": { + "collapsed": false, + "widgets": [ + { + "h": 5, + "i": "191d09a6-40b0-4de8-a5b0-aa4254454b99", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 1 + }, + { + "h": 5, + "i": "fa941c00-ce19-49cc-baf2-c38598767dee", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 1 + }, + { + "h": 5, + "i": "114fcf80-e1de-4716-b1aa-0e0738dba10e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 5, + "i": "667428ef-9b9a-4e91-bd1e-938e0dc1ff32", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 5, + "i": "bada7864-1d23-4d49-a868-c6b8a93c738f", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 11 + } + ] + }, + "b437186f-d112-4fb9-bed5-5bea2b5f4b60": { + "collapsed": false, + "widgets": [ + { + "h": 5, + "i": "6b700035-e3c2-4c48-99fa-ebfd6202eed3", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 47 + }, + { + "h": 5, + "i": "e9341e70-ccb3-47fc-af95-56ba8942c4f2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 47 + }, + { + "h": 4, + "i": "8638a199-20a0-4255-b0a2-3b1ba06c485b", + "moved": false, + "static": false, + "w": 6, + "x": 3, + "y": 52 + }, + { + "h": 5, + "i": "f9a6f683-7455-4643-acc8-467cc5ea52cf", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 56 + }, + { + "h": 5, + "i": "d7838815-4f5b-4454-86fd-f658b201f3a9", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 56 + }, + { + "h": 7, + "i": "9552123d-6265-48a7-8624-3f4a3fc3c9c0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 61 + } + ] + } + }, + "tags": [ + "postgres", + "database" + ], + "title": "Postgres overview", + "uploadedGrafana": false, + "variables": { + "8ecaee70-640f-46fd-83d9-a4fd18bc66e6": { + "allSelected": true, + "customValue": "", + "description": "List of tables", + "id": "8ecaee70-640f-46fd-83d9-a4fd18bc66e6", + "modificationUUID": "a51321cd-47a2-470a-8df4-372e5bb36f2c", + "multiSelect": true, + "name": "table_name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'postgresql.table.name') AS table_name\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'postgresql.operations' AND JSONExtractString(labels, 'postgresql.database.name') IN {{.db_name}}\nGROUP BY table_name", + "selectedValue": [ + "public.pgbench_accounts", + "public.pgbench_branches", + "public.pgbench_history", + "public.pgbench_tellers" + ], + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd": { + "allSelected": true, + "customValue": "", + "description": "List of databases", + "id": "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd", + "key": "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd", + "modificationUUID": "564a3f43-98f8-4189-b5e4-dcb518d73852", + "multiSelect": true, + "name": "db_name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'postgresql.database.name') AS db_name\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'postgresql.operations'\nGROUP BY db_name", + "selectedValue": [ + "pgtestdb" + ], + "showALLOption": true, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "widgets": [ + { + "description": "The average number of db insert operations.", + "fillSpans": false, + "id": "191d09a6-40b0-4de8-a5b0-aa4254454b99", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c1dff946", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "ins" + }, + { + "id": "2e60e171", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "bf48ac4c-bc0c-41a0-87f4-6f8ae7888d1f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserts", + "yAxisUnit": "none" + }, + { + "description": "The average number of db update operations.", + "fillSpans": false, + "id": "fa941c00-ce19-49cc-baf2-c38598767dee", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "98463ec9", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "upd" + }, + { + "id": "64020332", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "34a6ac3a-b7f6-4b5f-a084-a44378033d82", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Updates", + "yAxisUnit": "none" + }, + { + "description": "The average number of db delete operations.", + "fillSpans": false, + "id": "114fcf80-e1de-4716-b1aa-0e0738dba10e", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "62738de4", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "del" + }, + { + "id": "9d153899", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "734393d1-76ed-4f4f-bef8-0a91d27ebec4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Deleted", + "yAxisUnit": "none" + }, + { + "description": "The average number of db heap-only update operations.", + "fillSpans": false, + "id": "667428ef-9b9a-4e91-bd1e-938e0dc1ff32", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a91e35c4", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "hot_upd" + }, + { + "id": "7b4a29a2", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f43c2d19-4abc-4f5e-881b-db7add4a870a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Heap updates", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "bada7864-1d23-4d49-a868-c6b8a93c738f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d6aeccf7", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "ins" + }, + { + "id": "ee4e9344", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Inserted", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "a12cceed", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "upd" + }, + { + "id": "2d542482", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Updated", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "1bca3e46", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "del" + }, + { + "id": "44ffc874", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Deleted", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5056105b-1c30-4d27-8187-64457f2a1ec6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Operation by database", + "yAxisUnit": "none" + }, + { + "description": "The number of database locks.", + "fillSpans": false, + "id": "6b700035-e3c2-4c48-99fa-ebfd6202eed3", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.database.locks--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.database.locks", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "mode--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mode", + "type": "tag" + } + ], + "having": [], + "legend": "{{mode}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "877b0df3-9ae3-455e-ad27-bc3aa40b3f4c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Locks by lock mode", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "e9341e70-ccb3-47fc-af95-56ba8942c4f2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.deadlocks--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.deadlocks", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "efb83717", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5056105b-1c30-4d27-8187-64457f2a1ec6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Deadlocks count", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "8638a199-20a0-4255-b0a2-3b1ba06c485b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.backends--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.backends", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "20d2a4c5", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "205b99a0-2f1c-4bd2-9ba0-cc2da6ef247a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Connections per db", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "f9a6f683-7455-4643-acc8-467cc5ea52cf", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "70786905", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "dead" + }, + { + "id": "3e5ef839", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "9e913563", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Dead rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "cc7452c8-118b-4676-959e-7062bafc41ee", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Dead rows", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "d7838815-4f5b-4454-86fd-f658b201f3a9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.index.scans--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.index.scans", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "590332a7", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "171b9516", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.index.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.index.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.index.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2c6b630b-8bd9-4001-815b-f2b1f439a9dd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Index scans by index", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "9552123d-6265-48a7-8624-3f4a3fc3c9c0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "clickhouse_sql": [ + { + "name": "A", + "legend": "", + "disabled": false, + "query": "" + } + ], + "promql": [ + { + "name": "A", + "query": "", + "legend": "", + "disabled": false + } + ], + "builder": { + "queryData": [ + { + "dataSource": "metrics", + "queryName": "A", + "aggregateOperator": "avg", + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "timeAggregation": "rate", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "d2039662", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "dead" + }, + { + "id": "21c6d446", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "a44d1843", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "expression": "A", + "disabled": false, + "having": [], + "stepInterval": 840, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag", + "id": "postgresql.table.name--string--tag--false" + } + ], + "legend": "Dead rows", + "reduceTo": "sum" + }, + { + "dataSource": "metrics", + "queryName": "B", + "aggregateOperator": "avg", + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "timeAggregation": "rate", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "74888dbf", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "live" + }, + { + "id": "3e5d7976", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "c18ed7a3", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "expression": "B", + "disabled": false, + "having": [], + "stepInterval": 840, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag", + "id": "postgresql.table.name--string--tag--false" + } + ], + "legend": "Live rows", + "reduceTo": "sum" + }, + { + "dataSource": "metrics", + "queryName": "C", + "aggregateOperator": "sum_rate", + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.index.scans--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.index.scans", + "type": "Sum" + }, + "timeAggregation": "rate", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "f9355263", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "8807a9c4", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "expression": "C", + "disabled": false, + "having": [], + "stepInterval": 840, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag", + "id": "postgresql.table.name--string--tag--false" + } + ], + "legend": "Index scans", + "reduceTo": "sum" + }, + { + "dataSource": "metrics", + "queryName": "D", + "aggregateOperator": "avg", + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.table.size--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.table.size", + "type": "Sum" + }, + "timeAggregation": "rate", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "4be865f1", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db_name}}" + ] + }, + { + "id": "58200638", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table_name}}" + ] + } + ], + "op": "AND" + }, + "expression": "D", + "disabled": true, + "having": [], + "stepInterval": 840, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag", + "id": "postgresql.table.name--string--tag--false" + } + ], + "legend": "Table size", + "reduceTo": "sum" + } + ], + "queryFormulas": [ + { + "queryName": "F1", + "expression": "D/1024/1024/1024", + "disabled": false, + "legend": "Table size (GB)" + } + ] + }, + "id": "05e9c65b-a296-47c0-a802-2fca3320b07a", + "queryType": "builder" + }, + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Table stats", + "yAxisUnit": "none", + "selectedLogFields": [], + "selectedTracesFields": [] + }, + { + "description": "", + "id": "7df9b6d2-8f7f-48d4-80d6-ae07d47746d6", + "panelTypes": "row", + "title": "Operations" + }, + { + "description": "", + "id": "b437186f-d112-4fb9-bed5-5bea2b5f4b60", + "panelTypes": "row", + "title": "Locks" + }, + { + "description": "", + "id": "3bd16024-b9ff-4f02-8107-1fd817604d5f", + "panelTypes": "row", + "title": "Connections" + }, + { + "description": "", + "id": "4b94cfd8-7a28-46f9-a618-0a186908f0d5", + "panelTypes": "row", + "title": "Stats" + } + ], + "uuid": "149ad467-ba1b-421f-ad87-78f943cc7530" + } diff --git a/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..1b28ffc043 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/aws_rds_postgres/assets/dashboards/overview_dot.json @@ -0,0 +1,2782 @@ +{ + "id": "aws_rds_postgres", + "description": "", + "layout": [ + { + "h": 5, + "i": "8d22c6a7-b22e-4ad2-b242-e15de32ddc0f", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 5, + "i": "94fe032e-3ffc-4cdc-aae6-f851fa47d957", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 5, + "i": "d73f2e63-33d8-40f7-a67b-861a628ba249", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 5 + }, + { + "h": 5, + "i": "336bca83-50be-4937-b41b-ca8fde150f4d", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 5 + }, + { + "h": 5, + "i": "6807e631-4894-4de8-8a55-686c8fa08d4b", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 10 + }, + { + "h": 5, + "i": "d599a942-4dbf-4e29-a3ac-a3142399b557", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 10 + }, + { + "h": 5, + "i": "31c78945-ea1e-4ae1-b0fb-6f1c9de2c016", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 5, + "i": "845ee717-bbd1-424c-8293-f49e76aa43b3", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 5, + "i": "c5189b72-1055-4d6a-b18d-fa23bd9c28d6", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 20 + }, + { + "h": 5, + "i": "ae099f6e-5d6c-4127-ac70-2da9741837d7", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 20 + }, + { + "h": 5, + "i": "03c1f0bd-6713-4355-b8e3-6ef781af32c2", + "moved": false, + "static": false, + "w": 4, + "x": 0, + "y": 25 + }, + { + "h": 5, + "i": "37aabb43-fd8b-47c5-9444-0cd77f9ac435", + "moved": false, + "static": false, + "w": 4, + "x": 4, + "y": 25 + }, + { + "h": 5, + "i": "c6939628-3c4c-48fb-a2cf-46f6cb358359", + "moved": false, + "static": false, + "w": 4, + "x": 8, + "y": 25 + }, + { + "h": 5, + "i": "7854afc7-0cd5-4792-a760-be98a2e2f96b", + "moved": false, + "static": false, + "w": 4, + "x": 0, + "y": 30 + }, + { + "h": 5, + "i": "8126584b-eaa9-4b79-ba8e-a00c394544d8", + "moved": false, + "static": false, + "w": 4, + "x": 4, + "y": 30 + }, + { + "h": 5, + "i": "3d0a6717-1fd0-4810-b0e9-fe5190d5809f", + "moved": false, + "static": false, + "w": 4, + "x": 8, + "y": 30 + }, + { + "h": 5, + "i": "ffc39591-288f-4b28-87ee-43456d5d0667", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 35 + } + ], + "panelMap": {}, + "tags": [ + "aws", + "rds", + "postgres" + ], + "title": "AWS RDS Postgres", + "uploadedGrafana": false, + "variables": { + "5ae02d7b-d201-4481-ad6f-ffb9d53e1b3e": { + "allSelected": true, + "customValue": "", + "description": "This is the unique key that identifies a DB instance", + "id": "5ae02d7b-d201-4481-ad6f-ffb9d53e1b3e", + "modificationUUID": "1ecf21e3-488a-41e7-92f2-7dc75c9de49a", + "multiSelect": true, + "name": "dbinstance_identifier", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'dbinstance_identifier') as dbinstance_identifier\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name like 'aws_rds_database_connections_average'\nGROUP BY dbinstance_identifier", + "selectedValue": [ + "integration-db-instance-instance-1", + "integration-db-instance-instance-2", + "integration-db-instance-instance-3", + "integration-test-postgres-instance-1", + "integration-test-postgres-instance-2", + "integration-test-postgres-instance-3", + "integration-testing-db-instance-1", + "integration-testing-db-instance-2", + "integration-testing-db-instance-3" + ], + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "version": "v4", + "widgets": [ + { + "description": "The number of client network connections to the database instance.", + "fillSpans": false, + "id": "94fe032e-3ffc-4cdc-aae6-f851fa47d957", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_database_connections_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_database_connections_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "4e451ffc", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b6816e82-3e9b-4dc6-9fc0-047ef50e47d4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "DatabaseConnections", + "yAxisUnit": "short" + }, + { + "description": "The percentage of CPU utilization.", + "fillSpans": false, + "id": "8d22c6a7-b22e-4ad2-b242-e15de32ddc0f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_cpuutilization_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_cpuutilization_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f0a48ddc", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0318116a-ba6b-405c-b2c0-8dfb321f3ad0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPUUtilization", + "yAxisUnit": "percent" + }, + { + "description": "The amount of available random access memory. This metric reports the value of the MemAvailable field of /proc/meminfo", + "fillSpans": false, + "id": "d599a942-4dbf-4e29-a3ac-a3142399b557", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_freeable_memory_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_freeable_memory_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "b738d056", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5a1e0e0d-3190-4a38-8030-b48d24ebe0f1", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "FreeableMemory", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "c6939628-3c4c-48fb-a2cf-46f6cb358359", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_latency_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_latency_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d0ac5956", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "794a5db3-b75c-4354-a509-ab24b5daeba4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadLatency", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "03c1f0bd-6713-4355-b8e3-6ef781af32c2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "bdc062ed", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "6915105d-17eb-4863-8ccd-88c6a56d9ad7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "aws_rds_read_throughput_average" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadThroughput", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "37aabb43-fd8b-47c5-9444-0cd77f9ac435", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_read_iops_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_read_iops_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "74504cdf", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "0ab52186-6617-4f8b-a3fc-3778c09b6faf", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReadIOPS", + "yAxisUnit": "none" + }, + { + "description": "The amount of available storage space.", + "fillSpans": false, + "id": "6807e631-4894-4de8-8a55-686c8fa08d4b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_free_storage_space_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_free_storage_space_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "3cfa657c", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b7f7c9e9-0fdf-462e-b465-57025785e98f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "FreeStorageSpace", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "7854afc7-0cd5-4792-a760-be98a2e2f96b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_throughput_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "05330793", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d6be5165-c686-412f-80f7-4a81a28cae7d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteThroughput", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "8126584b-eaa9-4b79-ba8e-a00c394544d8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_iops_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_iops_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "0606e3a2", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "253e440a-b13d-411c-a069-d4da1f4c84d7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteIOPS", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "ffc39591-288f-4b28-87ee-43456d5d0667", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "clickhouse_sql": [ + { + "name": "A", + "legend": "", + "disabled": false, + "query": "" + } + ], + "promql": [ + { + "name": "A", + "query": "", + "legend": "", + "disabled": false + } + ], + "builder": { + "queryData": [ + { + "dataSource": "metrics", + "queryName": "A", + "aggregateOperator": "sum", + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_network_transmit_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_network_transmit_throughput_average", + "type": "Gauge" + }, + "timeAggregation": "sum", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "9a27ef98", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "expression": "A", + "disabled": true, + "having": [], + "stepInterval": 60, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag", + "id": "dbinstance_identifier--string--tag--false" + } + ], + "legend": "n/w transmit", + "reduceTo": "sum" + }, + { + "dataSource": "metrics", + "queryName": "B", + "aggregateOperator": "sum", + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_network_receive_throughput_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_network_receive_throughput_average", + "type": "Gauge" + }, + "timeAggregation": "sum", + "spaceAggregation": "sum", + "functions": [], + "filters": { + "items": [ + { + "id": "df2ee1fc", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "expression": "B", + "disabled": true, + "having": [], + "stepInterval": 60, + "limit": null, + "orderBy": [], + "groupBy": [ + { + "dataType": "string", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag", + "id": "dbinstance_identifier--string--tag--false" + } + ], + "legend": "n/w receive", + "reduceTo": "sum" + } + ], + "queryFormulas": [ + { + "queryName": "F1", + "expression": "A/1024/1024", + "disabled": false, + "legend": "n/w transmit (mb)" + }, + { + "queryName": "F2", + "expression": "B/1024/1024", + "disabled": false, + "legend": "n/w receive (mb)" + } + ] + }, + "id": "60b5a712-ac27-4b2e-a8d7-a180b389c780", + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network transmit/receive", + "yAxisUnit": "Bps" + }, + { + "description": "The number of outstanding I/Os (read/write requests) waiting to access the disk.", + "fillSpans": false, + "id": "845ee717-bbd1-424c-8293-f49e76aa43b3", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_disk_queue_depth_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_disk_queue_depth_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "96c73381", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "afe73a96-1c56-451e-bca6-2c41c62d47a8", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "DiskQueueDepth", + "yAxisUnit": "none" + }, + { + "description": "The percentage of throughput credits remaining in the burst bucket of your RDS database. ", + "fillSpans": false, + "id": "ae099f6e-5d6c-4127-ac70-2da9741837d7", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_ebsiobalance__average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_ebsiobalance__average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e88eb970", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "1d8b8b67-0646-4ebc-aa8b-1c10643ddfa0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBSByteBalance%", + "yAxisUnit": "none" + }, + { + "description": "The percentage of I/O credits remaining in the burst bucket of your RDS database.", + "fillSpans": false, + "id": "31c78945-ea1e-4ae1-b0fb-6f1c9de2c016", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_ebsiobalance__average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_ebsiobalance__average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c8d78684", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a0f7c676-ae5f-4db9-bb73-26dbb9db7fab", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "EBSIOBalance%", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "3d0a6717-1fd0-4810-b0e9-fe5190d5809f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_write_latency_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_write_latency_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5b97fb87", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7533cf12-7ee3-49e8-8fcd-c1f82ea317ab", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "WriteLatency", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "c5189b72-1055-4d6a-b18d-fa23bd9c28d6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_swap_usage_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_swap_usage_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "afabe318", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "61ecb019-0fbf-44f1-a9db-995b86ee4805", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "SwapUsage", + "yAxisUnit": "decbytes" + }, + { + "description": "", + "fillSpans": false, + "id": "336bca83-50be-4937-b41b-ca8fde150f4d", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_checkpoint_lag_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_checkpoint_lag_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "abac3888", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "187a2eae-4fe4-4e47-b544-20404532cbb2", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CheckpointLag", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "d73f2e63-33d8-40f7-a67b-861a628ba249", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "aws_rds_replica_lag_average--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "aws_rds_replica_lag_average", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "47be5579", + "key": { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.dbinstance_identifier}}" + ] + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "dbinstance_identifier--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "dbinstance_identifier", + "type": "tag" + } + ], + "having": [], + "legend": "{{dbinstance_identifier}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "avg" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "53e6ee05-bcbc-4f01-b061-a358371d92ff", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "ReplicaLag", + "yAxisUnit": "none" + } + ], + "uuid": "05e473e2-5733-4877-8b7f-cb311d4e9c0a" +} \ No newline at end of file diff --git a/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview.json b/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview.json index d938e3b0aa..98b714d021 100644 --- a/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview.json +++ b/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview.json @@ -7741,4 +7741,4 @@ } ], "uuid": "e74aeb83-ac4b-4313-8a97-216b62c8fc59" -} \ No newline at end of file +} diff --git a/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..28945e0081 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/clickhouse/assets/dashboards/overview_dot.json @@ -0,0 +1,7744 @@ +{ + "id": "clickhouse-overview", + "description": "This dashboard provides a high-level overview of your Clickhouse Server hosts.", + "layout": [ + { + "h": 3, + "i": "3b96004b-f356-4fc9-a7de-36af5eabad5d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 9 + }, + { + "h": 3, + "i": "be48f124-96d1-4327-ae10-6f2c1b81fe50", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + }, + { + "h": 3, + "i": "8eb1e295-d5e8-4007-acb1-a9ec385d6f4d", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 3, + "i": "7f36d404-8915-4bfb-ac93-b69a9ea1428a", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 3, + "i": "947053c4-b809-4241-9cb2-90e09868c2a9", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 3 + }, + { + "h": 3, + "i": "653248f0-9658-4be3-ba03-017d804e90c8", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 3, + "i": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 3, + "i": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 3, + "i": "97a2c7bb-f135-412b-a006-167dcc1882c6", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 3 + }, + { + "h": 3, + "i": "486edfb2-02ce-45a3-ab89-06fce614edcf", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 3, + "i": "fcb693b5-6786-49e0-8007-4bc6009c70e2", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 3, + "i": "581eb12e-8c92-4a8d-9800-0f72f350cfd1", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 9 + } + ], + "tags": [], + "title": "Clickhouse Overview", + "variables": { + "eaf65de3-20bb-4dbc-9792-32a445f7be8f": { + "allSelected": false, + "customValue": "", + "description": "", + "id": "eaf65de3-20bb-4dbc-9792-32a445f7be8f", + "key": "eaf65de3-20bb-4dbc-9792-32a445f7be8f", + "modificationUUID": "2fbb477e-7775-427b-ab14-29b673dd216c", + "multiSelect": false, + "name": "host.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'host.name') AS host.name\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'ClickHouseMetrics_VersionInteger' and __normalized=false \nGROUP BY host.name", + "selectedValue": "", + "showALLOption": false, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "uploadedGrafana": false, + "version": "v4", + "widgets": [ + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "653248f0-9658-4be3-ba03-017d804e90c8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertedRows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertedRows", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a7d9e1d3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Inserted Rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ee3de02b-cb8b-4ebc-8041-245f10943ca6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserted Rows", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "97a2c7bb-f135-412b-a006-167dcc1882c6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_QueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_QueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6fd64e65", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "All Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "ce64d4b6", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "ffcd0e01", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "da05a175", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Other Queries (not select or insert)", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e1a1e8b1-60c0-40b6-8391-151d79e91325", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total Query Time", + "yAxisUnit": "µs" + }, + { + "description": "Writes rejected with \"Too many parts\" for inserts or \"Too many mutations\" for mutations", + "fillSpans": false, + "id": "7f36d404-8915-4bfb-ac93-b69a9ea1428a", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_RejectedInserts--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_RejectedInserts", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "8c903ae3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Rejected Inserts ('Too many parts')", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_RejectedMutations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_RejectedMutations", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "74059430", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Rejected Mutations ('Too many mutations')", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a5bd4adb-1610-43a1-a11e-72dc4e76416d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rejected Writes", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "653248f0-9658-4be3-ba03-017d804e90c8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertedRows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertedRows", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a7d9e1d3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Inserted Rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ee3de02b-cb8b-4ebc-8041-245f10943ca6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserted Rows", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "97a2c7bb-f135-412b-a006-167dcc1882c6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_QueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_QueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6fd64e65", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "All Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "ce64d4b6", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "ffcd0e01", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "da05a175", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Other Queries (not select or insert)", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e1a1e8b1-60c0-40b6-8391-151d79e91325", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total Query Time", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "8eb1e295-d5e8-4007-acb1-a9ec385d6f4d", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseMetrics_MemoryTracking--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseMetrics_MemoryTracking", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5b1aee4f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Memory Used", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "avg", + "stepInterval": 60, + "timeAggregation": "max" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "3bc4df66-32bd-42fe-9744-71a678107ebb", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Memory Usage", + "yAxisUnit": "bytes" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "653248f0-9658-4be3-ba03-017d804e90c8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertedRows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertedRows", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a7d9e1d3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Inserted Rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ee3de02b-cb8b-4ebc-8041-245f10943ca6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserted Rows", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "97a2c7bb-f135-412b-a006-167dcc1882c6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_QueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_QueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6fd64e65", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "All Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "ce64d4b6", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "ffcd0e01", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "da05a175", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Other Queries (not select or insert)", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e1a1e8b1-60c0-40b6-8391-151d79e91325", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total Query Time", + "yAxisUnit": "µs" + }, + { + "description": "Writes rejected with \"Too many parts\" for inserts or \"Too many mutations\" for mutations", + "fillSpans": false, + "id": "7f36d404-8915-4bfb-ac93-b69a9ea1428a", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_RejectedInserts--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_RejectedInserts", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "8c903ae3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Rejected Inserts", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_RejectedMutations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_RejectedMutations", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "74059430", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Rejected Mutations", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "a5bd4adb-1610-43a1-a11e-72dc4e76416d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rejected Writes", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "653248f0-9658-4be3-ba03-017d804e90c8", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertedRows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertedRows", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a7d9e1d3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Inserted Rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "ee3de02b-cb8b-4ebc-8041-245f10943ca6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserted Rows", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "a62fdaa8-9193-46c1-a951-8e3d5a6b1cf9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Query--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Query", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "f39fa24e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "feac81df", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "c8516e54", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_AsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_AsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "fabac011", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "9a78e4be-1f4d-4104-b97b-26ba927b100e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Rate of Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "1a1a3a6a-83d2-49db-aa4d-d6f166cc65f0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "7d653034", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedSelectQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedSelectQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "18cd347e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "96af023f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_FailedAsyncInsertQuery--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_FailedAsyncInsertQuery", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "1ec63ffc", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Async Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "536cb476-340c-4afb-a5cc-538ebe419f8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Failed Queries", + "yAxisUnit": "cps" + }, + { + "description": "", + "fillSpans": false, + "id": "97a2c7bb-f135-412b-a006-167dcc1882c6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_QueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_QueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "6fd64e65", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "All Queries", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_SelectQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "ce64d4b6", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Select Queries", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "ffcd0e01", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Insert Queries", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OtherQueryTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "da05a175", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Other Queries (not select or insert)", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e1a1e8b1-60c0-40b6-8391-151d79e91325", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total Query Time", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "947053c4-b809-4241-9cb2-90e09868c2a9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_InsertedBytes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_InsertedBytes", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e9d17ef7", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Inserted Data", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "781619c1-2da3-464b-b2af-206645d8da71", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserted Data", + "yAxisUnit": "binBps" + }, + { + "description": "", + "fillSpans": false, + "id": "486edfb2-02ce-45a3-ab89-06fce614edcf", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_NetworkReceiveBytes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_NetworkReceiveBytes", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "cce0dcd3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Received", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_NetworkSendBytes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_NetworkSendBytes", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "a29a23a0", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Sent", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "57e90fd3-ddc9-44a3-8349-ddcb543c0d6e", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network Traffic", + "yAxisUnit": "binBps" + }, + { + "description": "", + "fillSpans": false, + "id": "fcb693b5-6786-49e0-8007-4bc6009c70e2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OSCPUVirtualTimeMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OSCPUVirtualTimeMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d2c354fa", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "OSCPUVirtualTimeMicroseconds", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OSCPUWaitMicroseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OSCPUWaitMicroseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "f6af7585", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "OSCPUWaitMicroseconds", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "e1dda6e4-1032-4e95-b7ec-fb292e3d6823", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "CPU", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "be48f124-96d1-4327-ae10-6f2c1b81fe50", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OSReadBytes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OSReadBytes", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "75a5ec5f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Read", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_OSWriteBytes--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_OSWriteBytes", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "98263fc3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Write", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "d26049ee-35ff-4f30-b359-6f0d00bb8600", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Disk", + "yAxisUnit": "binBps" + }, + { + "description": "", + "fillSpans": false, + "id": "581eb12e-8c92-4a8d-9800-0f72f350cfd1", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_MergesTimeMilliseconds--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_MergesTimeMilliseconds", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "1ac0d1d1", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Total Time Spent on Merges", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "df0e8faf-801a-4e24-a690-10a6d11651e0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total Time spent for Background Merges", + "yAxisUnit": "ms" + }, + { + "description": "", + "fillSpans": false, + "id": "3b96004b-f356-4fc9-a7de-36af5eabad5d", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "ClickHouseProfileEvents_Merge--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "ClickHouseProfileEvents_Merge", + "type": "Sum" + }, + "aggregateOperator": "rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "61c9d724", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "=", + "value": "{{.host.name}}" + } + ], + "op": "AND" + }, + "functions": [], + "groupBy": [], + "having": [], + "legend": "Number of merges launched", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "avg", + "spaceAggregation": "sum", + "stepInterval": 60, + "timeAggregation": "rate" + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "cbeb3c56-5a43-467e-b130-b1cb11c6ee4f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "selectedLogFields": [ + { + "dataType": "string", + "name": "body", + "type": "" + }, + { + "dataType": "string", + "name": "timestamp", + "type": "" + } + ], + "selectedTracesFields": [ + { + "dataType": "string", + "id": "serviceName--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "serviceName", + "type": "tag" + }, + { + "dataType": "string", + "id": "name--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "name", + "type": "tag" + }, + { + "dataType": "float64", + "id": "durationNano--float64--tag--true", + "isColumn": true, + "isJSON": false, + "key": "durationNano", + "type": "tag" + }, + { + "dataType": "string", + "id": "httpMethod--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "httpMethod", + "type": "tag" + }, + { + "dataType": "string", + "id": "responseStatusCode--string--tag--true", + "isColumn": true, + "isJSON": false, + "key": "responseStatusCode", + "type": "tag" + } + ], + "softMax": 0, + "softMin": 0, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Background Merges Launched", + "yAxisUnit": "cps" + } + ], + "uuid": "e74aeb83-ac4b-4313-8a97-216b62c8fc59" +} diff --git a/pkg/query-service/app/integrations/builtin_integrations/mongo/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/mongo/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..777302d96f --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/mongo/assets/dashboards/overview_dot.json @@ -0,0 +1,797 @@ +{ + "id": "mongo-overview", + "description": "This dashboard provides a high-level overview of your MongoDB. It includes read/write performance, most-used replicas, collection metrics etc...", + "layout": [ + { + "h": 3, + "i": "0c3d2b15-89be-4d62-a821-b26d93332ed3", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 3 + }, + { + "h": 3, + "i": "14504a3c-4a05-4d22-bab3-e22e94f51380", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 6 + }, + { + "h": 3, + "i": "dcfb3829-c3f2-44bb-907d-8dc8a6dc4aab", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 3 + }, + { + "h": 3, + "i": "bfc9e80b-02bf-4122-b3da-3dd943d35012", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 3, + "i": "4c07a7d2-893a-46c2-bcdb-a19b6efeac3a", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 3, + "i": "a5a64eec-1034-4aa6-8cb1-05673c4426c6", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 6 + }, + { + "h": 3, + "i": "503af589-ef4d-4fe3-8934-c8f7eb480d9a", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 9 + } + ], + "name": "", + "tags": [ + "mongo", + "database" + ], + "title": "Mongo overview", + "variables": { + "a2c21714-a814-4d31-9b56-7367c3208801": { + "allSelected": true, + "customValue": "", + "description": "List of hosts sending mongo metrics", + "id": "a2c21714-a814-4d31-9b56-7367c3208801", + "modificationUUID": "448e675a-4531-45b1-b434-a9ee809470d6", + "multiSelect": true, + "name": "host.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'host.name') AS `host.name`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'mongodb_memory_usage'\nGROUP BY `host.name`", + "selectedValue": [ + "Srikanths-MacBook-Pro.local" + ], + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "widgets": [ + { + "description": "Total number of operations", + "fillSpans": false, + "id": "4c07a7d2-893a-46c2-bcdb-a19b6efeac3a", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.operation.count--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.operation.count", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a468a30b", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + } + ], + "having": [], + "legend": "{{operation}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7da5d899-8b06-4139-9a89-47baf9551ff8", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Operations count", + "yAxisUnit": "none" + }, + { + "description": "The total time spent performing operations.", + "fillSpans": false, + "id": "bfc9e80b-02bf-4122-b3da-3dd943d35012", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.operation.time--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.operation.time", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "31be3166", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + } + ], + "having": [], + "legend": "{{operation}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2ca35957-894a-46ae-a2a6-95d7e400d8e1", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Total operations time", + "yAxisUnit": "ms" + }, + { + "description": "The number of cache operations", + "fillSpans": false, + "id": "dcfb3829-c3f2-44bb-907d-8dc8a6dc4aab", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.cache.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.cache.operations", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "01b45814", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "type--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "type", + "type": "tag" + } + ], + "having": [], + "legend": "{{type}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "bb439198-dcf5-4767-b0d0-ab5785159b8d", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Cache operations", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "14504a3c-4a05-4d22-bab3-e22e94f51380", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.operation.latency.time--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.operation.latency.time", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "2e165319", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "read" + }, + { + "id": "888e920b", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Latency", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "4a9cafe8-778b-476c-b825-c04e165bf285", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Read latency", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "a5a64eec-1034-4aa6-8cb1-05673c4426c6", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.operation.latency.time--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.operation.latency.time", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "53b37ca7", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "9862c46c", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "write" + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Latency", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "446827eb-a4f2-4ff3-966b-fb65288c983b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Write latency", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "503af589-ef4d-4fe3-8934-c8f7eb480d9a", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.operation.latency.time--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.operation.latency.time", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c33ad4b6", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "c70ecfd0", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "command" + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Latency", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "7b7b977d-0921-4552-8cfe-d82dfde63ef4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Command latency", + "yAxisUnit": "µs" + }, + { + "description": "", + "fillSpans": false, + "id": "0c3d2b15-89be-4d62-a821-b26d93332ed3", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.network.io.receive--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.network.io.receive", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "5c9d7fe3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Bytes received :: {{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "mongodb.network.io.transmit--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "mongodb.network.io.transmit", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "96520885", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Bytes transmitted :: {{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "41eea5bc-f9cf-45c2-92fb-ef226d6b540b", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Network IO", + "yAxisUnit": "bytes" + } + ] +} diff --git a/pkg/query-service/app/integrations/builtin_integrations/postgres/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/postgres/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..f781e93cc4 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/postgres/assets/dashboards/overview_dot.json @@ -0,0 +1,1869 @@ +{ + "id": "postgres-overview", + "description": "This dashboard provides a high-level overview of your PostgreSQL databases. It includes replication, locks, and throughput etc...", + "layout": [ + { + "h": 3, + "i": "9552123d-6265-48a7-8624-3f4a3fc3c9c0", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 18 + }, + { + "h": 3, + "i": "d7838815-4f5b-4454-86fd-f658b201f3a9", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 15 + }, + { + "h": 3, + "i": "f9a6f683-7455-4643-acc8-467cc5ea52cf", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 15 + }, + { + "h": 3, + "i": "8638a199-20a0-4255-b0a2-3b1ba06c485b", + "moved": false, + "static": false, + "w": 6, + "x": 3, + "y": 12 + }, + { + "h": 3, + "i": "e9341e70-ccb3-47fc-af95-56ba8942c4f2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 9 + }, + { + "h": 3, + "i": "6b700035-e3c2-4c48-99fa-ebfd6202eed3", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 9 + }, + { + "h": 3, + "i": "bada7864-1d23-4d49-a868-c6b8a93c738f", + "moved": false, + "static": false, + "w": 6, + "x": 3, + "y": 6 + }, + { + "h": 3, + "i": "191d09a6-40b0-4de8-a5b0-aa4254454b99", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 3, + "i": "fa941c00-ce19-49cc-baf2-c38598767dee", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 3, + "i": "114fcf80-e1de-4716-b1aa-0e0738dba10e", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 3 + }, + { + "h": 3, + "i": "667428ef-9b9a-4e91-bd1e-938e0dc1ff32", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 3 + } + ], + "name": "", + "tags": [ + "postgres", + "database" + ], + "title": "Postgres overview", + "variables": { + "4250ef7b-8f42-4a24-902a-a764d070b92d": { + "allSelected": true, + "customValue": "", + "description": "List of hosts sending Postgres metrics", + "id": "4250ef7b-8f42-4a24-902a-a764d070b92d", + "key": "4250ef7b-8f42-4a24-902a-a764d070b92d", + "modificationUUID": "4427b655-c8d2-40ce-84ed-7cb058bd3041", + "multiSelect": true, + "name": "host.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'host.name') AS `host.name`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'postgresql.operations'\nGROUP BY `host.name`", + "selectedValue": [ + "Srikanths-MacBook-Pro.local" + ], + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + }, + "8ecaee70-640f-46fd-83d9-a4fd18bc66e6": { + "customValue": "", + "description": "List of tables", + "id": "8ecaee70-640f-46fd-83d9-a4fd18bc66e6", + "modificationUUID": "a51321cd-47a2-470a-8df4-372e5bb36f2c", + "multiSelect": true, + "name": "table.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'postgresql.table.name') AS `table.name`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'postgresql.operations' AND JSONExtractString(labels, 'postgresql.database.name') IN {{.db.name}}\nGROUP BY `table.name`", + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY", + "selectedValue": [ + "public.activations", + "public.licenses", + "public.plans", + "public.subscription_items", + "public.subscriptions", + "public.trials", + "public.usage" + ], + "allSelected": true + }, + "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd": { + "allSelected": true, + "customValue": "", + "description": "List of databases", + "id": "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd", + "key": "c66d1581-e5e1-440d-8ff6-ebcf078ab6dd", + "modificationUUID": "564a3f43-98f8-4189-b5e4-dcb518d73852", + "multiSelect": true, + "name": "db.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'postgresql.database.name') AS `db.name`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'postgresql.operations'\nGROUP BY `db.name`", + "selectedValue": [ + "postgres" + ], + "showALLOption": true, + "sort": "DISABLED", + "textboxValue": "", + "type": "QUERY" + } + }, + "widgets": [ + { + "description": "The average number of db insert operations.", + "fillSpans": false, + "id": "191d09a6-40b0-4de8-a5b0-aa4254454b99", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "c1dff946", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "ins" + }, + { + "id": "0cd6dc8f", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "2e60e171", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "bf48ac4c-bc0c-41a0-87f4-6f8ae7888d1f", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Inserts", + "yAxisUnit": "none" + }, + { + "description": "The average number of db update operations.", + "fillSpans": false, + "id": "fa941c00-ce19-49cc-baf2-c38598767dee", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "98463ec9", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "upd" + }, + { + "id": "47db4e8e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "64020332", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "34a6ac3a-b7f6-4b5f-a084-a44378033d82", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Updates", + "yAxisUnit": "none" + }, + { + "description": "The average number of db delete operations.", + "fillSpans": false, + "id": "114fcf80-e1de-4716-b1aa-0e0738dba10e", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "62738de4", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "del" + }, + { + "id": "d18471e2", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "9d153899", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "734393d1-76ed-4f4f-bef8-0a91d27ebec4", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Deleted", + "yAxisUnit": "none" + }, + { + "description": "The average number of db heap-only update operations.", + "fillSpans": false, + "id": "667428ef-9b9a-4e91-bd1e-938e0dc1ff32", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "a91e35c4", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "hot_upd" + }, + { + "id": "2b419378", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "7b4a29a2", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "f43c2d19-4abc-4f5e-881b-db7add4a870a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Heap updates", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "bada7864-1d23-4d49-a868-c6b8a93c738f", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d6aeccf7", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "ins" + }, + { + "id": "4004a127", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "ee4e9344", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Inserted", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "a12cceed", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "upd" + }, + { + "id": "11735104", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "2d542482", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Updated", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.operations--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.operations", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "1bca3e46", + "key": { + "dataType": "string", + "id": "operation--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "operation", + "type": "tag" + }, + "op": "=", + "value": "del" + }, + { + "id": "3631755d", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "44ffc874", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "Deleted", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5056105b-1c30-4d27-8187-64457f2a1ec6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Operation by database", + "yAxisUnit": "none" + }, + { + "description": "The number of database locks.", + "fillSpans": false, + "id": "6b700035-e3c2-4c48-99fa-ebfd6202eed3", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.database.locks--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.database.locks", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "527a3124", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "mode--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "mode", + "type": "tag" + } + ], + "having": [], + "legend": "{{mode}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "877b0df3-9ae3-455e-ad27-bc3aa40b3f4c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Locks by lock mode", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "e9341e70-ccb3-47fc-af95-56ba8942c4f2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.deadlocks--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.deadlocks", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "ff14f172", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "efb83717", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "5056105b-1c30-4d27-8187-64457f2a1ec6", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Deadlocks count", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "8638a199-20a0-4255-b0a2-3b1ba06c485b", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.backends--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.backends", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "ed335b00", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "20d2a4c5", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.database.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "205b99a0-2f1c-4bd2-9ba0-cc2da6ef247a", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Connections per db", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "f9a6f683-7455-4643-acc8-467cc5ea52cf", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "70786905", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "dead" + }, + { + "id": "810e39a9", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "3e5ef839", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "9e913563", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Dead rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "cc7452c8-118b-4676-959e-7062bafc41ee", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Dead rows", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "d7838815-4f5b-4454-86fd-f658b201f3a9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.index.scans--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.index.scans", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "da04d826", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "590332a7", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "171b9516", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.index.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.index.name", + "type": "tag" + } + ], + "having": [], + "legend": "{{postgresql.index.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2c6b630b-8bd9-4001-815b-f2b1f439a9dd", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Index scans by index", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "9552123d-6265-48a7-8624-3f4a3fc3c9c0", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "table", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "83f9cab9", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "dead" + }, + { + "id": "2a0284c2", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "c2aaf758", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "a603fda9", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + } + ], + "having": [], + "legend": "Dead rows", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.rows--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.rows", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "82f1f0f5", + "key": { + "dataType": "string", + "id": "state--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "state", + "type": "tag" + }, + "op": "=", + "value": "live" + }, + { + "id": "14de7a06", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "0a88a27a", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "4417218d", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + } + ], + "having": [], + "legend": "Live rows", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.index.scans--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.index.scans", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "C", + "filters": { + "items": [ + { + "id": "22795c15", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "d7e7c193", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "d3ae1dbe", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + } + ], + "having": [], + "legend": "Index scans", + "limit": null, + "orderBy": [], + "queryName": "C", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "postgresql.table.size--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "postgresql.table.size", + "type": "Sum" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "D", + "filters": { + "items": [ + { + "id": "48c436ab", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + }, + { + "id": "cc617789", + "key": { + "dataType": "string", + "id": "postgresql.database.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.database.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.db.name}}" + ] + }, + { + "id": "b4029d50", + "key": { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.table.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "postgresql.table.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "postgresql.table.name", + "type": "tag" + } + ], + "having": [], + "legend": "Table size", + "limit": null, + "orderBy": [], + "queryName": "D", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "26a9dcbf-4fc7-4ddd-b786-2078def1f462", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Table stats", + "yAxisUnit": "none" + } + ] +} diff --git a/pkg/query-service/app/integrations/builtin_integrations/redis/assets/dashboards/overview_dot.json b/pkg/query-service/app/integrations/builtin_integrations/redis/assets/dashboards/overview_dot.json new file mode 100644 index 0000000000..dacf4db862 --- /dev/null +++ b/pkg/query-service/app/integrations/builtin_integrations/redis/assets/dashboards/overview_dot.json @@ -0,0 +1,924 @@ +{ + "id": "redis-overview", + "description": "This dashboard shows the Redis instance overview. It includes latency, hit/miss rate, connections, and memory information.\n", + "layout": [ + { + "h": 3, + "i": "d4c164bc-8fc2-4dbc-aadd-8d17479ca649", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 9 + }, + { + "h": 3, + "i": "2fbaef0d-3cdb-4ce3-aa3c-9bbbb41786d9", + "moved": false, + "static": false, + "w": 6, + "x": 3, + "y": 6 + }, + { + "h": 3, + "i": "f5ee1511-0d2b-4404-9ce0-e991837decc2", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 3 + }, + { + "h": 3, + "i": "b19c7058-b806-4ea2-974a-ca555b168991", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 3 + }, + { + "h": 3, + "i": "bf0deeeb-e926-4234-944c-82bacd96af47", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 0 + }, + { + "h": 3, + "i": "a77227c7-16f5-4353-952e-b183c715a61c", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 0 + }, + { + "h": 3, + "i": "9698cee2-b1f3-4c0b-8c9f-3da4f0e05f17", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 9 + }, + { + "h": 3, + "i": "64a5f303-d7db-44ff-9a0e-948e5c653320", + "moved": false, + "static": false, + "w": 6, + "x": 0, + "y": 12 + }, + { + "h": 3, + "i": "3e80a918-69af-4c9a-bc57-a94e1d41b05c", + "moved": false, + "static": false, + "w": 6, + "x": 6, + "y": 12 + } + ], + "name": "", + "tags": [ + "redis", + "database" + ], + "title": "Redis overview", + "variables": { + "94f19b3c-ad9f-4b47-a9b2-f312c09fa965": { + "allSelected": true, + "customValue": "", + "description": "List of hosts sending Redis metrics", + "id": "94f19b3c-ad9f-4b47-a9b2-f312c09fa965", + "key": "94f19b3c-ad9f-4b47-a9b2-f312c09fa965", + "modificationUUID": "4c5b0c03-9cbc-425b-8d8e-7152e5c39ba8", + "multiSelect": true, + "name": "host.name", + "order": 0, + "queryValue": "SELECT JSONExtractString(labels, 'host.name') AS `host.name`\nFROM signoz_metrics.distributed_time_series_v4_1day\nWHERE metric_name = 'redis.cpu.time'\nGROUP BY `host.name`", + "selectedValue": [ + "Srikanths-MacBook-Pro.local" + ], + "showALLOption": true, + "sort": "ASC", + "textboxValue": "", + "type": "QUERY" + } + }, + "widgets": [ + { + "description": "Rate successful lookup of keys in the main dictionary", + "fillSpans": false, + "id": "a77227c7-16f5-4353-952e-b183c715a61c", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.keyspace.hits--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "redis.keyspace.hits", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "e99669ea", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Hit/s across all hosts", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "42c9c117-bfaf-49f7-b528-aad099392295", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Hits/s", + "yAxisUnit": "none" + }, + { + "description": "Number of clients pending on a blocking call", + "fillSpans": false, + "id": "bf0deeeb-e926-4234-944c-82bacd96af47", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.clients.blocked--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "redis.clients.blocked", + "type": "Sum" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "97247f25", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Blocked clients across all hosts", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b77a9e11-fb98-4a95-88a8-c3ad25c14369", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Clients blocked", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "b19c7058-b806-4ea2-974a-ca555b168991", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "", + "id": "redis.db.keys------false", + "isColumn": false, + "key": "redis.db.keys", + "type": "" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "b77a9e11-fb98-4a95-88a8-c3ad25c14369", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Keyspace Keys", + "yAxisUnit": "none" + }, + { + "description": "Number of changes since the last dump", + "fillSpans": false, + "id": "f5ee1511-0d2b-4404-9ce0-e991837decc2", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.rdb.changes_since_last_save--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "redis.rdb.changes_since_last_save", + "type": "Sum" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "d4aef346", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "Number of unsaved changes", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "32cedddf-606d-4de1-8c1d-4b7049e6430c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Unsaved changes", + "yAxisUnit": "none" + }, + { + "description": "", + "fillSpans": false, + "id": "2fbaef0d-3cdb-4ce3-aa3c-9bbbb41786d9", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.commands--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "redis.commands", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "458dc402", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [], + "having": [], + "legend": "ops/s", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "c70de4dd-a68a-42df-a249-6610c296709c", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Command/s", + "yAxisUnit": "ops" + }, + { + "description": "", + "fillSpans": false, + "id": "d4c164bc-8fc2-4dbc-aadd-8d17479ca649", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.memory.used--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "redis.memory.used", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "394a537e", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Used::{{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + }, + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.maxmemory--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "redis.maxmemory", + "type": "Gauge" + }, + "aggregateOperator": "max", + "dataSource": "metrics", + "disabled": false, + "expression": "B", + "filters": { + "items": [ + { + "id": "0c0754da", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Max::{{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "B", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "2f47df76-f09e-4152-8623-971f0fe66bfe", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Memory usage", + "yAxisUnit": "bytes" + }, + { + "description": "", + "fillSpans": false, + "id": "9698cee2-b1f3-4c0b-8c9f-3da4f0e05f17", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.memory.rss--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "redis.memory.rss", + "type": "Gauge" + }, + "aggregateOperator": "sum", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "4dc9ae49", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Rss::{{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "fddd043c-1385-481c-9f4c-381f261e1dd9", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "RSS Memory", + "yAxisUnit": "bytes" + }, + { + "description": "", + "fillSpans": false, + "id": "64a5f303-d7db-44ff-9a0e-948e5c653320", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.memory.fragmentation_ratio--float64--Gauge--true", + "isColumn": true, + "isJSON": false, + "key": "redis.memory.fragmentation_ratio", + "type": "Gauge" + }, + "aggregateOperator": "avg", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "79dc25f3", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Rss::{{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "3e802b07-0249-4d79-a5c7-6580ab535ad0", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Fragmentation ratio", + "yAxisUnit": "short" + }, + { + "description": "Number of evicted keys due to maxmemory limit", + "fillSpans": false, + "id": "3e80a918-69af-4c9a-bc57-a94e1d41b05c", + "isStacked": false, + "nullZeroValues": "zero", + "opacity": "1", + "panelTypes": "graph", + "query": { + "builder": { + "queryData": [ + { + "aggregateAttribute": { + "dataType": "float64", + "id": "redis.keys.evicted--float64--Sum--true", + "isColumn": true, + "isJSON": false, + "key": "redis.keys.evicted", + "type": "Sum" + }, + "aggregateOperator": "sum_rate", + "dataSource": "metrics", + "disabled": false, + "expression": "A", + "filters": { + "items": [ + { + "id": "53d189ac", + "key": { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + }, + "op": "in", + "value": [ + "{{.host.name}}" + ] + } + ], + "op": "AND" + }, + "groupBy": [ + { + "dataType": "string", + "id": "host.name--string--tag--false", + "isColumn": false, + "isJSON": false, + "key": "host.name", + "type": "tag" + } + ], + "having": [], + "legend": "Rss::{{host.name}}", + "limit": null, + "orderBy": [], + "queryName": "A", + "reduceTo": "sum", + "stepInterval": 60 + } + ], + "queryFormulas": [] + }, + "clickhouse_sql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "id": "15d1d9d7-eb10-464b-aa7b-33ff211996f7", + "promql": [ + { + "disabled": false, + "legend": "", + "name": "A", + "query": "" + } + ], + "queryType": "builder" + }, + "softMax": null, + "softMin": null, + "thresholds": [], + "timePreferance": "GLOBAL_TIME", + "title": "Eviction rate", + "yAxisUnit": "short" + } + ] +} diff --git a/pkg/query-service/app/integrations/controller.go b/pkg/query-service/app/integrations/controller.go index 97447cca46..aa44ea8cc4 100644 --- a/pkg/query-service/app/integrations/controller.go +++ b/pkg/query-service/app/integrations/controller.go @@ -7,17 +7,16 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/agentConf" "github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes" + "github.com/SigNoz/signoz/pkg/valuer" ) type Controller struct { mgr *Manager } -func NewController(sqlStore sqlstore.SQLStore) ( - *Controller, error, -) { +func NewController(sqlStore sqlstore.SQLStore) (*Controller, error) { mgr, err := NewManager(sqlStore) if err != nil { return nil, fmt.Errorf("couldn't create integrations manager: %w", err) @@ -34,11 +33,7 @@ type IntegrationsListResponse struct { // Pagination details to come later } -func (c *Controller) ListIntegrations( - ctx context.Context, orgId string, params map[string]string, -) ( - *IntegrationsListResponse, *model.ApiError, -) { +func (c *Controller) ListIntegrations(ctx context.Context, orgId string, params map[string]string) (*IntegrationsListResponse, *model.ApiError) { var filters *IntegrationsFilter if isInstalledFilter, exists := params["is_installed"]; exists { isInstalled := !(isInstalledFilter == "false") @@ -57,15 +52,11 @@ func (c *Controller) ListIntegrations( }, nil } -func (c *Controller) GetIntegration( - ctx context.Context, orgId string, integrationId string, -) (*Integration, *model.ApiError) { +func (c *Controller) GetIntegration(ctx context.Context, orgId string, integrationId string) (*Integration, *model.ApiError) { return c.mgr.GetIntegration(ctx, orgId, integrationId) } -func (c *Controller) IsIntegrationInstalled( - ctx context.Context, orgId string, integrationId string, -) (bool, *model.ApiError) { +func (c *Controller) IsIntegrationInstalled(ctx context.Context, orgId string, integrationId string) (bool, *model.ApiError) { installation, apiErr := c.mgr.getInstalledIntegration(ctx, orgId, integrationId) if apiErr != nil { return false, apiErr @@ -74,9 +65,7 @@ func (c *Controller) IsIntegrationInstalled( return isInstalled, nil } -func (c *Controller) GetIntegrationConnectionTests( - ctx context.Context, orgId string, integrationId string, -) (*IntegrationConnectionTests, *model.ApiError) { +func (c *Controller) GetIntegrationConnectionTests(ctx context.Context, orgId string, integrationId string) (*IntegrationConnectionTests, *model.ApiError) { return c.mgr.GetIntegrationConnectionTests(ctx, orgId, integrationId) } @@ -85,9 +74,7 @@ type InstallIntegrationRequest struct { Config map[string]interface{} `json:"config"` } -func (c *Controller) Install( - ctx context.Context, orgId string, req *InstallIntegrationRequest, -) (*IntegrationsListItem, *model.ApiError) { +func (c *Controller) Install(ctx context.Context, orgId string, req *InstallIntegrationRequest) (*IntegrationsListItem, *model.ApiError) { res, apiErr := c.mgr.InstallIntegration( ctx, orgId, req.IntegrationId, req.Config, ) @@ -102,9 +89,7 @@ type UninstallIntegrationRequest struct { IntegrationId string `json:"integration_id"` } -func (c *Controller) Uninstall( - ctx context.Context, orgId string, req *UninstallIntegrationRequest, -) *model.ApiError { +func (c *Controller) Uninstall(ctx context.Context, orgId string, req *UninstallIntegrationRequest) *model.ApiError { if len(req.IntegrationId) < 1 { return model.BadRequest(fmt.Errorf( "integration_id is required", @@ -121,20 +106,18 @@ func (c *Controller) Uninstall( return nil } -func (c *Controller) GetPipelinesForInstalledIntegrations( - ctx context.Context, orgId string, -) ([]pipelinetypes.GettablePipeline, *model.ApiError) { +func (c *Controller) GetPipelinesForInstalledIntegrations(ctx context.Context, orgId string) ([]pipelinetypes.GettablePipeline, *model.ApiError) { return c.mgr.GetPipelinesForInstalledIntegrations(ctx, orgId) } -func (c *Controller) GetDashboardsForInstalledIntegrations( - ctx context.Context, orgId string, -) ([]*types.Dashboard, *model.ApiError) { +func (c *Controller) GetDashboardsForInstalledIntegrations(ctx context.Context, orgId valuer.UUID) ([]*dashboardtypes.Dashboard, *model.ApiError) { return c.mgr.GetDashboardsForInstalledIntegrations(ctx, orgId) } -func (c *Controller) GetInstalledIntegrationDashboardById( - ctx context.Context, orgId string, dashboardUuid string, -) (*types.Dashboard, *model.ApiError) { +func (c *Controller) GetInstalledIntegrationDashboardById(ctx context.Context, orgId valuer.UUID, dashboardUuid string) (*dashboardtypes.Dashboard, *model.ApiError) { return c.mgr.GetInstalledIntegrationDashboardById(ctx, orgId, dashboardUuid) } + +func (c *Controller) IsInstalledIntegrationDashboardID(dashboardUuid string) bool { + return c.mgr.IsInstalledIntegrationDashboardUuid(dashboardUuid) +} diff --git a/pkg/query-service/app/integrations/manager.go b/pkg/query-service/app/integrations/manager.go index c305a4d769..21d7e3ea2d 100644 --- a/pkg/query-service/app/integrations/manager.go +++ b/pkg/query-service/app/integrations/manager.go @@ -10,6 +10,7 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/utils" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes" ruletypes "github.com/SigNoz/signoz/pkg/types/ruletypes" "github.com/SigNoz/signoz/pkg/valuer" @@ -31,8 +32,8 @@ type IntegrationSummary struct { } type IntegrationAssets struct { - Logs LogsAssets `json:"logs"` - Dashboards []types.DashboardData `json:"dashboards"` + Logs LogsAssets `json:"logs"` + Dashboards []dashboardtypes.StorableDashboardData `json:"dashboards"` Alerts []ruletypes.PostableRule `json:"alerts"` } @@ -304,17 +305,22 @@ func (m *Manager) parseDashboardUuid(dashboardUuid string) ( return parts[1], parts[2], nil } +func (m *Manager) IsInstalledIntegrationDashboardUuid(dashboardUuid string) bool { + _, _, apiErr := m.parseDashboardUuid(dashboardUuid) + return apiErr == nil +} + func (m *Manager) GetInstalledIntegrationDashboardById( ctx context.Context, - orgId string, + orgId valuer.UUID, dashboardUuid string, -) (*types.Dashboard, *model.ApiError) { +) (*dashboardtypes.Dashboard, *model.ApiError) { integrationId, dashboardId, apiErr := m.parseDashboardUuid(dashboardUuid) if apiErr != nil { return nil, apiErr } - integration, apiErr := m.GetIntegration(ctx, orgId, integrationId) + integration, apiErr := m.GetIntegration(ctx, orgId.StringValue(), integrationId) if apiErr != nil { return nil, apiErr } @@ -328,11 +334,10 @@ func (m *Manager) GetInstalledIntegrationDashboardById( for _, dd := range integration.IntegrationDetails.Assets.Dashboards { if dId, exists := dd["id"]; exists { if id, ok := dId.(string); ok && id == dashboardId { - isLocked := 1 author := "integration" - return &types.Dashboard{ - UUID: m.dashboardUuid(integrationId, string(dashboardId)), - Locked: &isLocked, + return &dashboardtypes.Dashboard{ + ID: m.dashboardUuid(integrationId, string(dashboardId)), + Locked: true, Data: dd, TimeAuditable: types.TimeAuditable{ CreatedAt: integration.Installation.InstalledAt, @@ -342,6 +347,7 @@ func (m *Manager) GetInstalledIntegrationDashboardById( CreatedBy: author, UpdatedBy: author, }, + OrgID: orgId, }, nil } } @@ -354,24 +360,23 @@ func (m *Manager) GetInstalledIntegrationDashboardById( func (m *Manager) GetDashboardsForInstalledIntegrations( ctx context.Context, - orgId string, -) ([]*types.Dashboard, *model.ApiError) { - installedIntegrations, apiErr := m.getInstalledIntegrations(ctx, orgId) + orgId valuer.UUID, +) ([]*dashboardtypes.Dashboard, *model.ApiError) { + installedIntegrations, apiErr := m.getInstalledIntegrations(ctx, orgId.StringValue()) if apiErr != nil { return nil, apiErr } - result := []*types.Dashboard{} + result := []*dashboardtypes.Dashboard{} for _, ii := range installedIntegrations { for _, dd := range ii.Assets.Dashboards { if dId, exists := dd["id"]; exists { if dashboardId, ok := dId.(string); ok { - isLocked := 1 author := "integration" - result = append(result, &types.Dashboard{ - UUID: m.dashboardUuid(ii.IntegrationSummary.Id, dashboardId), - Locked: &isLocked, + result = append(result, &dashboardtypes.Dashboard{ + ID: m.dashboardUuid(ii.IntegrationSummary.Id, dashboardId), + Locked: true, Data: dd, TimeAuditable: types.TimeAuditable{ CreatedAt: ii.Installation.InstalledAt, @@ -381,6 +386,7 @@ func (m *Manager) GetDashboardsForInstalledIntegrations( CreatedBy: author, UpdatedBy: author, }, + OrgID: orgId, }) } } diff --git a/pkg/query-service/app/integrations/manager_test.go b/pkg/query-service/app/integrations/manager_test.go index c78413c0b7..39c9d1ff88 100644 --- a/pkg/query-service/app/integrations/manager_test.go +++ b/pkg/query-service/app/integrations/manager_test.go @@ -3,12 +3,18 @@ package integrations import ( "context" "testing" + "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" - "github.com/SigNoz/signoz/pkg/modules/user/impluser" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" + "github.com/SigNoz/signoz/pkg/signoz" + "github.com/SigNoz/signoz/pkg/types/authtypes" _ "github.com/mattn/go-sqlite3" "github.com/stretchr/testify/require" ) @@ -19,11 +25,14 @@ func TestIntegrationLifecycle(t *testing.T) { mgr, store := NewTestIntegrationsManager(t) ctx := context.Background() - organizationModule := implorganization.NewModule(implorganization.NewStore(store)) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - userModule := impluser.NewModule(impluser.NewStore(store, providerSettings), nil, emailing, providerSettings) - user, apiErr := createTestUser(organizationModule, userModule) + sharder, _ := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + orgGetter := implorganization.NewGetter(implorganization.NewStore(store), sharder) + alertmanager, _ := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Provider: "signoz", Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, store, orgGetter) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(store, jwt, emailing, providerSettings, orgGetter, alertmanager) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) if apiErr != nil { t.Fatalf("could not create test user: %v", apiErr) } diff --git a/pkg/query-service/app/integrations/messagingQueues/kafka/translator.go b/pkg/query-service/app/integrations/messagingQueues/kafka/translator.go index bf5c37099c..97f529616f 100644 --- a/pkg/query-service/app/integrations/messagingQueues/kafka/translator.go +++ b/pkg/query-service/app/integrations/messagingQueues/kafka/translator.go @@ -66,6 +66,11 @@ func buildBuilderQueriesProducerBytes( attributeCache *Clients, ) (map[string]*v3.BuilderQuery, error) { + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + bq := make(map[string]*v3.BuilderQuery) queryName := "byte_rate" @@ -74,7 +79,7 @@ func buildBuilderQueriesProducerBytes( StepInterval: common.MinAllowedStepInterval(unixMilliStart, unixMilliEnd), DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: "kafka_producer_byte_rate", + Key: getDotMetrics("kafka_producer_byte_rate", normalized), DataType: v3.AttributeKeyDataTypeFloat64, Type: v3.AttributeKeyType("Gauge"), IsColumn: true, @@ -88,7 +93,7 @@ func buildBuilderQueriesProducerBytes( Items: []v3.FilterItem{ { Key: v3.AttributeKey{ - Key: "service_name", + Key: getDotMetrics("service_name", normalized), Type: v3.AttributeKeyTypeTag, DataType: v3.AttributeKeyDataTypeString, }, @@ -110,7 +115,7 @@ func buildBuilderQueriesProducerBytes( ReduceTo: v3.ReduceToOperatorAvg, GroupBy: []v3.AttributeKey{ { - Key: "service_name", + Key: getDotMetrics("service_name", normalized), DataType: v3.AttributeKeyDataTypeString, Type: v3.AttributeKeyTypeTag, }, @@ -133,12 +138,17 @@ func buildBuilderQueriesNetwork( bq := make(map[string]*v3.BuilderQuery) queryName := "latency" + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + chq := &v3.BuilderQuery{ QueryName: queryName, StepInterval: common.MinAllowedStepInterval(unixMilliStart, unixMilliEnd), DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: "kafka_consumer_fetch_latency_avg", + Key: getDotMetrics("kafka_consumer_fetch_latency_avg", normalized), }, AggregateOperator: v3.AggregateOperatorAvg, Temporality: v3.Unspecified, @@ -149,7 +159,7 @@ func buildBuilderQueriesNetwork( Items: []v3.FilterItem{ { Key: v3.AttributeKey{ - Key: "service_name", + Key: getDotMetrics("service_name", normalized), Type: v3.AttributeKeyTypeTag, DataType: v3.AttributeKeyDataTypeString, }, @@ -158,7 +168,7 @@ func buildBuilderQueriesNetwork( }, { Key: v3.AttributeKey{ - Key: "client_id", + Key: getDotMetrics("client_id", normalized), Type: v3.AttributeKeyTypeTag, DataType: v3.AttributeKeyDataTypeString, }, @@ -167,7 +177,7 @@ func buildBuilderQueriesNetwork( }, { Key: v3.AttributeKey{ - Key: "service_instance_id", + Key: getDotMetrics("service_instance_id", normalized), Type: v3.AttributeKeyTypeTag, DataType: v3.AttributeKeyDataTypeString, }, @@ -180,17 +190,17 @@ func buildBuilderQueriesNetwork( ReduceTo: v3.ReduceToOperatorAvg, GroupBy: []v3.AttributeKey{ { - Key: "service_name", + Key: getDotMetrics("service_name", normalized), DataType: v3.AttributeKeyDataTypeString, Type: v3.AttributeKeyTypeTag, }, { - Key: "client_id", + Key: getDotMetrics("client_id", normalized), DataType: v3.AttributeKeyDataTypeString, Type: v3.AttributeKeyTypeTag, }, { - Key: "service_instance_id", + Key: getDotMetrics("service_instance_id", normalized), DataType: v3.AttributeKeyDataTypeString, Type: v3.AttributeKeyTypeTag, }, @@ -207,12 +217,17 @@ func BuildBuilderQueriesKafkaOnboarding(messagingQueue *MessagingQueue) (*v3.Que unixMilliStart := messagingQueue.Start / 1000000 unixMilliEnd := messagingQueue.End / 1000000 + normalized := true + if constants.IsDotMetricsEnabled { + normalized = false + } + buiderQuery := &v3.BuilderQuery{ QueryName: "fetch_latency", StepInterval: common.MinAllowedStepInterval(unixMilliStart, unixMilliEnd), DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: "kafka_consumer_fetch_latency_avg", + Key: getDotMetrics("kafka_consumer_fetch_latency_avg", normalized), }, AggregateOperator: v3.AggregateOperatorCount, Temporality: v3.Unspecified, @@ -227,7 +242,7 @@ func BuildBuilderQueriesKafkaOnboarding(messagingQueue *MessagingQueue) (*v3.Que StepInterval: common.MinAllowedStepInterval(unixMilliStart, unixMilliEnd), DataSource: v3.DataSourceMetrics, AggregateAttribute: v3.AttributeKey{ - Key: "kafka_consumer_group_lag", + Key: getDotMetrics("kafka_consumer_group_lag", normalized), }, AggregateOperator: v3.AggregateOperatorCount, Temporality: v3.Unspecified, @@ -411,3 +426,19 @@ func buildCompositeQuery(chq *v3.ClickHouseQuery, queryContext string) (*v3.Comp PanelType: v3.PanelTypeTable, }, nil } + +func getDotMetrics(metricName string, normalized bool) string { + dotMetricsMap := map[string]string{ + "kafka_producer_byte_rate": "kafka.producer.byte-rate", + "service_name": "service.name", + "kafka_consumer_fetch_latency_avg": "kafka.consumer.fetch_latency_avg", + "service_instance_id": "service.instance.id", + "client_id": "client-id", + "kafka_consumer_group_lag": "kafka.consumer_group.lag", + } + if _, ok := dotMetricsMap[metricName]; ok && !normalized { + return dotMetricsMap[metricName] + } else { + return metricName + } +} diff --git a/pkg/query-service/app/integrations/test_utils.go b/pkg/query-service/app/integrations/test_utils.go index 94a2954e87..27ba204b96 100644 --- a/pkg/query-service/app/integrations/test_utils.go +++ b/pkg/query-service/app/integrations/test_utils.go @@ -12,6 +12,7 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/utils" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes" ruletypes "github.com/SigNoz/signoz/pkg/types/ruletypes" ) @@ -30,7 +31,7 @@ func NewTestIntegrationsManager(t *testing.T) (*Manager, sqlstore.SQLStore) { }, testDB } -func createTestUser(organizationModule organization.Module, userModule user.Module) (*types.User, *model.ApiError) { +func createTestUser(organizationModule organization.Setter, userModule user.Module) (*types.User, *model.ApiError) { // Create a test user for auth ctx := context.Background() organization := types.NewOrganization("test") @@ -121,7 +122,7 @@ func (t *TestAvailableIntegrationsRepo) list( }, }, }, - Dashboards: []types.DashboardData{}, + Dashboards: []dashboardtypes.StorableDashboardData{}, Alerts: []ruletypes.PostableRule{}, }, ConnectionTests: &IntegrationConnectionTests{ @@ -189,7 +190,7 @@ func (t *TestAvailableIntegrationsRepo) list( }, }, }, - Dashboards: []types.DashboardData{}, + Dashboards: []dashboardtypes.StorableDashboardData{}, Alerts: []ruletypes.PostableRule{}, }, ConnectionTests: &IntegrationConnectionTests{ diff --git a/pkg/query-service/app/metrics/v4/cumulative/table_test.go b/pkg/query-service/app/metrics/v4/cumulative/table_test.go index cf81758cee..8372751dbd 100644 --- a/pkg/query-service/app/metrics/v4/cumulative/table_test.go +++ b/pkg/query-service/app/metrics/v4/cumulative/table_test.go @@ -51,7 +51,7 @@ func TestPrepareTableQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = cumulative", @@ -93,7 +93,7 @@ func TestPrepareTableQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = avg, space aggregation = avg, temporality = unspecified, testing metrics and attribute name with dot", diff --git a/pkg/query-service/app/metrics/v4/cumulative/timeseries.go b/pkg/query-service/app/metrics/v4/cumulative/timeseries.go index aaf182c723..061f6316af 100644 --- a/pkg/query-service/app/metrics/v4/cumulative/timeseries.go +++ b/pkg/query-service/app/metrics/v4/cumulative/timeseries.go @@ -120,6 +120,7 @@ func prepareTimeAggregationSubQuery(start, end, step int64, mq *v3.BuilderQuery) tableName := helpers.WhichSamplesTableToUse(start, end, mq) + samplesTableFilter = helpers.AddFlagsFilters(samplesTableFilter, tableName) // Select the aggregate value for interval queryTmpl := "SELECT fingerprint, %s" + diff --git a/pkg/query-service/app/metrics/v4/cumulative/timeseries_test.go b/pkg/query-service/app/metrics/v4/cumulative/timeseries_test.go index 59487e4127..c1e514fcc9 100644 --- a/pkg/query-service/app/metrics/v4/cumulative/timeseries_test.go +++ b/pkg/query-service/app/metrics/v4/cumulative/timeseries_test.go @@ -66,7 +66,7 @@ func TestPrepareTimeAggregationSubQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'service_name') != 'payment_service' AND JSONExtractString(labels, 'endpoint') IN ['/paycallback','/payme','/paypal']) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", + expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'service_name') != 'payment_service' AND JSONExtractString(labels, 'endpoint') IN ['/paycallback','/payme','/paypal']) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", }, { name: "test time aggregation = rate, temporality = cumulative", @@ -107,7 +107,7 @@ func TestPrepareTimeAggregationSubQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)", + expectedQueryContains: "SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)", }, } @@ -168,7 +168,7 @@ func TestPrepareTimeseriesQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = cumulative", @@ -210,7 +210,7 @@ func TestPrepareTimeseriesQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = avg, space aggregation = avg, temporality = unspecified, testing metrics and attribute name with dot", diff --git a/pkg/query-service/app/metrics/v4/delta/table_test.go b/pkg/query-service/app/metrics/v4/delta/table_test.go index 512cfeeeba..e18e5dbbde 100644 --- a/pkg/query-service/app/metrics/v4/delta/table_test.go +++ b/pkg/query-service/app/metrics/v4/delta/table_test.go @@ -53,7 +53,7 @@ func TestPrepareTableQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = delta", @@ -95,7 +95,7 @@ func TestPrepareTableQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = rate, space aggregation = avg, temporality = delta, testing metrics and attribute name with dot", @@ -143,7 +143,7 @@ func TestPrepareTableQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT ts, avg(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['signoz.latency.sum'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'host.name') = '4f6ec470feea') as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz.latency.sum'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, avg(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['signoz.latency.sum'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'host.name') = '4f6ec470feea') as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz.latency.sum'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, } diff --git a/pkg/query-service/app/metrics/v4/delta/time_series_test.go b/pkg/query-service/app/metrics/v4/delta/time_series_test.go index a34c92ee44..255fa26a85 100644 --- a/pkg/query-service/app/metrics/v4/delta/time_series_test.go +++ b/pkg/query-service/app/metrics/v4/delta/time_series_test.go @@ -66,7 +66,7 @@ func TestPrepareTimeAggregationSubQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'service_name') != 'payment_service' AND JSONExtractString(labels, 'endpoint') IN ['/paycallback','/payme','/paypal']) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", + expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'service_name') != 'payment_service' AND JSONExtractString(labels, 'endpoint') IN ['/paycallback','/payme','/paypal']) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", }, { name: "test time aggregation = rate, temporality = delta", @@ -107,7 +107,7 @@ func TestPrepareTimeAggregationSubQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", + expectedQueryContains: "SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts", }, } @@ -168,7 +168,7 @@ func TestPrepareTimeseriesQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND JSONExtractString(labels, 'state') != 'idle') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = delta", @@ -210,7 +210,7 @@ func TestPrepareTimeseriesQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['http_requests'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000 AND like(JSONExtractString(labels, 'service_name'), '%payment_service%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['http_requests'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = rate, space aggregation percentile99, type = ExponentialHistogram", @@ -244,7 +244,7 @@ func TestPrepareTimeseriesQuery(t *testing.T) { }, start: 1701794980000, end: 1701796780000, - expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, quantilesDDMerge(0.01, 0.990000)(sketch)[1] as value FROM signoz_metrics.distributed_exp_hist INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['signoz_latency'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, quantilesDDMerge(0.01, 0.990000)(sketch)[1] as value FROM signoz_metrics.distributed_exp_hist INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['signoz_latency'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1701792000000 AND unix_milli < 1701796780000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency'] AND unix_milli >= 1701794980000 AND unix_milli < 1701796780000 AND bitAnd(flags, 1) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = rate, space aggregation = max, temporality = delta, testing metrics and attribute name with dot", diff --git a/pkg/query-service/app/metrics/v4/delta/timeseries.go b/pkg/query-service/app/metrics/v4/delta/timeseries.go index a23042ebbb..d1f57c7050 100644 --- a/pkg/query-service/app/metrics/v4/delta/timeseries.go +++ b/pkg/query-service/app/metrics/v4/delta/timeseries.go @@ -25,9 +25,10 @@ func prepareTimeAggregationSubQuery(start, end, step int64, mq *v3.BuilderQuery) } samplesTableFilter := fmt.Sprintf("metric_name IN %s AND unix_milli >= %d AND unix_milli < %d", utils.ClickHouseFormattedMetricNames(mq.AggregateAttribute.Key), start, end) - tableName := helpers.WhichSamplesTableToUse(start, end, mq) + samplesTableFilter = helpers.AddFlagsFilters(samplesTableFilter, tableName) + // Select the aggregate value for interval queryTmpl := "SELECT fingerprint, %s" + @@ -87,6 +88,7 @@ func prepareQueryOptimized(start, end, step int64, mq *v3.BuilderQuery) (string, tableName := helpers.WhichSamplesTableToUse(start, end, mq) + samplesTableFilter = helpers.AddFlagsFilters(samplesTableFilter, tableName) // Select the aggregate value for interval queryTmpl := "SELECT %s" + diff --git a/pkg/query-service/app/metrics/v4/helpers/sub_query.go b/pkg/query-service/app/metrics/v4/helpers/sub_query.go index a5a7eaa17b..efad01fd73 100644 --- a/pkg/query-service/app/metrics/v4/helpers/sub_query.go +++ b/pkg/query-service/app/metrics/v4/helpers/sub_query.go @@ -263,7 +263,11 @@ func PrepareTimeseriesFilterQuery(start, end int64, mq *v3.BuilderQuery) (string conditions = append(conditions, fmt.Sprintf("metric_name IN %s", utils.ClickHouseFormattedMetricNames(mq.AggregateAttribute.Key))) conditions = append(conditions, fmt.Sprintf("temporality = '%s'", mq.Temporality)) - conditions = append(conditions, "__normalized = true") + if constants.IsDotMetricsEnabled { + conditions = append(conditions, "__normalized = false") + } else { + conditions = append(conditions, "__normalized = true") + } start, end, tableName := whichTSTableToUse(start, end, mq) @@ -351,7 +355,11 @@ func PrepareTimeseriesFilterQueryV3(start, end int64, mq *v3.BuilderQuery) (stri conditions = append(conditions, fmt.Sprintf("metric_name IN %s", utils.ClickHouseFormattedMetricNames(mq.AggregateAttribute.Key))) conditions = append(conditions, fmt.Sprintf("temporality = '%s'", mq.Temporality)) - conditions = append(conditions, "__normalized = true") + if constants.IsDotMetricsEnabled { + conditions = append(conditions, "__normalized = false") + } else { + conditions = append(conditions, "__normalized = true") + } start, end, tableName := whichTSTableToUse(start, end, mq) @@ -428,3 +436,10 @@ func PrepareTimeseriesFilterQueryV3(start, end int64, mq *v3.BuilderQuery) (stri return filterSubQuery, nil } + +func AddFlagsFilters(samplesTableFilter string, tableName string) string { + if tableName == constants.SIGNOZ_SAMPLES_V4_TABLENAME || tableName == constants.SIGNOZ_SAMPLES_V4_LOCAL_TABLENAME || tableName == constants.SIGNOZ_EXP_HISTOGRAM_TABLENAME || tableName == constants.SIGNOZ_EXP_HISTOGRAM_LOCAL_TABLENAME { + samplesTableFilter = fmt.Sprintf("%s AND %s", samplesTableFilter, "bitAnd(flags, 1) = 0") + } + return samplesTableFilter +} diff --git a/pkg/query-service/app/metrics/v4/query_builder_test.go b/pkg/query-service/app/metrics/v4/query_builder_test.go index 032e2d2814..8207ec81ed 100644 --- a/pkg/query-service/app/metrics/v4/query_builder_test.go +++ b/pkg/query-service/app/metrics/v4/query_builder_test.go @@ -194,7 +194,7 @@ func TestPrepareMetricQueryCumulativeRate(t *testing.T) { TimeAggregation: v3.TimeAggregationRate, SpaceAggregation: v3.SpaceAggregationSum, }, - expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991920000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, ts, sum(per_series_value) as value FROM (SELECT service_name, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991920000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = cumulative, multiple group by", @@ -227,7 +227,7 @@ func TestPrepareMetricQueryCumulativeRate(t *testing.T) { TimeAggregation: v3.TimeAggregationRate, SpaceAggregation: v3.SpaceAggregationSum, }, - expectedQueryContains: "SELECT service_name, endpoint, ts, sum(per_series_value) as value FROM (SELECT service_name, endpoint, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, any(endpoint) as endpoint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'endpoint') as endpoint, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991920000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, endpoint, ts ORDER BY service_name ASC, endpoint ASC, ts ASC", + expectedQueryContains: "SELECT service_name, endpoint, ts, sum(per_series_value) as value FROM (SELECT service_name, endpoint, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, any(endpoint) as endpoint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'endpoint') as endpoint, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991920000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, endpoint, ts ORDER BY service_name ASC, endpoint ASC, ts ASC", }, } @@ -268,7 +268,7 @@ func TestPrepareMetricQueryDeltaRate(t *testing.T) { TimeAggregation: v3.TimeAggregationRate, SpaceAggregation: v3.SpaceAggregationSum, }, - expectedQueryContains: "SELECT toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test time aggregation = rate, space aggregation = sum, temporality = delta, group by service_name", @@ -294,7 +294,7 @@ func TestPrepareMetricQueryDeltaRate(t *testing.T) { TimeAggregation: v3.TimeAggregationRate, SpaceAggregation: v3.SpaceAggregationSum, }, - expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_calls_total'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_calls_total'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, } @@ -349,7 +349,7 @@ func TestPrepreMetricQueryCumulativeQuantile(t *testing.T) { Disabled: false, SpaceAggregation: v3.SpaceAggregationPercentile99, }, - expectedQueryContains: "SELECT service_name, ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT service_name, le, ts, sum(per_series_value) as value FROM (SELECT service_name, le, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, any(le) as le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, le, ts ORDER BY service_name ASC, le ASC, ts ASC) GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT service_name, le, ts, sum(per_series_value) as value FROM (SELECT service_name, le, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(service_name) as service_name, any(le) as le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY service_name, le, ts ORDER BY service_name ASC, le ASC, ts ASC) GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test temporality = cumulative, quantile = 0.99 without group by", @@ -379,7 +379,7 @@ func TestPrepreMetricQueryCumulativeQuantile(t *testing.T) { Disabled: false, SpaceAggregation: v3.SpaceAggregationPercentile99, }, - expectedQueryContains: "SELECT ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT le, ts, sum(per_series_value) as value FROM (SELECT le, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(le) as le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY le, ts ORDER BY le ASC, ts ASC) GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT le, ts, sum(per_series_value) as value FROM (SELECT le, ts, If((per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) < 0, nan, If((ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window) >= 86400, nan, (per_series_value - lagInFrame(per_series_value, 1, 0) OVER rate_window) / (ts - lagInFrame(ts, 1, toDate('1970-01-01')) OVER rate_window))) as per_series_value FROM (SELECT fingerprint, any(le) as le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WINDOW rate_window as (PARTITION BY fingerprint ORDER BY fingerprint, ts)) WHERE isNaN(per_series_value) = 0 GROUP BY le, ts ORDER BY le ASC, ts ASC) GROUP BY ts ORDER BY ts ASC", }, } @@ -434,7 +434,7 @@ func TestPrepreMetricQueryDeltaQuantile(t *testing.T) { Disabled: false, SpaceAggregation: v3.SpaceAggregationPercentile99, }, - expectedQueryContains: "SELECT service_name, ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT service_name, le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY service_name, le, ts ORDER BY service_name ASC, le ASC, ts ASC) GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", + expectedQueryContains: "SELECT service_name, ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT service_name, le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'service_name') as service_name, JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY service_name, le, ts ORDER BY service_name ASC, le ASC, ts ASC) GROUP BY service_name, ts ORDER BY service_name ASC, ts ASC", }, { name: "test temporality = delta, quantile = 0.99 no group by", @@ -464,7 +464,7 @@ func TestPrepreMetricQueryDeltaQuantile(t *testing.T) { Disabled: false, SpaceAggregation: v3.SpaceAggregationPercentile99, }, - expectedQueryContains: "SELECT ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY le, ts ORDER BY le ASC, ts ASC) GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), 0.990) as value FROM (SELECT le, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, sum(value)/60 as value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'le') as le, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['signoz_latency_bucket'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND like(JSONExtractString(labels, 'service_name'), '%frontend%')) as filtered_time_series USING fingerprint WHERE metric_name IN ['signoz_latency_bucket'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY le, ts ORDER BY le ASC, ts ASC) GROUP BY ts ORDER BY ts ASC", }, } @@ -505,7 +505,7 @@ func TestPrepareMetricQueryGauge(t *testing.T) { SpaceAggregation: v3.SpaceAggregationSum, Disabled: false, }, - expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system_cpu_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['system_cpu_usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", + expectedQueryContains: "SELECT ts, sum(per_series_value) as value FROM (SELECT fingerprint, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system_cpu_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['system_cpu_usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY ts ORDER BY ts ASC", }, { name: "test value filter with string value", @@ -562,7 +562,7 @@ func TestPrepareMetricQueryGauge(t *testing.T) { Expression: "A", Disabled: false, }, - expectedQueryContains: "SELECT host_name, ts, sum(per_series_value) as value FROM (SELECT fingerprint, any(host_name) as host_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'host_name') as host_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system_cpu_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['system_cpu_usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY host_name, ts ORDER BY host_name ASC, ts ASC", + expectedQueryContains: "SELECT host_name, ts, sum(per_series_value) as value FROM (SELECT fingerprint, any(host_name) as host_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, avg(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'host_name') as host_name, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system_cpu_usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000) as filtered_time_series USING fingerprint WHERE metric_name IN ['system_cpu_usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY host_name, ts ORDER BY host_name ASC, ts ASC", }, { name: "test gauge query with multiple group by with metric and attribute name containing dot", @@ -631,7 +631,7 @@ func TestPrepareMetricQueryGauge(t *testing.T) { ReduceTo: v3.ReduceToOperatorAvg, Having: []v3.Having{}, }, - expectedQueryContains: "SELECT `os.type`, state, `host.name`, ts, max(per_series_value) as value FROM (SELECT fingerprint, any(`os.type`) as `os.type`, any(state) as state, any(`host.name`) as `host.name`, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'os.type') as `os.type`, JSONExtractString(labels, 'state') as state, JSONExtractString(labels, 'host.name') as `host.name`, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system.memory.usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND JSONExtractString(labels, 'host.name') = 'signoz-host') as filtered_time_series USING fingerprint WHERE metric_name IN ['system.memory.usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY `os.type`, state, `host.name`, ts ORDER BY `os.type` desc, state asc, `host.name` ASC, ts ASC", + expectedQueryContains: "SELECT `os.type`, state, `host.name`, ts, max(per_series_value) as value FROM (SELECT fingerprint, any(`os.type`) as `os.type`, any(state) as state, any(`host.name`) as `host.name`, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, max(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'os.type') as `os.type`, JSONExtractString(labels, 'state') as state, JSONExtractString(labels, 'host.name') as `host.name`, fingerprint FROM signoz_metrics.time_series_v4_1day WHERE metric_name IN ['system.memory.usage'] AND temporality = 'Unspecified' AND __normalized = true AND unix_milli >= 1650931200000 AND unix_milli < 1651078380000 AND JSONExtractString(labels, 'host.name') = 'signoz-host') as filtered_time_series USING fingerprint WHERE metric_name IN ['system.memory.usage'] AND unix_milli >= 1650991980000 AND unix_milli < 1651078380000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY `os.type`, state, `host.name`, ts ORDER BY `os.type` desc, state asc, `host.name` ASC, ts ASC", }, } @@ -711,7 +711,7 @@ func TestPrepareMetricQueryValueTypePanelWithGroupBY(t *testing.T) { }, }, }, - expectedQueryContains: "SELECT max(value) as aggregated_value, ts FROM (SELECT state, ts, avg(per_series_value) as value FROM (SELECT fingerprint, any(state) as state, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, anyLast(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'state') as state, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1735891200000 AND unix_milli < 1735894800000 AND JSONExtractString(labels, 'os_type') = 'linux') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1735891800000 AND unix_milli < 1735894800000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY state, ts ORDER BY state desc, ts ASC) GROUP BY ts ORDER BY ts", + expectedQueryContains: "SELECT max(value) as aggregated_value, ts FROM (SELECT state, ts, avg(per_series_value) as value FROM (SELECT fingerprint, any(state) as state, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, anyLast(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'state') as state, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Delta' AND __normalized = true AND unix_milli >= 1735891200000 AND unix_milli < 1735894800000 AND JSONExtractString(labels, 'os_type') = 'linux') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1735891800000 AND unix_milli < 1735894800000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY state, ts ORDER BY state desc, ts ASC) GROUP BY ts ORDER BY ts", }, { name: "test temporality = cumulative, panel = value, series agg = max group by state, host_name", @@ -777,7 +777,7 @@ func TestPrepareMetricQueryValueTypePanelWithGroupBY(t *testing.T) { }, }, }, - expectedQueryContains: "SELECT max(value) as aggregated_value, ts FROM (SELECT state, host_name, ts, avg(per_series_value) as value FROM (SELECT fingerprint, any(state) as state, any(host_name) as host_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, anyLast(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'state') as state, JSONExtractString(labels, 'host_name') as host_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1735891200000 AND unix_milli < 1735894800000 AND JSONExtractString(labels, 'os_type') = 'linux') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1735891800000 AND unix_milli < 1735894800000 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY state, host_name, ts ORDER BY state desc, host_name ASC, ts ASC) GROUP BY ts ORDER BY ts", + expectedQueryContains: "SELECT max(value) as aggregated_value, ts FROM (SELECT state, host_name, ts, avg(per_series_value) as value FROM (SELECT fingerprint, any(state) as state, any(host_name) as host_name, toStartOfInterval(toDateTime(intDiv(unix_milli, 1000)), INTERVAL 60 SECOND) as ts, anyLast(value) as per_series_value FROM signoz_metrics.distributed_samples_v4 INNER JOIN (SELECT DISTINCT JSONExtractString(labels, 'state') as state, JSONExtractString(labels, 'host_name') as host_name, fingerprint FROM signoz_metrics.time_series_v4 WHERE metric_name IN ['system_memory_usage'] AND temporality = 'Cumulative' AND __normalized = true AND unix_milli >= 1735891200000 AND unix_milli < 1735894800000 AND JSONExtractString(labels, 'os_type') = 'linux') as filtered_time_series USING fingerprint WHERE metric_name IN ['system_memory_usage'] AND unix_milli >= 1735891800000 AND unix_milli < 1735894800000 AND bitAnd(flags, 1) = 0 GROUP BY fingerprint, ts ORDER BY fingerprint, ts) WHERE isNaN(per_series_value) = 0 GROUP BY state, host_name, ts ORDER BY state desc, host_name ASC, ts ASC) GROUP BY ts ORDER BY ts", }, } diff --git a/pkg/query-service/app/metricsexplorer/summary.go b/pkg/query-service/app/metricsexplorer/summary.go index 4027dd0500..2f51013f72 100644 --- a/pkg/query-service/app/metricsexplorer/summary.go +++ b/pkg/query-service/app/metricsexplorer/summary.go @@ -33,11 +33,7 @@ func NewSummaryService(reader interfaces.Reader, alertManager *rules.Manager, da func (receiver *SummaryService) FilterKeys(ctx context.Context, params *metrics_explorer.FilterKeyRequest) (*metrics_explorer.FilterKeyResponse, *model.ApiError) { var response metrics_explorer.FilterKeyResponse - keys, apiError := receiver.reader.GetAllMetricFilterAttributeKeys( - ctx, - params, - true, - ) + keys, apiError := receiver.reader.GetAllMetricFilterAttributeKeys(ctx, params) if apiError != nil { return nil, apiError } @@ -56,7 +52,7 @@ func (receiver *SummaryService) FilterValues(ctx context.Context, orgID valuer.U case "metric_name": var filterValues []string request := v3.AggregateAttributeRequest{DataSource: v3.DataSourceMetrics, SearchText: params.SearchText, Limit: params.Limit} - attributes, err := receiver.reader.GetMetricAggregateAttributes(ctx, orgID, &request, true, true) + attributes, err := receiver.reader.GetMetricAggregateAttributes(ctx, orgID, &request, true) if err != nil { return nil, model.InternalError(err) } @@ -165,7 +161,12 @@ func (receiver *SummaryService) GetMetricsSummary(ctx context.Context, orgID val if errv2 != nil { return &model.ApiError{Typ: model.ErrorInternal, Err: errv2} } - data, err := receiver.dashboard.GetByMetricNames(ctx, claims.OrgID, metricNames) + + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + return &model.ApiError{Typ: model.ErrorBadData, Err: err} + } + data, err := receiver.dashboard.GetByMetricNames(ctx, orgID, metricNames) if err != nil { return err } @@ -338,7 +339,11 @@ func (receiver *SummaryService) GetRelatedMetrics(ctx context.Context, params *m if errv2 != nil { return &model.ApiError{Typ: model.ErrorInternal, Err: errv2} } - names, err := receiver.dashboard.GetByMetricNames(ctx, claims.OrgID, metricNames) + orgID, err := valuer.NewUUID(claims.OrgID) + if err != nil { + return &model.ApiError{Typ: model.ErrorBadData, Err: err} + } + names, err := receiver.dashboard.GetByMetricNames(ctx, orgID, metricNames) if err != nil { return err } diff --git a/pkg/query-service/app/parser.go b/pkg/query-service/app/parser.go index b6ebd05f55..e0e957927a 100644 --- a/pkg/query-service/app/parser.go +++ b/pkg/query-service/app/parser.go @@ -8,6 +8,7 @@ import ( "fmt" "math" "net/http" + "sort" "strconv" "strings" "text/template" @@ -882,10 +883,23 @@ func ParseQueryRangeParams(r *http.Request) (*v3.QueryRangeParamsV3, *model.ApiE } chTransformQuery(chQuery.Query, queryRangeParams.Variables) - for name, value := range queryRangeParams.Variables { - chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("{{%s}}", name), fmt.Sprint(value), -1) - chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("[[%s]]", name), fmt.Sprint(value), -1) - chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("$%s", name), fmt.Sprint(value), -1) + + keys := make([]string, 0, len(queryRangeParams.Variables)) + + querytemplate.AssignReservedVarsV3(queryRangeParams) + + for k := range queryRangeParams.Variables { + keys = append(keys, k) + } + + sort.Slice(keys, func(i, j int) bool { + return len(keys[i]) > len(keys[j]) + }) + + for _, k := range keys { + chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("{{%s}}", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) + chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("[[%s]]", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) + chQuery.Query = strings.Replace(chQuery.Query, fmt.Sprintf("$%s", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) } tmpl := template.New("clickhouse-query") @@ -896,7 +910,6 @@ func ParseQueryRangeParams(r *http.Request) (*v3.QueryRangeParamsV3, *model.ApiE var query bytes.Buffer // replace go template variables - querytemplate.AssignReservedVarsV3(queryRangeParams) err = tmpl.Execute(&query, queryRangeParams.Variables) if err != nil { @@ -913,10 +926,22 @@ func ParseQueryRangeParams(r *http.Request) (*v3.QueryRangeParamsV3, *model.ApiE continue } - for name, value := range queryRangeParams.Variables { - promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("{{%s}}", name), fmt.Sprint(value), -1) - promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("[[%s]]", name), fmt.Sprint(value), -1) - promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("$%s", name), fmt.Sprint(value), -1) + querytemplate.AssignReservedVarsV3(queryRangeParams) + + keys := make([]string, 0, len(queryRangeParams.Variables)) + + for k := range queryRangeParams.Variables { + keys = append(keys, k) + } + + sort.Slice(keys, func(i, j int) bool { + return len(keys[i]) > len(keys[j]) + }) + + for _, k := range keys { + promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("{{%s}}", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) + promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("[[%s]]", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) + promQuery.Query = strings.Replace(promQuery.Query, fmt.Sprintf("$%s", k), fmt.Sprint(queryRangeParams.Variables[k]), -1) } tmpl := template.New("prometheus-query") @@ -926,9 +951,6 @@ func ParseQueryRangeParams(r *http.Request) (*v3.QueryRangeParamsV3, *model.ApiE } var query bytes.Buffer - // replace go template variables - querytemplate.AssignReservedVarsV3(queryRangeParams) - err = tmpl.Execute(&query, queryRangeParams.Variables) if err != nil { return nil, &model.ApiError{Typ: model.ErrorBadData, Err: err} diff --git a/pkg/query-service/app/server.go b/pkg/query-service/app/server.go index b060e47000..46cbf3f567 100644 --- a/pkg/query-service/app/server.go +++ b/pkg/query-service/app/server.go @@ -15,6 +15,7 @@ import ( "github.com/SigNoz/signoz/pkg/apis/fields" "github.com/SigNoz/signoz/pkg/http/middleware" "github.com/SigNoz/signoz/pkg/licensing/nooplicensing" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/prometheus" "github.com/SigNoz/signoz/pkg/query-service/agentConf" "github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader" @@ -85,6 +86,16 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { return nil, err } + integrationsController, err := integrations.NewController(serverOptions.SigNoz.SQLStore) + if err != nil { + return nil, err + } + + cloudIntegrationsController, err := cloudintegrations.NewController(serverOptions.SigNoz.SQLStore) + if err != nil { + return nil, err + } + reader := clickhouseReader.NewReader( serverOptions.SigNoz.SQLStore, serverOptions.SigNoz.TelemetryStore, @@ -101,6 +112,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { serverOptions.SigNoz.SQLStore, serverOptions.SigNoz.TelemetryStore, serverOptions.SigNoz.Prometheus, + serverOptions.SigNoz.Modules.OrgGetter, ) if err != nil { return nil, err @@ -111,16 +123,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { return nil, err } - integrationsController, err := integrations.NewController(serverOptions.SigNoz.SQLStore) - if err != nil { - return nil, fmt.Errorf("couldn't create integrations controller: %w", err) - } - - cloudIntegrationsController, err := cloudintegrations.NewController(serverOptions.SigNoz.SQLStore) - if err != nil { - return nil, fmt.Errorf("couldn't create cloud provider integrations controller: %w", err) - } - logParsingPipelineController, err := logparsingpipeline.NewLogParsingPipelinesController( serverOptions.SigNoz.SQLStore, integrationsController.GetPipelinesForInstalledIntegrations, ) @@ -194,7 +196,7 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) { &opAmpModel.AllAgents, agentConfMgr, ) - orgs, err := apiHandler.Signoz.Modules.Organization.GetAll(context.Background()) + orgs, err := apiHandler.Signoz.Modules.OrgGetter.ListByOwnedKeyRange(context.Background()) if err != nil { return nil, err } @@ -212,14 +214,14 @@ func (s *Server) createPrivateServer(api *APIHandler) (*http.Server, error) { r := NewRouter() - r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) + r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, s.serverOptions.SigNoz.Sharder, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) r.Use(middleware.NewTimeout(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Timeout.ExcludedRoutes, s.serverOptions.Config.APIServer.Timeout.Default, s.serverOptions.Config.APIServer.Timeout.Max, ).Wrap) r.Use(middleware.NewAnalytics().Wrap) - r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.SigNoz.Sharder).Wrap) r.Use(middleware.NewLogging(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Logging.ExcludedRoutes).Wrap) api.RegisterPrivateRoutes(r) @@ -243,14 +245,14 @@ func (s *Server) createPrivateServer(api *APIHandler) (*http.Server, error) { func (s *Server) createPublicServer(api *APIHandler, web web.Web) (*http.Server, error) { r := NewRouter() - r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) + r.Use(middleware.NewAuth(s.serverOptions.Jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, s.serverOptions.SigNoz.Sharder, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) r.Use(middleware.NewTimeout(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Timeout.ExcludedRoutes, s.serverOptions.Config.APIServer.Timeout.Default, s.serverOptions.Config.APIServer.Timeout.Max, ).Wrap) r.Use(middleware.NewAnalytics().Wrap) - r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger()).Wrap) + r.Use(middleware.NewAPIKey(s.serverOptions.SigNoz.SQLStore, []string{"SIGNOZ-API-KEY"}, s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.SigNoz.Sharder).Wrap) r.Use(middleware.NewLogging(s.serverOptions.SigNoz.Instrumentation.Logger(), s.serverOptions.Config.APIServer.Logging.ExcludedRoutes).Wrap) am := middleware.NewAuthZ(s.serverOptions.SigNoz.Instrumentation.Logger()) @@ -267,6 +269,7 @@ func (s *Server) createPublicServer(api *APIHandler, web web.Web) (*http.Server, api.RegisterMessagingQueuesRoutes(r, am) api.RegisterThirdPartyApiRoutes(r, am) api.MetricExplorerRoutes(r, am) + api.RegisterTraceFunnelsRoutes(r, am) c := cors.New(cors.Options{ AllowedOrigins: []string{"*"}, @@ -416,6 +419,7 @@ func makeRulesManager( sqlstore sqlstore.SQLStore, telemetryStore telemetrystore.TelemetryStore, prometheus prometheus.Prometheus, + orgGetter organization.Getter, ) (*rules.Manager, error) { // create manager opts managerOpts := &rules.ManagerOptions{ @@ -428,6 +432,7 @@ func makeRulesManager( Cache: cache, EvalDelay: constants.GetEvalDelay(), SQLStore: sqlstore, + OrgGetter: orgGetter, } // create Manager diff --git a/pkg/query-service/app/traces/v4/query_builder.go b/pkg/query-service/app/traces/v4/query_builder.go index 7b2befdd95..69a76de4d1 100644 --- a/pkg/query-service/app/traces/v4/query_builder.go +++ b/pkg/query-service/app/traces/v4/query_builder.go @@ -87,7 +87,7 @@ func existsSubQueryForFixedColumn(key v3.AttributeKey, op v3.FilterOperator) (st } } -func buildTracesFilterQuery(fs *v3.FilterSet) (string, error) { +func BuildTracesFilterQuery(fs *v3.FilterSet) (string, error) { var conditions []string if fs != nil && len(fs.Items) != 0 { @@ -167,7 +167,7 @@ func handleEmptyValuesInGroupBy(groupBy []v3.AttributeKey) (string, error) { Operator: "AND", Items: filterItems, } - return buildTracesFilterQuery(&filterSet) + return BuildTracesFilterQuery(&filterSet) } return "", nil } @@ -248,7 +248,7 @@ func buildTracesQuery(start, end, step int64, mq *v3.BuilderQuery, panelType v3. timeFilter := fmt.Sprintf("(timestamp >= '%d' AND timestamp <= '%d') AND (ts_bucket_start >= %d AND ts_bucket_start <= %d)", tracesStart, tracesEnd, bucketStart, bucketEnd) - filterSubQuery, err := buildTracesFilterQuery(mq.Filters) + filterSubQuery, err := BuildTracesFilterQuery(mq.Filters) if err != nil { return "", err } diff --git a/pkg/query-service/app/traces/v4/query_builder_test.go b/pkg/query-service/app/traces/v4/query_builder_test.go index eff4070b54..8943083162 100644 --- a/pkg/query-service/app/traces/v4/query_builder_test.go +++ b/pkg/query-service/app/traces/v4/query_builder_test.go @@ -211,7 +211,7 @@ func Test_buildTracesFilterQuery(t *testing.T) { want: "", }, { - name: "Test buildTracesFilterQuery in, nin", + name: "Test BuildTracesFilterQuery in, nin", args: args{ fs: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{ {Key: v3.AttributeKey{Key: "method", DataType: v3.AttributeKeyDataTypeString, Type: v3.AttributeKeyTypeTag}, Value: []interface{}{"GET", "POST"}, Operator: v3.FilterOperatorIn}, @@ -226,7 +226,7 @@ func Test_buildTracesFilterQuery(t *testing.T) { wantErr: false, }, { - name: "Test buildTracesFilterQuery not eq, neq, gt, lt, gte, lte", + name: "Test BuildTracesFilterQuery not eq, neq, gt, lt, gte, lte", args: args{ fs: &v3.FilterSet{Operator: "AND", Items: []v3.FilterItem{ {Key: v3.AttributeKey{Key: "duration", DataType: v3.AttributeKeyDataTypeInt64, Type: v3.AttributeKeyTypeTag}, Value: 102, Operator: v3.FilterOperatorEqual}, @@ -274,13 +274,13 @@ func Test_buildTracesFilterQuery(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := buildTracesFilterQuery(tt.args.fs) + got, err := BuildTracesFilterQuery(tt.args.fs) if (err != nil) != tt.wantErr { - t.Errorf("buildTracesFilterQuery() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("BuildTracesFilterQuery() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { - t.Errorf("buildTracesFilterQuery() = %v, want %v", got, tt.want) + t.Errorf("BuildTracesFilterQuery() = %v, want %v", got, tt.want) } }) } diff --git a/pkg/query-service/auth/auth.go b/pkg/query-service/auth/auth.go deleted file mode 100644 index d157083d4e..0000000000 --- a/pkg/query-service/auth/auth.go +++ /dev/null @@ -1,65 +0,0 @@ -package auth - -import ( - "context" - - "github.com/SigNoz/signoz/pkg/alertmanager" - "github.com/SigNoz/signoz/pkg/modules/organization" - "github.com/SigNoz/signoz/pkg/modules/quickfilter" - "github.com/SigNoz/signoz/pkg/modules/user" - "github.com/SigNoz/signoz/pkg/valuer" - - "github.com/SigNoz/signoz/pkg/query-service/model" - "github.com/SigNoz/signoz/pkg/types" -) - -func RegisterOrgAndFirstUser(ctx context.Context, req *types.PostableRegisterOrgAndAdmin, organizationModule organization.Module, userModule user.Module) (*types.User, *model.ApiError) { - if req.Email == "" { - return nil, model.BadRequest(model.ErrEmailRequired{}) - } - - if req.Password == "" { - return nil, model.BadRequest(model.ErrPasswordRequired{}) - } - - organization := types.NewOrganization(req.OrgDisplayName) - err := organizationModule.Create(ctx, organization) - if err != nil { - return nil, model.InternalError(err) - } - - user, err := types.NewUser(req.Name, req.Email, types.RoleAdmin.String(), organization.ID.StringValue()) - if err != nil { - return nil, model.InternalError(err) - } - - password, err := types.NewFactorPassword(req.Password) - if err != nil { - return nil, model.InternalError(err) - } - - user, err = userModule.CreateUserWithPassword(ctx, user, password) - if err != nil { - return nil, model.InternalError(err) - } - - return user, nil -} - -// First user registration -func Register(ctx context.Context, req *types.PostableRegisterOrgAndAdmin, alertmanager alertmanager.Alertmanager, organizationModule organization.Module, userModule user.Module, quickfiltermodule quickfilter.Module) (*types.User, *model.ApiError) { - user, err := RegisterOrgAndFirstUser(ctx, req, organizationModule, userModule) - if err != nil { - return nil, err - } - - if err := alertmanager.SetDefaultConfig(ctx, user.OrgID); err != nil { - return nil, model.InternalError(err) - } - - if err := quickfiltermodule.SetDefaultConfig(ctx, valuer.MustNewUUID(user.OrgID)); err != nil { - return nil, model.InternalError(err) - } - - return user, nil -} diff --git a/pkg/query-service/constants/constants.go b/pkg/query-service/constants/constants.go index b01fb6423e..d6430603f0 100644 --- a/pkg/query-service/constants/constants.go +++ b/pkg/query-service/constants/constants.go @@ -138,10 +138,12 @@ var GroupByColMap = map[string]struct{}{ const ( SIGNOZ_METRIC_DBNAME = "signoz_metrics" + SIGNOZ_SAMPLES_V4_LOCAL_TABLENAME = "samples_v4" SIGNOZ_SAMPLES_V4_TABLENAME = "distributed_samples_v4" SIGNOZ_SAMPLES_V4_AGG_5M_TABLENAME = "distributed_samples_v4_agg_5m" SIGNOZ_SAMPLES_V4_AGG_30M_TABLENAME = "distributed_samples_v4_agg_30m" SIGNOZ_EXP_HISTOGRAM_TABLENAME = "distributed_exp_hist" + SIGNOZ_EXP_HISTOGRAM_LOCAL_TABLENAME = "exp_hist" SIGNOZ_TRACE_DBNAME = "signoz_traces" SIGNOZ_SPAN_INDEX_TABLENAME = "distributed_signoz_index_v2" SIGNOZ_SPAN_INDEX_V3 = "distributed_signoz_index_v3" @@ -637,9 +639,14 @@ var DeprecatedStaticFieldsTraces = map[string]v3.AttributeKey{ var StaticFieldsTraces = map[string]v3.AttributeKey{} +var IsDotMetricsEnabled = false + func init() { StaticFieldsTraces = maps.Clone(NewStaticFieldsTraces) maps.Copy(StaticFieldsTraces, DeprecatedStaticFieldsTraces) + if GetOrDefaultEnv(DotMetricsEnabled, "false") == "true" { + IsDotMetricsEnabled = true + } } const TRACE_V4_MAX_PAGINATION_LIMIT = 10000 @@ -665,3 +672,5 @@ const InspectMetricsMaxTimeDiff = 1800000 func GetDefaultSiteURL() string { return GetOrDefaultEnv("SIGNOZ_SITE_URL", HTTPHostPort) } + +const DotMetricsEnabled = "DOT_METRICS_ENABLED" diff --git a/pkg/query-service/interfaces/interface.go b/pkg/query-service/interfaces/interface.go index ac07a0a006..f57ccc3b70 100644 --- a/pkg/query-service/interfaces/interface.go +++ b/pkg/query-service/interfaces/interface.go @@ -49,7 +49,7 @@ type Reader interface { SetTTL(ctx context.Context, orgID string, ttlParams *model.TTLParams) (*model.SetTTLResponseItem, *model.ApiError) FetchTemporality(ctx context.Context, orgID valuer.UUID, metricNames []string) (map[string]map[v3.Temporality]bool, error) - GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipDotNames bool, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) + GetMetricAggregateAttributes(ctx context.Context, orgID valuer.UUID, req *v3.AggregateAttributeRequest, skipSignozMetrics bool) (*v3.AggregateAttributeResponse, error) GetMetricAttributeKeys(ctx context.Context, req *v3.FilterAttributeKeyRequest) (*v3.FilterAttributeKeyResponse, error) GetMetricAttributeValues(ctx context.Context, req *v3.FilterAttributeValueRequest) (*v3.FilterAttributeValueResponse, error) @@ -117,7 +117,7 @@ type Reader interface { GetAllMetricFilterAttributeValues(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError) GetAllMetricFilterUnits(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError) GetAllMetricFilterTypes(ctx context.Context, req *metrics_explorer.FilterValueRequest) ([]string, *model.ApiError) - GetAllMetricFilterAttributeKeys(ctx context.Context, req *metrics_explorer.FilterKeyRequest, skipDotNames bool) (*[]v3.AttributeKey, *model.ApiError) + GetAllMetricFilterAttributeKeys(ctx context.Context, req *metrics_explorer.FilterKeyRequest) (*[]v3.AttributeKey, *model.ApiError) GetMetricsDataPoints(ctx context.Context, metricName string) (uint64, *model.ApiError) GetMetricsLastReceived(ctx context.Context, metricName string) (int64, *model.ApiError) diff --git a/pkg/query-service/main.go b/pkg/query-service/main.go index 18565541ae..ddfb28002b 100644 --- a/pkg/query-service/main.go +++ b/pkg/query-service/main.go @@ -12,6 +12,7 @@ import ( "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/licensing" "github.com/SigNoz/signoz/pkg/licensing/nooplicensing" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/query-service/app" "github.com/SigNoz/signoz/pkg/query-service/constants" "github.com/SigNoz/signoz/pkg/signoz" @@ -121,7 +122,7 @@ func main() { zeus.Config{}, noopzeus.NewProviderFactory(), licensing.Config{}, - func(_ sqlstore.SQLStore, _ zeus.Zeus) factory.ProviderFactory[licensing.Licensing, licensing.Config] { + func(_ sqlstore.SQLStore, _ zeus.Zeus, _ organization.Getter) factory.ProviderFactory[licensing.Licensing, licensing.Config] { return nooplicensing.NewFactory() }, signoz.NewEmailingProviderFactories(), diff --git a/pkg/query-service/metrics/transition.go b/pkg/query-service/metrics/transition.go index 97a37317c7..4affc866e8 100644 --- a/pkg/query-service/metrics/transition.go +++ b/pkg/query-service/metrics/transition.go @@ -5,3 +5,23 @@ var MetricsUnderTransition = map[string]string{ "k8s_node_cpu_utilization": "k8s_node_cpu_usage", "container_cpu_utilization": "container_cpu_usage", } + +var DotMetricsUnderTransition = map[string]string{ + "k8s.pod.cpu.utilization": "k8s.pod.cpu.usage", + "k8s.node.cpu.utilization": "k8s.node.cpu.usage", + "container.cpu.utilization": "container.cpu.usage", +} + +func GetTransitionedMetric(metric string, normalized bool) string { + if normalized { + if _, ok := MetricsUnderTransition[metric]; ok { + return MetricsUnderTransition[metric] + } + return metric + } else { + if _, ok := DotMetricsUnderTransition[metric]; ok { + return DotMetricsUnderTransition[metric] + } + return metric + } +} diff --git a/pkg/query-service/model/errors.go b/pkg/query-service/model/errors.go deleted file mode 100644 index d0b95d279c..0000000000 --- a/pkg/query-service/model/errors.go +++ /dev/null @@ -1,36 +0,0 @@ -package model - -import "fmt" - -// custom errors related to registration -type ErrFeatureUnavailable struct { - Key string -} - -func (errFeatureUnavailable ErrFeatureUnavailable) Error() string { - return fmt.Sprintf("feature unavailable: %s", errFeatureUnavailable.Key) -} - -type ErrEmailRequired struct{} - -func (errEmailRequired ErrEmailRequired) Error() string { - return "email is required" -} - -type ErrPasswordRequired struct{} - -func (errPasswordRequired ErrPasswordRequired) Error() string { - return "password is required" -} - -type ErrSignupFailed struct{} - -func (errSignupFailed ErrSignupFailed) Error() string { - return "failed to register user" -} - -type ErrNoOrgFound struct{} - -func (errNoOrgFound ErrNoOrgFound) Error() string { - return "no org found" -} diff --git a/pkg/query-service/rules/manager.go b/pkg/query-service/rules/manager.go index 1d13bfc53d..b7f3f20fb1 100644 --- a/pkg/query-service/rules/manager.go +++ b/pkg/query-service/rules/manager.go @@ -19,6 +19,7 @@ import ( "github.com/SigNoz/signoz/pkg/alertmanager" "github.com/SigNoz/signoz/pkg/cache" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/prometheus" "github.com/SigNoz/signoz/pkg/query-service/interfaces" "github.com/SigNoz/signoz/pkg/query-service/model" @@ -95,6 +96,7 @@ type ManagerOptions struct { PrepareTestRuleFunc func(opts PrepareTestRuleOptions) (int, *model.ApiError) Alertmanager alertmanager.Alertmanager SQLStore sqlstore.SQLStore + OrgGetter organization.Getter } // The Manager manages recording and alerting rules. @@ -116,6 +118,7 @@ type Manager struct { alertmanager alertmanager.Alertmanager sqlstore sqlstore.SQLStore + orgGetter organization.Getter } func defaultOptions(o *ManagerOptions) *ManagerOptions { @@ -210,6 +213,7 @@ func NewManager(o *ManagerOptions) (*Manager, error) { prepareTestRuleFunc: o.PrepareTestRuleFunc, alertmanager: o.Alertmanager, sqlstore: o.SQLStore, + orgGetter: o.OrgGetter, } return m, nil @@ -239,14 +243,14 @@ func (m *Manager) Pause(b bool) { } func (m *Manager) initiate(ctx context.Context) error { - orgIDs, err := m.ruleStore.ListOrgs(ctx) + orgs, err := m.orgGetter.ListByOwnedKeyRange(ctx) if err != nil { return err } var loadErrors []error - for _, orgID := range orgIDs { - storedRules, err := m.ruleStore.GetStoredRules(ctx, orgID.StringValue()) + for _, org := range orgs { + storedRules, err := m.ruleStore.GetStoredRules(ctx, org.ID.StringValue()) if err != nil { return err } @@ -279,7 +283,7 @@ func (m *Manager) initiate(ctx context.Context) error { } } if !parsedRule.Disabled { - err := m.addTask(ctx, orgID, parsedRule, taskName) + err := m.addTask(ctx, org.ID, parsedRule, taskName) if err != nil { zap.L().Error("failed to load the rule definition", zap.String("name", taskName), zap.Error(err)) } diff --git a/pkg/query-service/telemetry/dashboard.go b/pkg/query-service/telemetry/dashboard.go index 5a29a03440..c48c95e927 100644 --- a/pkg/query-service/telemetry/dashboard.go +++ b/pkg/query-service/telemetry/dashboard.go @@ -8,7 +8,7 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/model" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "go.uber.org/zap" ) @@ -16,7 +16,7 @@ import ( func GetDashboardsInfo(ctx context.Context, sqlstore sqlstore.SQLStore) (*model.DashboardsInfo, error) { dashboardsInfo := model.DashboardsInfo{} // fetch dashboards from dashboard db - dashboards := []types.Dashboard{} + dashboards := []dashboardtypes.Dashboard{} err := sqlstore.BunDB().NewSelect().Model(&dashboards).Scan(ctx) if err != nil { zap.L().Error("Error in processing sql query", zap.Error(err)) diff --git a/pkg/query-service/tests/integration/filter_suggestions_test.go b/pkg/query-service/tests/integration/filter_suggestions_test.go index 21665bb3d2..22dda58f07 100644 --- a/pkg/query-service/tests/integration/filter_suggestions_test.go +++ b/pkg/query-service/tests/integration/filter_suggestions_test.go @@ -11,8 +11,12 @@ import ( "testing" "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/SigNoz/signoz/pkg/http/middleware" @@ -304,16 +308,22 @@ func NewFilterSuggestionsTestBed(t *testing.T) *FilterSuggestionsTestBed { mockClickhouse.MatchExpectationsInOrder(false) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(testDB), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, testDB, orgGetter) + require.NoError(t, err) jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) - modules := signoz.NewModules(testDB, jwt, emailing, providerSettings) + emailing := emailingtest.New() + modules := signoz.NewModules(testDB, jwt, emailing, providerSettings, orgGetter, alertmanager) + handlers := signoz.NewHandlers(modules) apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{ Reader: reader, JWT: jwt, Signoz: &signoz.SigNoz{ Modules: modules, - Handlers: signoz.NewHandlers(modules), + Handlers: handlers, }, }) if err != nil { @@ -322,13 +332,12 @@ func NewFilterSuggestionsTestBed(t *testing.T) *FilterSuggestionsTestBed { router := app.NewRouter() //add the jwt middleware - router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) + router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, sharder, instrumentationtest.New().Logger()).Wrap) am := middleware.NewAuthZ(instrumentationtest.New().Logger()) apiHandler.RegisterRoutes(router, am) apiHandler.RegisterQueryRangeV3Routes(router, am) - organizationModule := implorganization.NewModule(implorganization.NewStore(testDB)) - user, apiErr := createTestUser(organizationModule, modules.User) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) if apiErr != nil { t.Fatalf("could not create a test user: %v", apiErr) } diff --git a/pkg/query-service/tests/integration/logparsingpipeline_test.go b/pkg/query-service/tests/integration/logparsingpipeline_test.go index 69e4102ac3..8413d5c358 100644 --- a/pkg/query-service/tests/integration/logparsingpipeline_test.go +++ b/pkg/query-service/tests/integration/logparsingpipeline_test.go @@ -11,8 +11,10 @@ import ( "testing" "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/modules/user" @@ -26,6 +28,8 @@ import ( v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" "github.com/SigNoz/signoz/pkg/query-service/queryBuilderToExpr" "github.com/SigNoz/signoz/pkg/query-service/utils" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" @@ -480,9 +484,14 @@ func NewTestbedWithoutOpamp(t *testing.T, sqlStore sqlstore.SQLStore) *LogPipeli } providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - jwt := authtypes.NewJWT("", 10*time.Minute, 30*time.Minute) - modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlStore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, sqlStore, orgGetter) + require.NoError(t, err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(sqlStore, jwt, emailing, providerSettings, orgGetter, alertmanager) handlers := signoz.NewHandlers(modules) apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{ @@ -497,8 +506,7 @@ func NewTestbedWithoutOpamp(t *testing.T, sqlStore sqlstore.SQLStore) *LogPipeli t.Fatalf("could not create a new ApiHandler: %v", err) } - organizationModule := implorganization.NewModule(implorganization.NewStore(sqlStore)) - user, apiErr := createTestUser(organizationModule, modules.User) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) if apiErr != nil { t.Fatalf("could not create a test user: %v", apiErr) } diff --git a/pkg/query-service/tests/integration/signoz_cloud_integrations_test.go b/pkg/query-service/tests/integration/signoz_cloud_integrations_test.go index 8ea9d7a974..31197263cd 100644 --- a/pkg/query-service/tests/integration/signoz_cloud_integrations_test.go +++ b/pkg/query-service/tests/integration/signoz_cloud_integrations_test.go @@ -9,8 +9,12 @@ import ( "testing" "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/SigNoz/signoz/pkg/http/middleware" @@ -365,9 +369,14 @@ func NewCloudIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *CloudI mockClickhouse.MatchExpectationsInOrder(false) providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - jwt := authtypes.NewJWT("", 10*time.Minute, 30*time.Minute) - modules := signoz.NewModules(testDB, jwt, emailing, providerSettings) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(testDB), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, testDB, orgGetter) + require.NoError(t, err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(testDB, jwt, emailing, providerSettings, orgGetter, alertmanager) handlers := signoz.NewHandlers(modules) apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{ @@ -384,13 +393,12 @@ func NewCloudIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *CloudI } router := app.NewRouter() - router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) + router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, sharder, instrumentationtest.New().Logger()).Wrap) am := middleware.NewAuthZ(instrumentationtest.New().Logger()) apiHandler.RegisterRoutes(router, am) apiHandler.RegisterCloudIntegrationsRoutes(router, am) - organizationModule := implorganization.NewModule(implorganization.NewStore(testDB)) - user, apiErr := createTestUser(organizationModule, modules.User) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) if apiErr != nil { t.Fatalf("could not create a test user: %v", apiErr) } diff --git a/pkg/query-service/tests/integration/signoz_integrations_test.go b/pkg/query-service/tests/integration/signoz_integrations_test.go index 1b221267fb..b5e83b7d02 100644 --- a/pkg/query-service/tests/integration/signoz_integrations_test.go +++ b/pkg/query-service/tests/integration/signoz_integrations_test.go @@ -9,9 +9,10 @@ import ( "testing" "time" - "github.com/SigNoz/signoz/pkg/emailing" - "github.com/SigNoz/signoz/pkg/emailing/noopemailing" - + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/alertmanagerserver" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" + "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/http/middleware" "github.com/SigNoz/signoz/pkg/instrumentation/instrumentationtest" "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" @@ -22,10 +23,13 @@ import ( "github.com/SigNoz/signoz/pkg/query-service/model" v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" "github.com/SigNoz/signoz/pkg/query-service/utils" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/signoz" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/types" "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/types/dashboardtypes" "github.com/SigNoz/signoz/pkg/types/pipelinetypes" mockhouse "github.com/srikanthccv/ClickHouse-go-mock" "github.com/stretchr/testify/require" @@ -354,7 +358,7 @@ func TestDashboardsForInstalledIntegrationDashboards(t *testing.T) { require.GreaterOrEqual(dashboards[0].UpdatedAt.Unix(), tsBeforeInstallation) // Should be able to get installed integrations dashboard by id - dd := integrationsTB.GetDashboardByIdFromQS(dashboards[0].UUID) + dd := integrationsTB.GetDashboardByIdFromQS(dashboards[0].ID) require.GreaterOrEqual(dd.CreatedAt.Unix(), tsBeforeInstallation) require.GreaterOrEqual(dd.UpdatedAt.Unix(), tsBeforeInstallation) require.Equal(*dd, dashboards[0]) @@ -469,7 +473,7 @@ func (tb *IntegrationsTestBed) RequestQSToUninstallIntegration( tb.RequestQS("/api/v1/integrations/uninstall", request) } -func (tb *IntegrationsTestBed) GetDashboardsFromQS() []types.Dashboard { +func (tb *IntegrationsTestBed) GetDashboardsFromQS() []dashboardtypes.Dashboard { result := tb.RequestQS("/api/v1/dashboards", nil) dataJson, err := json.Marshal(result.Data) @@ -477,7 +481,7 @@ func (tb *IntegrationsTestBed) GetDashboardsFromQS() []types.Dashboard { tb.t.Fatalf("could not marshal apiResponse.Data: %v", err) } - dashboards := []types.Dashboard{} + dashboards := []dashboardtypes.Dashboard{} err = json.Unmarshal(dataJson, &dashboards) if err != nil { tb.t.Fatalf(" could not unmarshal apiResponse.Data json into dashboards") @@ -486,7 +490,7 @@ func (tb *IntegrationsTestBed) GetDashboardsFromQS() []types.Dashboard { return dashboards } -func (tb *IntegrationsTestBed) GetDashboardByIdFromQS(dashboardUuid string) *types.Dashboard { +func (tb *IntegrationsTestBed) GetDashboardByIdFromQS(dashboardUuid string) *dashboardtypes.Dashboard { result := tb.RequestQS(fmt.Sprintf("/api/v1/dashboards/%s", dashboardUuid), nil) dataJson, err := json.Marshal(result.Data) @@ -494,7 +498,7 @@ func (tb *IntegrationsTestBed) GetDashboardByIdFromQS(dashboardUuid string) *typ tb.t.Fatalf("could not marshal apiResponse.Data: %v", err) } - dashboard := types.Dashboard{} + dashboard := dashboardtypes.Dashboard{} err = json.Unmarshal(dataJson, &dashboard) if err != nil { tb.t.Fatalf(" could not unmarshal apiResponse.Data json into dashboards") @@ -571,9 +575,14 @@ func NewIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *Integration } providerSettings := instrumentationtest.New().ToProviderSettings() - emailing, _ := noopemailing.New(context.Background(), providerSettings, emailing.Config{}) - jwt := authtypes.NewJWT("", 10*time.Minute, 30*time.Minute) - modules := signoz.NewModules(testDB, jwt, emailing, providerSettings) + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(testDB), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{Signoz: alertmanager.Signoz{PollInterval: 10 * time.Second, Config: alertmanagerserver.NewConfig()}}, testDB, orgGetter) + require.NoError(t, err) + jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) + emailing := emailingtest.New() + modules := signoz.NewModules(testDB, jwt, emailing, providerSettings, orgGetter, alertmanager) handlers := signoz.NewHandlers(modules) apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{ @@ -592,13 +601,12 @@ func NewIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *Integration } router := app.NewRouter() - router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}).Wrap) + router.Use(middleware.NewAuth(jwt, []string{"Authorization", "Sec-WebSocket-Protocol"}, sharder, instrumentationtest.New().Logger()).Wrap) am := middleware.NewAuthZ(instrumentationtest.New().Logger()) apiHandler.RegisterRoutes(router, am) apiHandler.RegisterIntegrationRoutes(router, am) - organizationModule := implorganization.NewModule(implorganization.NewStore(testDB)) - user, apiErr := createTestUser(organizationModule, modules.User) + user, apiErr := createTestUser(modules.OrgSetter, modules.User) if apiErr != nil { t.Fatalf("could not create a test user: %v", apiErr) } diff --git a/pkg/query-service/tests/integration/test_utils.go b/pkg/query-service/tests/integration/test_utils.go index 869d6eeda7..90fb293005 100644 --- a/pkg/query-service/tests/integration/test_utils.go +++ b/pkg/query-service/tests/integration/test_utils.go @@ -147,11 +147,11 @@ func makeTestSignozLog( return testLog } -func createTestUser(organizationModule organization.Module, userModule user.Module) (*types.User, *model.ApiError) { +func createTestUser(orgSetter organization.Setter, userModule user.Module) (*types.User, *model.ApiError) { // Create a test user for auth ctx := context.Background() organization := types.NewOrganization("test") - err := organizationModule.Create(ctx, organization) + err := orgSetter.Create(ctx, organization) if err != nil { return nil, model.InternalError(err) } diff --git a/pkg/query-service/utils/filter_conditions.go b/pkg/query-service/utils/filter_conditions.go index 5fca15a911..14aa909841 100644 --- a/pkg/query-service/utils/filter_conditions.go +++ b/pkg/query-service/utils/filter_conditions.go @@ -88,9 +88,9 @@ func buildSingleFilterCondition(key string, op v3.FilterOperator, fmtVal string, case v3.FilterOperatorLessThanOrEq: return fmt.Sprintf("%s <= %s", keyCondition, fmtVal), nil case v3.FilterOperatorContains: - return fmt.Sprintf("like(%s, %s)", keyCondition, fmtVal), nil + return fmt.Sprintf("ilike(%s, %s)", keyCondition, fmtVal), nil case v3.FilterOperatorNotContains: - return fmt.Sprintf("notLike(%s, %s)", keyCondition, fmtVal), nil + return fmt.Sprintf("notILike(%s, %s)", keyCondition, fmtVal), nil case v3.FilterOperatorExists: return fmt.Sprintf("has(JSONExtractKeys(labels), '%s')", key), nil case v3.FilterOperatorNotExists: diff --git a/pkg/query-service/utils/format.go b/pkg/query-service/utils/format.go index 1acf9d6ff8..a6d7cdcec7 100644 --- a/pkg/query-service/utils/format.go +++ b/pkg/query-service/utils/format.go @@ -233,8 +233,9 @@ func ClickHouseFormattedValue(v interface{}) string { func ClickHouseFormattedMetricNames(v interface{}) string { if name, ok := v.(string); ok { - if newName, ok := metrics.MetricsUnderTransition[name]; ok { - return ClickHouseFormattedValue([]interface{}{name, newName}) + transitionedMetrics := metrics.GetTransitionedMetric(name, !constants.IsDotMetricsEnabled) + if transitionedMetrics != name { + return ClickHouseFormattedValue([]interface{}{name, transitionedMetrics}) } else { return ClickHouseFormattedValue([]interface{}{name}) } diff --git a/pkg/query-service/utils/testutils.go b/pkg/query-service/utils/testutils.go index 5cd7960786..ebad37a9ab 100644 --- a/pkg/query-service/utils/testutils.go +++ b/pkg/query-service/utils/testutils.go @@ -67,6 +67,8 @@ func NewTestSqliteDB(t *testing.T) (sqlStore sqlstore.SQLStore, testDBFilePath s sqlmigration.NewAuthRefactorFactory(sqlStore), sqlmigration.NewMigratePATToFactorAPIKey(sqlStore), sqlmigration.NewUpdateApiMonitoringFiltersFactory(sqlStore), + sqlmigration.NewAddKeyOrganizationFactory(sqlStore), + sqlmigration.NewUpdateDashboardFactory(sqlStore), ), ) if err != nil { diff --git a/pkg/ruler/rulestore/sqlrulestore/rule.go b/pkg/ruler/rulestore/sqlrulestore/rule.go index 735cce6b20..68093eb233 100644 --- a/pkg/ruler/rulestore/sqlrulestore/rule.go +++ b/pkg/ruler/rulestore/sqlrulestore/rule.go @@ -4,7 +4,6 @@ import ( "context" "github.com/SigNoz/signoz/pkg/sqlstore" - "github.com/SigNoz/signoz/pkg/types" ruletypes "github.com/SigNoz/signoz/pkg/types/ruletypes" "github.com/SigNoz/signoz/pkg/valuer" "github.com/jmoiron/sqlx" @@ -118,27 +117,3 @@ func (r *rule) GetRuleUUID(ctx context.Context, ruleID int) (*ruletypes.RuleHist } return ruleHistory, nil } - -func (r *rule) ListOrgs(ctx context.Context) ([]valuer.UUID, error) { - orgIDStrs := make([]string, 0) - err := r.sqlstore. - BunDB(). - NewSelect(). - Model(new(types.Organization)). - Column("id"). - Scan(ctx, &orgIDStrs) - if err != nil { - return nil, err - } - - orgIDs := make([]valuer.UUID, len(orgIDStrs)) - for idx, orgIDStr := range orgIDStrs { - orgID, err := valuer.NewUUID(orgIDStr) - if err != nil { - return nil, err - } - orgIDs[idx] = orgID - } - - return orgIDs, nil -} diff --git a/pkg/sharder/config.go b/pkg/sharder/config.go new file mode 100644 index 0000000000..785d5545c1 --- /dev/null +++ b/pkg/sharder/config.go @@ -0,0 +1,32 @@ +package sharder + +import ( + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type Config struct { + Provider string `mapstructure:"provider"` + Single Single `mapstructure:"single"` +} + +type Single struct { + OrgID valuer.UUID `mapstructure:"org_id"` +} + +func NewConfigFactory() factory.ConfigFactory { + return factory.NewConfigFactory(factory.MustNewName("sharder"), newConfig) +} + +func newConfig() factory.Config { + return &Config{ + Provider: "noop", + Single: Single{ + OrgID: valuer.UUID{}, + }, + } +} + +func (c Config) Validate() error { + return nil +} diff --git a/pkg/sharder/noopsharder/provider.go b/pkg/sharder/noopsharder/provider.go new file mode 100644 index 0000000000..b7c3d02a7d --- /dev/null +++ b/pkg/sharder/noopsharder/provider.go @@ -0,0 +1,33 @@ +package noopsharder + +import ( + "context" + "math" + + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/sharder" +) + +type provider struct { + settings factory.ScopedProviderSettings +} + +func NewFactory() factory.ProviderFactory[sharder.Sharder, sharder.Config] { + return factory.NewProviderFactory(factory.MustNewName("noop"), New) +} + +func New(ctx context.Context, providerSettings factory.ProviderSettings, config sharder.Config) (sharder.Sharder, error) { + settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/sharder/noopsharder") + + return &provider{ + settings: settings, + }, nil +} + +func (provider *provider) GetMyOwnedKeyRange(ctx context.Context) (uint32, uint32, error) { + return 0, math.MaxUint32, nil +} + +func (provider *provider) IsMyOwnedKey(ctx context.Context, key uint32) error { + return nil +} diff --git a/pkg/sharder/sharder.go b/pkg/sharder/sharder.go new file mode 100644 index 0000000000..b627ef37a5 --- /dev/null +++ b/pkg/sharder/sharder.go @@ -0,0 +1,13 @@ +package sharder + +import ( + "context" +) + +type Sharder interface { + // Returns the keys owned by the current instance. + GetMyOwnedKeyRange(context.Context) (uint32, uint32, error) + + // Returns true if the key is owned by the current instance. + IsMyOwnedKey(context.Context, uint32) error +} diff --git a/pkg/sharder/singlesharder/provider.go b/pkg/sharder/singlesharder/provider.go new file mode 100644 index 0000000000..86b7d7197d --- /dev/null +++ b/pkg/sharder/singlesharder/provider.go @@ -0,0 +1,43 @@ +package singlesharder + +import ( + "context" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/valuer" +) + +type provider struct { + settings factory.ScopedProviderSettings + orgID valuer.UUID + orgIDKey uint32 +} + +func NewFactory() factory.ProviderFactory[sharder.Sharder, sharder.Config] { + return factory.NewProviderFactory(factory.MustNewName("single"), New) +} + +func New(ctx context.Context, providerSettings factory.ProviderSettings, config sharder.Config) (sharder.Sharder, error) { + settings := factory.NewScopedProviderSettings(providerSettings, "github.com/SigNoz/signoz/pkg/sharder/singlesharder") + + return &provider{ + settings: settings, + orgID: config.Single.OrgID, + orgIDKey: types.NewOrganizationKey(config.Single.OrgID), + }, nil +} + +func (provider *provider) GetMyOwnedKeyRange(ctx context.Context) (uint32, uint32, error) { + return provider.orgIDKey, provider.orgIDKey, nil +} + +func (provider *provider) IsMyOwnedKey(ctx context.Context, key uint32) error { + if key == provider.orgIDKey { + return nil + } + + return errors.Newf(errors.TypeForbidden, errors.CodeForbidden, "key %d for org %s is not owned by my current instance", key, provider.orgID) +} diff --git a/pkg/signoz/config.go b/pkg/signoz/config.go index 4fb3bbf142..2554fb3279 100644 --- a/pkg/signoz/config.go +++ b/pkg/signoz/config.go @@ -17,6 +17,7 @@ import ( "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/instrumentation" "github.com/SigNoz/signoz/pkg/prometheus" + "github.com/SigNoz/signoz/pkg/sharder" "github.com/SigNoz/signoz/pkg/sqlmigration" "github.com/SigNoz/signoz/pkg/sqlmigrator" "github.com/SigNoz/signoz/pkg/sqlstore" @@ -62,6 +63,9 @@ type Config struct { // Emailing config Emailing emailing.Config `mapstructure:"emailing" yaml:"emailing"` + + // Sharder config + Sharder sharder.Config `mapstructure:"sharder" yaml:"sharder"` } // DeprecatedFlags are the flags that are deprecated and scheduled for removal. @@ -86,6 +90,7 @@ func NewConfig(ctx context.Context, resolverConfig config.ResolverConfig, deprec prometheus.NewConfigFactory(), alertmanager.NewConfigFactory(), emailing.NewConfigFactory(), + sharder.NewConfigFactory(), } conf, err := config.New(ctx, resolverConfig, configFactories) diff --git a/pkg/signoz/handler.go b/pkg/signoz/handler.go index 2b1512b63a..6f5ccdce98 100644 --- a/pkg/signoz/handler.go +++ b/pkg/signoz/handler.go @@ -13,6 +13,8 @@ import ( "github.com/SigNoz/signoz/pkg/modules/quickfilter/implquickfilter" "github.com/SigNoz/signoz/pkg/modules/savedview" "github.com/SigNoz/signoz/pkg/modules/savedview/implsavedview" + "github.com/SigNoz/signoz/pkg/modules/tracefunnel" + "github.com/SigNoz/signoz/pkg/modules/tracefunnel/impltracefunnel" "github.com/SigNoz/signoz/pkg/modules/user" "github.com/SigNoz/signoz/pkg/modules/user/impluser" ) @@ -25,16 +27,18 @@ type Handlers struct { Apdex apdex.Handler Dashboard dashboard.Handler QuickFilter quickfilter.Handler + TraceFunnel tracefunnel.Handler } func NewHandlers(modules Modules) Handlers { return Handlers{ - Organization: implorganization.NewHandler(modules.Organization), + Organization: implorganization.NewHandler(modules.OrgGetter, modules.OrgSetter), Preference: implpreference.NewHandler(modules.Preference), User: impluser.NewHandler(modules.User), SavedView: implsavedview.NewHandler(modules.SavedView), Apdex: implapdex.NewHandler(modules.Apdex), Dashboard: impldashboard.NewHandler(modules.Dashboard), QuickFilter: implquickfilter.NewHandler(modules.QuickFilter), + TraceFunnel: impltracefunnel.NewHandler(modules.TraceFunnel), } } diff --git a/pkg/signoz/handler_test.go b/pkg/signoz/handler_test.go index b5ebd97d3e..0844ebf243 100644 --- a/pkg/signoz/handler_test.go +++ b/pkg/signoz/handler_test.go @@ -1,28 +1,40 @@ package signoz import ( + "context" "reflect" "testing" "time" "github.com/DATA-DOG/go-sqlmock" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/factory/factorytest" + "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/sqlstore/sqlstoretest" "github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // This is a test to ensure that all fields of the handlers are initialized. // It also helps us catch these errors at compile time instead of runtime. func TestNewHandlers(t *testing.T) { sqlstore := sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual) + providerSettings := factorytest.NewSettings() + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{}, sqlstore, orgGetter) + require.NoError(t, err) jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) emailing := emailingtest.New() - providerSettings := factorytest.NewSettings() + modules := NewModules(sqlstore, jwt, emailing, providerSettings, orgGetter, alertmanager) - modules := NewModules(sqlstore, jwt, emailing, providerSettings) handlers := NewHandlers(modules) reflectVal := reflect.ValueOf(handlers) diff --git a/pkg/signoz/module.go b/pkg/signoz/module.go index 0abdff2f85..bda2fcb702 100644 --- a/pkg/signoz/module.go +++ b/pkg/signoz/module.go @@ -1,6 +1,7 @@ package signoz import ( + "github.com/SigNoz/signoz/pkg/alertmanager" "github.com/SigNoz/signoz/pkg/emailing" "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/modules/apdex" @@ -15,6 +16,8 @@ import ( "github.com/SigNoz/signoz/pkg/modules/quickfilter/implquickfilter" "github.com/SigNoz/signoz/pkg/modules/savedview" "github.com/SigNoz/signoz/pkg/modules/savedview/implsavedview" + "github.com/SigNoz/signoz/pkg/modules/tracefunnel" + "github.com/SigNoz/signoz/pkg/modules/tracefunnel/impltracefunnel" "github.com/SigNoz/signoz/pkg/modules/user" "github.com/SigNoz/signoz/pkg/modules/user/impluser" "github.com/SigNoz/signoz/pkg/sqlstore" @@ -23,23 +26,37 @@ import ( ) type Modules struct { - Organization organization.Module - Preference preference.Module - User user.Module - SavedView savedview.Module - Apdex apdex.Module - Dashboard dashboard.Module - QuickFilter quickfilter.Module + OrgGetter organization.Getter + OrgSetter organization.Setter + Preference preference.Module + User user.Module + SavedView savedview.Module + Apdex apdex.Module + Dashboard dashboard.Module + QuickFilter quickfilter.Module + TraceFunnel tracefunnel.Module } -func NewModules(sqlstore sqlstore.SQLStore, jwt *authtypes.JWT, emailing emailing.Emailing, providerSettings factory.ProviderSettings) Modules { +func NewModules( + sqlstore sqlstore.SQLStore, + jwt *authtypes.JWT, + emailing emailing.Emailing, + providerSettings factory.ProviderSettings, + orgGetter organization.Getter, + alertmanager alertmanager.Alertmanager, +) Modules { + quickfilter := implquickfilter.NewModule(implquickfilter.NewStore(sqlstore)) + orgSetter := implorganization.NewSetter(implorganization.NewStore(sqlstore), alertmanager, quickfilter) + user := impluser.NewModule(impluser.NewStore(sqlstore, providerSettings), jwt, emailing, providerSettings, orgSetter) return Modules{ - Organization: implorganization.NewModule(implorganization.NewStore(sqlstore)), - Preference: implpreference.NewModule(implpreference.NewStore(sqlstore), preferencetypes.NewDefaultPreferenceMap()), - SavedView: implsavedview.NewModule(sqlstore), - Apdex: implapdex.NewModule(sqlstore), - Dashboard: impldashboard.NewModule(sqlstore), - User: impluser.NewModule(impluser.NewStore(sqlstore, providerSettings), jwt, emailing, providerSettings), - QuickFilter: implquickfilter.NewModule(implquickfilter.NewStore(sqlstore)), + OrgGetter: orgGetter, + OrgSetter: orgSetter, + Preference: implpreference.NewModule(implpreference.NewStore(sqlstore), preferencetypes.NewDefaultPreferenceMap()), + SavedView: implsavedview.NewModule(sqlstore), + Apdex: implapdex.NewModule(sqlstore), + Dashboard: impldashboard.NewModule(sqlstore, providerSettings), + User: user, + QuickFilter: quickfilter, + TraceFunnel: impltracefunnel.NewModule(impltracefunnel.NewStore(sqlstore)), } } diff --git a/pkg/signoz/module_test.go b/pkg/signoz/module_test.go index 67f6aa23b6..f18596b059 100644 --- a/pkg/signoz/module_test.go +++ b/pkg/signoz/module_test.go @@ -1,27 +1,39 @@ package signoz import ( + "context" "reflect" "testing" "time" "github.com/DATA-DOG/go-sqlmock" + "github.com/SigNoz/signoz/pkg/alertmanager" + "github.com/SigNoz/signoz/pkg/alertmanager/signozalertmanager" "github.com/SigNoz/signoz/pkg/emailing/emailingtest" "github.com/SigNoz/signoz/pkg/factory/factorytest" + "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/sqlstore/sqlstoretest" "github.com/SigNoz/signoz/pkg/types/authtypes" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // This is a test to ensure that all fields of the modules are initialized. // It also helps us catch these errors at compile time instead of runtime. func TestNewModules(t *testing.T) { sqlstore := sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual) + providerSettings := factorytest.NewSettings() + sharder, err := noopsharder.New(context.TODO(), providerSettings, sharder.Config{}) + require.NoError(t, err) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstore), sharder) + alertmanager, err := signozalertmanager.New(context.TODO(), providerSettings, alertmanager.Config{}, sqlstore, orgGetter) + require.NoError(t, err) jwt := authtypes.NewJWT("", 1*time.Hour, 1*time.Hour) emailing := emailingtest.New() - providerSettings := factorytest.NewSettings() - modules := NewModules(sqlstore, jwt, emailing, providerSettings) + modules := NewModules(sqlstore, jwt, emailing, providerSettings, orgGetter, alertmanager) reflectVal := reflect.ValueOf(modules) for i := 0; i < reflectVal.NumField(); i++ { diff --git a/pkg/signoz/provider.go b/pkg/signoz/provider.go index 831d2e2a62..4d55471cc4 100644 --- a/pkg/signoz/provider.go +++ b/pkg/signoz/provider.go @@ -11,8 +11,12 @@ import ( "github.com/SigNoz/signoz/pkg/emailing/noopemailing" "github.com/SigNoz/signoz/pkg/emailing/smtpemailing" "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/modules/organization" "github.com/SigNoz/signoz/pkg/prometheus" "github.com/SigNoz/signoz/pkg/prometheus/clickhouseprometheus" + "github.com/SigNoz/signoz/pkg/sharder" + "github.com/SigNoz/signoz/pkg/sharder/noopsharder" + "github.com/SigNoz/signoz/pkg/sharder/singlesharder" "github.com/SigNoz/signoz/pkg/sqlmigration" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/sqlstore/sqlitesqlstore" @@ -83,6 +87,9 @@ func NewSQLMigrationProviderFactories(sqlstore sqlstore.SQLStore) factory.NamedM sqlmigration.NewUpdateLicenseFactory(sqlstore), sqlmigration.NewMigratePATToFactorAPIKey(sqlstore), sqlmigration.NewUpdateApiMonitoringFiltersFactory(sqlstore), + sqlmigration.NewAddKeyOrganizationFactory(sqlstore), + sqlmigration.NewAddTraceFunnelsFactory(sqlstore), + sqlmigration.NewUpdateDashboardFactory(sqlstore), ) } @@ -98,10 +105,10 @@ func NewPrometheusProviderFactories(telemetryStore telemetrystore.TelemetryStore ) } -func NewAlertmanagerProviderFactories(sqlstore sqlstore.SQLStore) factory.NamedMap[factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config]] { +func NewAlertmanagerProviderFactories(sqlstore sqlstore.SQLStore, orgGetter organization.Getter) factory.NamedMap[factory.ProviderFactory[alertmanager.Alertmanager, alertmanager.Config]] { return factory.MustNewNamedMap( - legacyalertmanager.NewFactory(sqlstore), - signozalertmanager.NewFactory(sqlstore), + legacyalertmanager.NewFactory(sqlstore, orgGetter), + signozalertmanager.NewFactory(sqlstore, orgGetter), ) } @@ -111,3 +118,10 @@ func NewEmailingProviderFactories() factory.NamedMap[factory.ProviderFactory[ema smtpemailing.NewFactory(), ) } + +func NewSharderProviderFactories() factory.NamedMap[factory.ProviderFactory[sharder.Sharder, sharder.Config]] { + return factory.MustNewNamedMap( + singlesharder.NewFactory(), + noopsharder.NewFactory(), + ) +} diff --git a/pkg/signoz/provider_test.go b/pkg/signoz/provider_test.go index 7245d50f66..752ff19db8 100644 --- a/pkg/signoz/provider_test.go +++ b/pkg/signoz/provider_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" + "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/sqlstore" "github.com/SigNoz/signoz/pkg/sqlstore/sqlstoretest" "github.com/SigNoz/signoz/pkg/telemetrystore" @@ -40,10 +41,15 @@ func TestNewProviderFactories(t *testing.T) { }) assert.NotPanics(t, func() { - NewAlertmanagerProviderFactories(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual)) + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual)), nil) + NewAlertmanagerProviderFactories(sqlstoretest.New(sqlstore.Config{Provider: "sqlite"}, sqlmock.QueryMatcherEqual), orgGetter) }) assert.NotPanics(t, func() { NewEmailingProviderFactories() }) + + assert.NotPanics(t, func() { + NewSharderProviderFactories() + }) } diff --git a/pkg/signoz/signoz.go b/pkg/signoz/signoz.go index 748b4af9b4..919520b5b3 100644 --- a/pkg/signoz/signoz.go +++ b/pkg/signoz/signoz.go @@ -9,7 +9,10 @@ import ( "github.com/SigNoz/signoz/pkg/factory" "github.com/SigNoz/signoz/pkg/instrumentation" "github.com/SigNoz/signoz/pkg/licensing" + "github.com/SigNoz/signoz/pkg/modules/organization" + "github.com/SigNoz/signoz/pkg/modules/organization/implorganization" "github.com/SigNoz/signoz/pkg/prometheus" + "github.com/SigNoz/signoz/pkg/sharder" "github.com/SigNoz/signoz/pkg/sqlmigration" "github.com/SigNoz/signoz/pkg/sqlmigrator" "github.com/SigNoz/signoz/pkg/sqlstore" @@ -33,6 +36,7 @@ type SigNoz struct { Zeus zeus.Zeus Licensing licensing.Licensing Emailing emailing.Emailing + Sharder sharder.Sharder Modules Modules Handlers Handlers } @@ -44,7 +48,7 @@ func New( zeusConfig zeus.Config, zeusProviderFactory factory.ProviderFactory[zeus.Zeus, zeus.Config], licenseConfig licensing.Config, - licenseProviderFactoryCb func(sqlstore.SQLStore, zeus.Zeus) factory.ProviderFactory[licensing.Licensing, licensing.Config], + licenseProviderFactoryCb func(sqlstore.SQLStore, zeus.Zeus, organization.Getter) factory.ProviderFactory[licensing.Licensing, licensing.Config], emailingProviderFactories factory.NamedMap[factory.ProviderFactory[emailing.Emailing, emailing.Config]], cacheProviderFactories factory.NamedMap[factory.ProviderFactory[cache.Cache, cache.Config]], webProviderFactories factory.NamedMap[factory.ProviderFactory[web.Web, web.Config]], @@ -162,19 +166,34 @@ func New( return nil, err } + // Initialize sharder from the available sharder provider factories + sharder, err := factory.NewProviderFromNamedMap( + ctx, + providerSettings, + config.Sharder, + NewSharderProviderFactories(), + config.Sharder.Provider, + ) + if err != nil { + return nil, err + } + + // Initialize organization getter + orgGetter := implorganization.NewGetter(implorganization.NewStore(sqlstore), sharder) + // Initialize alertmanager from the available alertmanager provider factories alertmanager, err := factory.NewProviderFromNamedMap( ctx, providerSettings, config.Alertmanager, - NewAlertmanagerProviderFactories(sqlstore), + NewAlertmanagerProviderFactories(sqlstore, orgGetter), config.Alertmanager.Provider, ) if err != nil { return nil, err } - licensingProviderFactory := licenseProviderFactoryCb(sqlstore, zeus) + licensingProviderFactory := licenseProviderFactoryCb(sqlstore, zeus, orgGetter) licensing, err := licensingProviderFactory.New( ctx, providerSettings, @@ -185,7 +204,7 @@ func New( } // Initialize all modules - modules := NewModules(sqlstore, jwt, emailing, providerSettings) + modules := NewModules(sqlstore, jwt, emailing, providerSettings, orgGetter, alertmanager) // Initialize all handlers for the modules handlers := NewHandlers(modules) @@ -212,6 +231,7 @@ func New( Zeus: zeus, Licensing: licensing, Emailing: emailing, + Sharder: sharder, Modules: modules, Handlers: handlers, }, nil diff --git a/pkg/sqlmigration/036_add_key_organization.go b/pkg/sqlmigration/036_add_key_organization.go new file mode 100644 index 0000000000..753736a0ed --- /dev/null +++ b/pkg/sqlmigration/036_add_key_organization.go @@ -0,0 +1,112 @@ +package sqlmigration + +import ( + "context" + "hash/fnv" + + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/sqlstore" + "github.com/uptrace/bun" + "github.com/uptrace/bun/migrate" +) + +type addKeyOrganization struct { + sqlstore sqlstore.SQLStore +} + +func NewAddKeyOrganizationFactory(sqlstore sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] { + return factory.NewProviderFactory(factory.MustNewName("add_key_organization"), func(ctx context.Context, providerSettings factory.ProviderSettings, config Config) (SQLMigration, error) { + return newAddKeyOrganization(ctx, providerSettings, config, sqlstore) + }) +} + +func newAddKeyOrganization(_ context.Context, _ factory.ProviderSettings, _ Config, sqlstore sqlstore.SQLStore) (SQLMigration, error) { + return &addKeyOrganization{ + sqlstore: sqlstore, + }, nil +} + +func (migration *addKeyOrganization) Register(migrations *migrate.Migrations) error { + if err := migrations.Register(migration.Up, migration.Down); err != nil { + return err + } + + return nil +} + +func (migration *addKeyOrganization) Up(ctx context.Context, db *bun.DB) error { + ok, err := migration.sqlstore.Dialect().ColumnExists(ctx, db, "organizations", "key") + if err != nil { + return err + } + + if ok { + return nil + } + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + return err + } + + defer func() { + _ = tx.Rollback() + }() + + if _, err := tx. + NewAddColumn(). + Table("organizations"). + ColumnExpr("key BIGINT"). + Exec(ctx); err != nil { + return err + } + + var existingOrgIDs []string + if err := tx.NewSelect(). + Table("organizations"). + Column("id"). + Scan(ctx, &existingOrgIDs); err != nil { + return err + } + + for _, orgID := range existingOrgIDs { + key := migration.getHash(ctx, orgID) + if _, err := tx. + NewUpdate(). + Table("organizations"). + Set("key = ?", key). + Where("id = ?", orgID). + Exec(ctx); err != nil { + return err + } + } + + if _, err := tx. + NewCreateIndex(). + Unique(). + IfNotExists(). + Index("idx_unique_key"). + Table("organizations"). + Column("key"). + Exec(ctx); err != nil { + return err + } + + if err := tx.Commit(); err != nil { + return err + } + + return nil +} + +func (migration *addKeyOrganization) Down(ctx context.Context, db *bun.DB) error { + return nil +} + +func (migration *addKeyOrganization) getHash(_ context.Context, orgID string) uint32 { + hasher := fnv.New32a() + + // Hasher never returns err. + _, _ = hasher.Write([]byte(orgID)) + return hasher.Sum32() +} diff --git a/pkg/sqlmigration/037_add_trace_funnels.go b/pkg/sqlmigration/037_add_trace_funnels.go new file mode 100644 index 0000000000..99a885b1cf --- /dev/null +++ b/pkg/sqlmigration/037_add_trace_funnels.go @@ -0,0 +1,89 @@ +package sqlmigration + +import ( + "context" + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/sqlstore" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/uptrace/bun" + "github.com/uptrace/bun/migrate" +) + +// funnel Core Data Structure (funnel and funnelStep) +type funnel struct { + bun.BaseModel `bun:"table:trace_funnel"` + types.Identifiable // funnel id + types.TimeAuditable + types.UserAuditable + Name string `json:"funnel_name" bun:"name,type:text,notnull"` // funnel name + Description string `json:"description" bun:"description,type:text"` // funnel description + OrgID valuer.UUID `json:"org_id" bun:"org_id,type:varchar,notnull"` + Steps []funnelStep `json:"steps" bun:"steps,type:text,notnull"` + Tags string `json:"tags" bun:"tags,type:text"` + CreatedByUser *types.User `json:"user" bun:"rel:belongs-to,join:created_by=id"` +} + +type funnelStep struct { + types.Identifiable + Name string `json:"name,omitempty"` // step name + Description string `json:"description,omitempty"` // step description + Order int64 `json:"step_order"` + ServiceName string `json:"service_name"` + SpanName string `json:"span_name"` + Filters string `json:"filters,omitempty"` + LatencyPointer string `json:"latency_pointer,omitempty"` + LatencyType string `json:"latency_type,omitempty"` + HasErrors bool `json:"has_errors"` +} + +type addTraceFunnels struct { + sqlstore sqlstore.SQLStore +} + +func NewAddTraceFunnelsFactory(sqlstore sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] { + return factory.NewProviderFactory(factory.MustNewName("add_trace_funnels"), func(ctx context.Context, providerSettings factory.ProviderSettings, config Config) (SQLMigration, error) { + return newAddTraceFunnels(ctx, providerSettings, config, sqlstore) + }) +} + +func newAddTraceFunnels(_ context.Context, _ factory.ProviderSettings, _ Config, sqlstore sqlstore.SQLStore) (SQLMigration, error) { + return &addTraceFunnels{sqlstore: sqlstore}, nil +} + +func (migration *addTraceFunnels) Register(migrations *migrate.Migrations) error { + if err := migrations.Register(migration.Up, migration.Down); err != nil { + return err + } + return nil +} + +func (migration *addTraceFunnels) Up(ctx context.Context, db *bun.DB) error { + tx, err := db.BeginTx(ctx, nil) + if err != nil { + return err + } + defer func() { + _ = tx.Rollback() + }() + + _, err = tx.NewCreateTable(). + Model(new(funnel)). + ForeignKey(`("org_id") REFERENCES "organizations" ("id") ON DELETE CASCADE`). + IfNotExists(). + Exec(ctx) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (migration *addTraceFunnels) Down(ctx context.Context, db *bun.DB) error { + return nil +} diff --git a/pkg/sqlmigration/038_update_dashboard.go b/pkg/sqlmigration/038_update_dashboard.go new file mode 100644 index 0000000000..c950d6cbfc --- /dev/null +++ b/pkg/sqlmigration/038_update_dashboard.go @@ -0,0 +1,141 @@ +package sqlmigration + +import ( + "context" + "database/sql" + + "github.com/SigNoz/signoz/pkg/factory" + "github.com/SigNoz/signoz/pkg/sqlstore" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/uptrace/bun" + "github.com/uptrace/bun/migrate" +) + +type updateDashboard struct { + store sqlstore.SQLStore +} + +type existingDashboard36 struct { + bun.BaseModel `bun:"table:dashboards"` + + types.TimeAuditable + types.UserAuditable + OrgID string `json:"-" bun:"org_id,notnull"` + ID int `json:"id" bun:"id,pk,autoincrement"` + UUID string `json:"uuid" bun:"uuid,type:text,notnull,unique"` + Data map[string]interface{} `json:"data" bun:"data,type:text,notnull"` + Locked *int `json:"isLocked" bun:"locked,notnull,default:0"` +} + +type newDashboard36 struct { + bun.BaseModel `bun:"table:dashboard"` + + types.Identifiable + types.TimeAuditable + types.UserAuditable + Data map[string]interface{} `bun:"data,type:text,notnull"` + Locked bool `bun:"locked,notnull,default:false"` + OrgID valuer.UUID `bun:"org_id,type:text,notnull"` +} + +func NewUpdateDashboardFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] { + return factory.NewProviderFactory(factory.MustNewName("update_dashboards"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) { + return newUpdateDashboard(ctx, ps, c, store) + }) +} + +func newUpdateDashboard(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) { + return &updateDashboard{store: store}, nil +} + +func (migration *updateDashboard) Register(migrations *migrate.Migrations) error { + if err := migrations.Register(migration.Up, migration.Down); err != nil { + return err + } + + return nil +} + +func (migration *updateDashboard) Up(ctx context.Context, db *bun.DB) error { + tx, err := db.BeginTx(ctx, nil) + if err != nil { + return err + } + + defer func() { + _ = tx.Rollback() + }() + + err = migration.store.Dialect().RenameTableAndModifyModel(ctx, tx, new(existingDashboard36), new(newDashboard36), []string{OrgReference}, func(ctx context.Context) error { + existingDashboards := make([]*existingDashboard36, 0) + err = tx.NewSelect().Model(&existingDashboards).Scan(ctx) + if err != nil { + if err != sql.ErrNoRows { + return err + } + } + + if err == nil && len(existingDashboards) > 0 { + newDashboards, err := migration.CopyExistingDashboardsToNewDashboards(existingDashboards) + if err != nil { + return err + } + _, err = tx. + NewInsert(). + Model(&newDashboards). + Exec(ctx) + if err != nil { + return err + } + } + + return nil + }) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil + +} +func (migration *updateDashboard) Down(context.Context, *bun.DB) error { + return nil +} + +func (migration *updateDashboard) CopyExistingDashboardsToNewDashboards(existingDashboards []*existingDashboard36) ([]*newDashboard36, error) { + newDashboards := make([]*newDashboard36, len(existingDashboards)) + + for idx, existingDashboard := range existingDashboards { + dashboardID, err := valuer.NewUUID(existingDashboard.UUID) + if err != nil { + return nil, err + } + orgID, err := valuer.NewUUID(existingDashboard.OrgID) + if err != nil { + return nil, err + } + locked := false + if existingDashboard.Locked != nil && *existingDashboard.Locked == 1 { + locked = true + } + + newDashboards[idx] = &newDashboard36{ + Identifiable: types.Identifiable{ + ID: dashboardID, + }, + TimeAuditable: existingDashboard.TimeAuditable, + UserAuditable: existingDashboard.UserAuditable, + Data: existingDashboard.Data, + Locked: locked, + OrgID: orgID, + } + } + + return newDashboards, nil +} diff --git a/pkg/telemetrymetrics/condition_builder.go b/pkg/telemetrymetrics/condition_builder.go new file mode 100644 index 0000000000..28074c7c8c --- /dev/null +++ b/pkg/telemetrymetrics/condition_builder.go @@ -0,0 +1,145 @@ +package telemetrymetrics + +import ( + "context" + "fmt" + "slices" + + "github.com/SigNoz/signoz/pkg/errors" + qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" + "github.com/SigNoz/signoz/pkg/types/telemetrytypes" + + "github.com/huandu/go-sqlbuilder" +) + +type conditionBuilder struct { + fm qbtypes.FieldMapper +} + +func NewConditionBuilder(fm qbtypes.FieldMapper) *conditionBuilder { + return &conditionBuilder{fm: fm} +} + +func (c *conditionBuilder) conditionFor( + ctx context.Context, + key *telemetrytypes.TelemetryFieldKey, + operator qbtypes.FilterOperator, + value any, + sb *sqlbuilder.SelectBuilder, +) (string, error) { + + tblFieldName, err := c.fm.FieldFor(ctx, key) + if err != nil { + return "", err + } + + switch operator { + case qbtypes.FilterOperatorEqual: + return sb.E(tblFieldName, value), nil + case qbtypes.FilterOperatorNotEqual: + return sb.NE(tblFieldName, value), nil + case qbtypes.FilterOperatorGreaterThan: + return sb.G(tblFieldName, value), nil + case qbtypes.FilterOperatorGreaterThanOrEq: + return sb.GE(tblFieldName, value), nil + case qbtypes.FilterOperatorLessThan: + return sb.LT(tblFieldName, value), nil + case qbtypes.FilterOperatorLessThanOrEq: + return sb.LE(tblFieldName, value), nil + + // like and not like + case qbtypes.FilterOperatorLike: + return sb.Like(tblFieldName, value), nil + case qbtypes.FilterOperatorNotLike: + return sb.NotLike(tblFieldName, value), nil + case qbtypes.FilterOperatorILike: + return sb.ILike(tblFieldName, value), nil + case qbtypes.FilterOperatorNotILike: + return sb.NotILike(tblFieldName, value), nil + + case qbtypes.FilterOperatorContains: + return sb.ILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil + case qbtypes.FilterOperatorNotContains: + return sb.NotILike(tblFieldName, fmt.Sprintf("%%%s%%", value)), nil + + case qbtypes.FilterOperatorRegexp: + return fmt.Sprintf(`match(%s, %s)`, tblFieldName, sb.Var(value)), nil + case qbtypes.FilterOperatorNotRegexp: + return fmt.Sprintf(`NOT match(%s, %s)`, tblFieldName, sb.Var(value)), nil + + // between and not between + case qbtypes.FilterOperatorBetween: + values, ok := value.([]any) + if !ok { + return "", qbtypes.ErrBetweenValues + } + if len(values) != 2 { + return "", qbtypes.ErrBetweenValues + } + return sb.Between(tblFieldName, values[0], values[1]), nil + case qbtypes.FilterOperatorNotBetween: + values, ok := value.([]any) + if !ok { + return "", qbtypes.ErrBetweenValues + } + if len(values) != 2 { + return "", qbtypes.ErrBetweenValues + } + return sb.NotBetween(tblFieldName, values[0], values[1]), nil + + // in and not in + case qbtypes.FilterOperatorIn: + values, ok := value.([]any) + if !ok { + return "", qbtypes.ErrInValues + } + // instead of using IN, we use `=` + `OR` to make use of index + conditions := []string{} + for _, value := range values { + conditions = append(conditions, sb.E(tblFieldName, value)) + } + return sb.Or(conditions...), nil + case qbtypes.FilterOperatorNotIn: + values, ok := value.([]any) + if !ok { + return "", qbtypes.ErrInValues + } + // instead of using NOT IN, we use `!=` + `AND` to make use of index + conditions := []string{} + for _, value := range values { + conditions = append(conditions, sb.NE(tblFieldName, value)) + } + return sb.And(conditions...), nil + + // exists and not exists + // in the UI based query builder, `exists` and `not exists` are used for + // key membership checks, so depending on the column type, the condition changes + case qbtypes.FilterOperatorExists, qbtypes.FilterOperatorNotExists: + + // if the field is intrinsic, it always exists + if slices.Contains(IntrinsicFields, key.Name) { + return "true", nil + } + + if operator == qbtypes.FilterOperatorExists { + return fmt.Sprintf("has(JSONExtractKeys(labels), '%s')", key.Name), nil + } + return fmt.Sprintf("not has(JSONExtractKeys(labels), '%s')", key.Name), nil + } + return "", errors.NewInvalidInputf(errors.CodeInvalidInput, "unsupported operator: %v", operator) +} + +func (c *conditionBuilder) ConditionFor( + ctx context.Context, + key *telemetrytypes.TelemetryFieldKey, + operator qbtypes.FilterOperator, + value any, + sb *sqlbuilder.SelectBuilder, +) (string, error) { + condition, err := c.conditionFor(ctx, key, operator, value, sb) + if err != nil { + return "", err + } + + return condition, nil +} diff --git a/pkg/telemetrymetrics/condition_builder_test.go b/pkg/telemetrymetrics/condition_builder_test.go new file mode 100644 index 0000000000..9d6ae2e53e --- /dev/null +++ b/pkg/telemetrymetrics/condition_builder_test.go @@ -0,0 +1,295 @@ +package telemetrymetrics + +import ( + "context" + "testing" + + qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" + "github.com/SigNoz/signoz/pkg/types/telemetrytypes" + "github.com/huandu/go-sqlbuilder" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConditionFor(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + key telemetrytypes.TelemetryFieldKey + operator qbtypes.FilterOperator + value any + expectedSQL string + expectedArgs []any + expectedError error + }{ + { + name: "Equal operator - string", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorEqual, + value: "http.server.duration", + expectedSQL: "metric_name = ?", + expectedArgs: []any{"http.server.duration"}, + expectedError: nil, + }, + { + name: "Not Equal operator - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorNotEqual, + value: "http.server.duration", + expectedSQL: "metric_name <> ?", + expectedArgs: []any{"http.server.duration"}, + expectedError: nil, + }, + { + name: "Like operator - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorLike, + value: "%error%", + expectedSQL: "metric_name LIKE ?", + expectedArgs: []any{"%error%"}, + expectedError: nil, + }, + { + name: "Not Like operator - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorNotLike, + value: "%error%", + expectedSQL: "metric_name NOT LIKE ?", + expectedArgs: []any{"%error%"}, + expectedError: nil, + }, + { + name: "ILike operator - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextResource, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + operator: qbtypes.FilterOperatorILike, + value: "%admin%", + expectedSQL: "LOWER(JSONExtractString(labels, 'user.id')) LIKE LOWER(?)", + expectedArgs: []any{"%admin%"}, + expectedError: nil, + }, + { + name: "Not ILike operator - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextResource, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + operator: qbtypes.FilterOperatorNotILike, + value: "%admin%", + expectedSQL: "LOWER(JSONExtractString(labels, 'user.id')) NOT LIKE LOWER(?)", + expectedArgs: []any{"%admin%"}, + expectedError: nil, + }, + { + name: "Contains operator - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextResource, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + operator: qbtypes.FilterOperatorContains, + value: "admin", + expectedSQL: "LOWER(JSONExtractString(labels, 'user.id')) LIKE LOWER(?)", + expectedArgs: []any{"%admin%"}, + expectedError: nil, + }, + { + name: "In operator - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorIn, + value: []any{"http.server.duration", "http.server.request.duration", "http.server.response.duration"}, + expectedSQL: "(metric_name = ? OR metric_name = ? OR metric_name = ?)", + expectedArgs: []any{"http.server.duration", "http.server.request.duration", "http.server.response.duration"}, + expectedError: nil, + }, + { + name: "In operator - invalid value", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorIn, + value: "error", + expectedSQL: "", + expectedError: qbtypes.ErrInValues, + }, + { + name: "Not In operator - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorNotIn, + value: []any{"debug", "info", "trace"}, + expectedSQL: "(metric_name <> ? AND metric_name <> ? AND metric_name <> ?)", + expectedArgs: []any{"debug", "info", "trace"}, + expectedError: nil, + }, + { + name: "Exists operator - string field", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorExists, + value: nil, + expectedSQL: "true", + expectedError: nil, + }, + { + name: "Not Exists operator - string field", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorNotExists, + value: nil, + expectedSQL: "true", + expectedError: nil, + }, + { + name: "Exists operator - type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "type", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorExists, + value: nil, + expectedSQL: "true", + expectedError: nil, + }, + { + name: "Exists operator - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextResource, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + operator: qbtypes.FilterOperatorExists, + value: nil, + expectedSQL: "has(JSONExtractKeys(labels), 'user.id')", + expectedError: nil, + }, + { + name: "Not Exists operator - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextResource, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + operator: qbtypes.FilterOperatorNotExists, + value: nil, + expectedSQL: "not has(JSONExtractKeys(labels), 'user.id')", + expectedError: nil, + }, + { + name: "Non-existent column", + key: telemetrytypes.TelemetryFieldKey{ + Name: "nonexistent_field", + FieldContext: telemetrytypes.FieldContextMetric, + }, + operator: qbtypes.FilterOperatorEqual, + value: "value", + expectedSQL: "", + expectedError: qbtypes.ErrColumnNotFound, + }, + } + + fm := NewFieldMapper() + conditionBuilder := NewConditionBuilder(fm) + + for _, tc := range testCases { + sb := sqlbuilder.NewSelectBuilder() + t.Run(tc.name, func(t *testing.T) { + cond, err := conditionBuilder.ConditionFor(ctx, &tc.key, tc.operator, tc.value, sb) + sb.Where(cond) + + if tc.expectedError != nil { + assert.Equal(t, tc.expectedError, err) + } else { + require.NoError(t, err) + sql, args := sb.BuildWithFlavor(sqlbuilder.ClickHouse) + assert.Contains(t, sql, tc.expectedSQL) + assert.Equal(t, tc.expectedArgs, args) + } + }) + } +} + +func TestConditionForMultipleKeys(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + keys []telemetrytypes.TelemetryFieldKey + operator qbtypes.FilterOperator + value any + expectedSQL string + expectedArgs []any + expectedError error + }{ + { + name: "Equal operator - string", + keys: []telemetrytypes.TelemetryFieldKey{ + { + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + { + Name: "type", + FieldContext: telemetrytypes.FieldContextMetric, + }, + }, + operator: qbtypes.FilterOperatorEqual, + value: "error message", + expectedSQL: "metric_name = ? AND type = ?", + expectedArgs: []any{"error message", "error message"}, + expectedError: nil, + }, + } + + fm := NewFieldMapper() + conditionBuilder := NewConditionBuilder(fm) + + for _, tc := range testCases { + sb := sqlbuilder.NewSelectBuilder() + t.Run(tc.name, func(t *testing.T) { + var err error + for _, key := range tc.keys { + cond, err := conditionBuilder.ConditionFor(ctx, &key, tc.operator, tc.value, sb) + sb.Where(cond) + if err != nil { + t.Fatalf("Error getting condition for key %s: %v", key.Name, err) + } + } + + if tc.expectedError != nil { + assert.Equal(t, tc.expectedError, err) + } else { + require.NoError(t, err) + sql, _ := sb.BuildWithFlavor(sqlbuilder.ClickHouse) + assert.Contains(t, sql, tc.expectedSQL) + } + }) + } +} diff --git a/pkg/telemetrymetrics/const.go b/pkg/telemetrymetrics/const.go new file mode 100644 index 0000000000..4522534829 --- /dev/null +++ b/pkg/telemetrymetrics/const.go @@ -0,0 +1,8 @@ +package telemetrymetrics + +var IntrinsicFields = []string{ + "temporality", + "metric_name", + "type", + "is_monotonic", +} diff --git a/pkg/telemetrymetrics/field_mapper.go b/pkg/telemetrymetrics/field_mapper.go new file mode 100644 index 0000000000..624dab3089 --- /dev/null +++ b/pkg/telemetrymetrics/field_mapper.go @@ -0,0 +1,90 @@ +package telemetrymetrics + +import ( + "context" + "fmt" + + schema "github.com/SigNoz/signoz-otel-collector/cmd/signozschemamigrator/schema_migrator" + qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" + "github.com/SigNoz/signoz/pkg/types/telemetrytypes" +) + +var ( + timeSeriesV4Columns = map[string]*schema.Column{ + "temporality": {Name: "temporality", Type: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}}, + "metric_name": {Name: "metric_name", Type: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}}, + "type": {Name: "type", Type: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}}, + "is_monotonic": {Name: "is_monotonic", Type: schema.ColumnTypeBool}, + "fingerprint": {Name: "fingerprint", Type: schema.ColumnTypeUInt64}, + "unix_milli": {Name: "unix_milli", Type: schema.ColumnTypeInt64}, + "labels": {Name: "labels", Type: schema.ColumnTypeString}, + "attrs": {Name: "attrs", Type: schema.MapColumnType{ + KeyType: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}, + ValueType: schema.ColumnTypeString, + }}, + "scope_attrs": {Name: "scope_attrs", Type: schema.MapColumnType{ + KeyType: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}, + ValueType: schema.ColumnTypeString, + }}, + "resource_attrs": {Name: "resource_attrs", Type: schema.MapColumnType{ + KeyType: schema.LowCardinalityColumnType{ElementType: schema.ColumnTypeString}, + ValueType: schema.ColumnTypeString, + }}, + } +) + +type fieldMapper struct{} + +func NewFieldMapper() qbtypes.FieldMapper { + return &fieldMapper{} +} + +func (m *fieldMapper) getColumn(_ context.Context, key *telemetrytypes.TelemetryFieldKey) (*schema.Column, error) { + + switch key.FieldContext { + case telemetrytypes.FieldContextResource, telemetrytypes.FieldContextScope, telemetrytypes.FieldContextAttribute: + return timeSeriesV4Columns["labels"], nil + case telemetrytypes.FieldContextMetric, telemetrytypes.FieldContextUnspecified: + col, ok := timeSeriesV4Columns[key.Name] + if !ok { + return nil, qbtypes.ErrColumnNotFound + } + return col, nil + } + + return nil, qbtypes.ErrColumnNotFound +} + +func (m *fieldMapper) FieldFor(ctx context.Context, key *telemetrytypes.TelemetryFieldKey) (string, error) { + column, err := m.getColumn(ctx, key) + if err != nil { + return "", err + } + + switch key.FieldContext { + case telemetrytypes.FieldContextResource, telemetrytypes.FieldContextScope, telemetrytypes.FieldContextAttribute: + return fmt.Sprintf("JSONExtractString(%s, '%s')", column.Name, key.Name), nil + case telemetrytypes.FieldContextMetric: + return column.Name, nil + } + + return column.Name, nil +} + +func (m *fieldMapper) ColumnFor(ctx context.Context, key *telemetrytypes.TelemetryFieldKey) (*schema.Column, error) { + return m.getColumn(ctx, key) +} + +func (m *fieldMapper) ColumnExpressionFor( + ctx context.Context, + field *telemetrytypes.TelemetryFieldKey, + keys map[string][]*telemetrytypes.TelemetryFieldKey, +) (string, error) { + + colName, err := m.FieldFor(ctx, field) + if err != nil { + return "", err + } + + return fmt.Sprintf("%s AS `%s`", colName, field.Name), nil +} diff --git a/pkg/telemetrymetrics/field_mapper_test.go b/pkg/telemetrymetrics/field_mapper_test.go new file mode 100644 index 0000000000..9a82420879 --- /dev/null +++ b/pkg/telemetrymetrics/field_mapper_test.go @@ -0,0 +1,220 @@ +package telemetrymetrics + +import ( + "context" + "testing" + + schema "github.com/SigNoz/signoz-otel-collector/cmd/signozschemamigrator/schema_migrator" + qbtypes "github.com/SigNoz/signoz/pkg/types/querybuildertypes/querybuildertypesv5" + "github.com/SigNoz/signoz/pkg/types/telemetrytypes" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetColumn(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + key telemetrytypes.TelemetryFieldKey + expectedCol *schema.Column + expectedError error + }{ + { + name: "Resource field", + key: telemetrytypes.TelemetryFieldKey{ + Name: "service.name", + FieldContext: telemetrytypes.FieldContextResource, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Attribute field - string type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Attribute field - number type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "request.size", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeNumber, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Attribute field - int64 type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "request.duration", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeInt64, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Attribute field - float64 type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "cpu.utilization", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeFloat64, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Attribute field - bool type", + key: telemetrytypes.TelemetryFieldKey{ + Name: "request.success", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeBool, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + { + name: "Metric field - temporality", + key: telemetrytypes.TelemetryFieldKey{ + Name: "temporality", + FieldContext: telemetrytypes.FieldContextMetric, + }, + expectedCol: timeSeriesV4Columns["temporality"], + expectedError: nil, + }, + { + name: "Metric field - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + expectedCol: timeSeriesV4Columns["metric_name"], + expectedError: nil, + }, + { + name: "Metric field - nonexistent", + key: telemetrytypes.TelemetryFieldKey{ + Name: "nonexistent_field", + FieldContext: telemetrytypes.FieldContextMetric, + }, + expectedCol: nil, + expectedError: qbtypes.ErrColumnNotFound, + }, + { + name: "did_user_login", + key: telemetrytypes.TelemetryFieldKey{ + Name: "did_user_login", + Signal: telemetrytypes.SignalMetrics, + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeBool, + }, + expectedCol: timeSeriesV4Columns["labels"], + expectedError: nil, + }, + } + + fm := NewFieldMapper() + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + col, err := fm.ColumnFor(ctx, &tc.key) + + if tc.expectedError != nil { + assert.Equal(t, tc.expectedError, err) + } else { + require.NoError(t, err) + assert.Equal(t, tc.expectedCol, col) + } + }) + } +} + +func TestGetFieldKeyName(t *testing.T) { + ctx := context.Background() + + testCases := []struct { + name string + key telemetrytypes.TelemetryFieldKey + expectedResult string + expectedError error + }{ + { + name: "Simple column type - metric_name", + key: telemetrytypes.TelemetryFieldKey{ + Name: "metric_name", + FieldContext: telemetrytypes.FieldContextMetric, + }, + expectedResult: "metric_name", + expectedError: nil, + }, + { + name: "Map column type - string label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "user.id", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeString, + }, + expectedResult: "JSONExtractString(labels, 'user.id')", + expectedError: nil, + }, + { + name: "Map column type - number label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "request.size", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeNumber, + }, + expectedResult: "JSONExtractString(labels, 'request.size')", + expectedError: nil, + }, + { + name: "Map column type - bool label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "request.success", + FieldContext: telemetrytypes.FieldContextAttribute, + FieldDataType: telemetrytypes.FieldDataTypeBool, + }, + expectedResult: "JSONExtractString(labels, 'request.success')", + expectedError: nil, + }, + { + name: "Map column type - resource label", + key: telemetrytypes.TelemetryFieldKey{ + Name: "service.name", + FieldContext: telemetrytypes.FieldContextResource, + }, + expectedResult: "JSONExtractString(labels, 'service.name')", + expectedError: nil, + }, + { + name: "Non-existent column", + key: telemetrytypes.TelemetryFieldKey{ + Name: "nonexistent_field", + FieldContext: telemetrytypes.FieldContextMetric, + }, + expectedResult: "", + expectedError: qbtypes.ErrColumnNotFound, + }, + } + + fm := NewFieldMapper() + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := fm.FieldFor(ctx, &tc.key) + + if tc.expectedError != nil { + assert.Equal(t, tc.expectedError, err) + } else { + require.NoError(t, err) + assert.Equal(t, tc.expectedResult, result) + } + }) + } +} diff --git a/pkg/types/alertmanagertypes/config.go b/pkg/types/alertmanagertypes/config.go index 21657fa1da..2cc7adf1bd 100644 --- a/pkg/types/alertmanagertypes/config.go +++ b/pkg/types/alertmanagertypes/config.go @@ -369,9 +369,6 @@ type ConfigStore interface { // Get returns the config for the given orgID Get(context.Context, string) (*Config, error) - // ListOrgs returns the list of orgs - ListOrgs(context.Context) ([]string, error) - // CreateChannel creates a new channel. CreateChannel(context.Context, *Channel, ...StoreOption) error diff --git a/pkg/types/apdextypes/settings.go b/pkg/types/apdextypes/settings.go new file mode 100644 index 0000000000..d08a1a7ee0 --- /dev/null +++ b/pkg/types/apdextypes/settings.go @@ -0,0 +1,15 @@ +package apdextypes + +import ( + "github.com/SigNoz/signoz/pkg/types" + "github.com/uptrace/bun" +) + +type Settings struct { + bun.BaseModel `bun:"table:apdex_setting"` + types.Identifiable + OrgID string `bun:"org_id,type:text" json:"orgId"` + ServiceName string `bun:"service_name,type:text" json:"serviceName"` + Threshold float64 `bun:"threshold,type:float,notnull" json:"threshold"` + ExcludeStatusCodes string `bun:"exclude_status_codes,type:text,notnull" json:"excludeStatusCodes"` +} diff --git a/pkg/types/dashboard.go b/pkg/types/dashboard.go deleted file mode 100644 index a18d2df60e..0000000000 --- a/pkg/types/dashboard.go +++ /dev/null @@ -1,80 +0,0 @@ -package types - -import ( - "database/sql/driver" - "encoding/base64" - "encoding/json" - "strings" - - "github.com/gosimple/slug" - "github.com/uptrace/bun" -) - -type Dashboard struct { - bun.BaseModel `bun:"table:dashboards"` - - TimeAuditable - UserAuditable - OrgID string `json:"-" bun:"org_id,notnull"` - ID int `json:"id" bun:"id,pk,autoincrement"` - UUID string `json:"uuid" bun:"uuid,type:text,notnull,unique"` - Data DashboardData `json:"data" bun:"data,type:text,notnull"` - Locked *int `json:"isLocked" bun:"locked,notnull,default:0"` - - Slug string `json:"-" bun:"-"` - Title string `json:"-" bun:"-"` -} - -// UpdateSlug updates the slug -func (d *Dashboard) UpdateSlug() { - var title string - - if val, ok := d.Data["title"]; ok { - title = val.(string) - } - - d.Slug = SlugifyTitle(title) -} - -func SlugifyTitle(title string) string { - s := slug.Make(strings.ToLower(title)) - if s == "" { - // If the dashboard name is only characters outside of the - // sluggable characters, the slug creation will return an - // empty string which will mess up URLs. This failsafe picks - // that up and creates the slug as a base64 identifier instead. - s = base64.RawURLEncoding.EncodeToString([]byte(title)) - if slug.MaxLength != 0 && len(s) > slug.MaxLength { - s = s[:slug.MaxLength] - } - } - return s -} - -type DashboardData map[string]interface{} - -func (c DashboardData) Value() (driver.Value, error) { - return json.Marshal(c) -} - -func (c *DashboardData) Scan(src interface{}) error { - var data []byte - if b, ok := src.([]byte); ok { - data = b - } else if s, ok := src.(string); ok { - data = []byte(s) - } - return json.Unmarshal(data, c) -} - -type TTLSetting struct { - bun.BaseModel `bun:"table:ttl_setting"` - Identifiable - TimeAuditable - TransactionID string `bun:"transaction_id,type:text,notnull"` - TableName string `bun:"table_name,type:text,notnull"` - TTL int `bun:"ttl,notnull,default:0"` - ColdStorageTTL int `bun:"cold_storage_ttl,notnull,default:0"` - Status string `bun:"status,type:text,notnull"` - OrgID string `json:"-" bun:"org_id,notnull"` -} diff --git a/pkg/types/dashboardtypes/dashboard.go b/pkg/types/dashboardtypes/dashboard.go new file mode 100644 index 0000000000..6f967503b6 --- /dev/null +++ b/pkg/types/dashboardtypes/dashboard.go @@ -0,0 +1,262 @@ +package dashboardtypes + +import ( + "context" + "encoding/json" + "time" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/uptrace/bun" +) + +type StorableDashboard struct { + bun.BaseModel `bun:"table:dashboard"` + + types.Identifiable + types.TimeAuditable + types.UserAuditable + Data StorableDashboardData `bun:"data,type:text,notnull"` + Locked bool `bun:"locked,notnull,default:false"` + OrgID valuer.UUID `bun:"org_id,notnull"` +} + +type Dashboard struct { + types.TimeAuditable + types.UserAuditable + + ID string `json:"id"` + Data StorableDashboardData `json:"data"` + Locked bool `json:"locked"` + OrgID valuer.UUID `json:"org_id"` +} + +type LockUnlockDashboard struct { + Locked *bool `json:"locked"` +} + +type ( + StorableDashboardData map[string]interface{} + + GettableDashboard = Dashboard + + UpdatableDashboard = StorableDashboardData + + PostableDashboard = StorableDashboardData + + ListableDashboard []*GettableDashboard +) + +func NewStorableDashboardFromDashboard(dashboard *Dashboard) (*StorableDashboard, error) { + dashboardID, err := valuer.NewUUID(dashboard.ID) + if err != nil { + return nil, errors.Wrapf(err, errors.TypeInvalidInput, errors.CodeInvalidInput, "id is not a valid uuid") + } + + return &StorableDashboard{ + Identifiable: types.Identifiable{ + ID: dashboardID, + }, + TimeAuditable: types.TimeAuditable{ + CreatedAt: dashboard.CreatedAt, + UpdatedAt: dashboard.UpdatedAt, + }, + UserAuditable: types.UserAuditable{ + CreatedBy: dashboard.CreatedBy, + UpdatedBy: dashboard.UpdatedBy, + }, + OrgID: dashboard.OrgID, + Data: dashboard.Data, + Locked: dashboard.Locked, + }, nil +} + +func NewDashboard(orgID valuer.UUID, createdBy string, storableDashboardData StorableDashboardData) (*Dashboard, error) { + currentTime := time.Now() + + return &Dashboard{ + ID: valuer.GenerateUUID().StringValue(), + TimeAuditable: types.TimeAuditable{ + CreatedAt: currentTime, + UpdatedAt: currentTime, + }, + UserAuditable: types.UserAuditable{ + CreatedBy: createdBy, + UpdatedBy: createdBy, + }, + OrgID: orgID, + Data: storableDashboardData, + Locked: false, + }, nil +} + +func NewDashboardFromStorableDashboard(storableDashboard *StorableDashboard) (*Dashboard, error) { + return &Dashboard{ + ID: storableDashboard.ID.StringValue(), + TimeAuditable: types.TimeAuditable{ + CreatedAt: storableDashboard.CreatedAt, + UpdatedAt: storableDashboard.UpdatedAt, + }, + UserAuditable: types.UserAuditable{ + CreatedBy: storableDashboard.CreatedBy, + UpdatedBy: storableDashboard.UpdatedBy, + }, + OrgID: storableDashboard.OrgID, + Data: storableDashboard.Data, + Locked: storableDashboard.Locked, + }, nil +} + +func NewDashboardsFromStorableDashboards(storableDashboards []*StorableDashboard) ([]*Dashboard, error) { + dashboards := make([]*Dashboard, len(storableDashboards)) + for idx, storableDashboard := range storableDashboards { + dashboard, err := NewDashboardFromStorableDashboard(storableDashboard) + if err != nil { + return nil, err + } + dashboards[idx] = dashboard + } + + return dashboards, nil +} + +func NewGettableDashboardsFromDashboards(dashboards []*Dashboard) ([]*GettableDashboard, error) { + gettableDashboards := make([]*GettableDashboard, len(dashboards)) + for idx, dashboard := range dashboards { + gettableDashboard, err := NewGettableDashboardFromDashboard(dashboard) + if err != nil { + return nil, err + } + gettableDashboards[idx] = gettableDashboard + } + return gettableDashboards, nil +} + +func NewGettableDashboardFromDashboard(dashboard *Dashboard) (*GettableDashboard, error) { + return &GettableDashboard{ + ID: dashboard.ID, + TimeAuditable: dashboard.TimeAuditable, + UserAuditable: dashboard.UserAuditable, + OrgID: dashboard.OrgID, + Data: dashboard.Data, + Locked: dashboard.Locked, + }, nil +} + +func (storableDashboardData *StorableDashboardData) GetWidgetIds() []string { + data := *storableDashboardData + widgetIds := []string{} + if data != nil && data["widgets"] != nil { + widgets, ok := data["widgets"] + if ok { + data, ok := widgets.([]interface{}) + if ok { + for _, widget := range data { + sData, ok := widget.(map[string]interface{}) + if ok && sData["query"] != nil && sData["id"] != nil { + id, ok := sData["id"].(string) + + if ok { + widgetIds = append(widgetIds, id) + } + + } + } + } + } + } + return widgetIds +} + +func (dashboard *Dashboard) CanUpdate(data StorableDashboardData) error { + if dashboard.Locked { + return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "cannot update a locked dashboard, please unlock the dashboard to update") + } + + existingIDs := dashboard.Data.GetWidgetIds() + newIDs := data.GetWidgetIds() + newIdsMap := make(map[string]bool) + for _, id := range newIDs { + newIdsMap[id] = true + } + + differenceMap := make(map[string]bool) + difference := []string{} + for _, id := range existingIDs { + if _, found := newIdsMap[id]; !found && !differenceMap[id] { + difference = append(difference, id) + differenceMap[id] = true + } + } + if len(difference) > 1 { + return errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "deleting more than one panel is not supported") + } + + return nil +} + +func (dashboard *Dashboard) Update(updatableDashboard UpdatableDashboard, updatedBy string) error { + err := dashboard.CanUpdate(updatableDashboard) + if err != nil { + return err + } + dashboard.UpdatedBy = updatedBy + dashboard.UpdatedAt = time.Now() + dashboard.Data = updatableDashboard + return nil +} + +func (dashboard *Dashboard) CanLockUnlock(ctx context.Context, updatedBy string) error { + claims, err := authtypes.ClaimsFromContext(ctx) + if err != nil { + return err + } + + if dashboard.CreatedBy != updatedBy || claims.Role != types.RoleAdmin { + return errors.Newf(errors.TypeForbidden, errors.CodeForbidden, "you are not authorized to lock/unlock this dashboard") + } + return nil +} + +func (dashboard *Dashboard) LockUnlock(ctx context.Context, lock bool, updatedBy string) error { + err := dashboard.CanLockUnlock(ctx, updatedBy) + if err != nil { + return err + } + dashboard.Locked = lock + dashboard.UpdatedBy = updatedBy + dashboard.UpdatedAt = time.Now() + return nil +} + +func (lockUnlockDashboard *LockUnlockDashboard) UnmarshalJSON(src []byte) error { + var lockUnlock struct { + Locked *bool `json:"lock"` + } + + err := json.Unmarshal(src, &lockUnlock) + if err != nil { + return err + } + + if lockUnlock.Locked == nil { + return errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, "lock is missing in the request payload") + } + + lockUnlockDashboard.Locked = lockUnlock.Locked + return nil +} + +type Store interface { + Create(context.Context, *StorableDashboard) error + + Get(context.Context, valuer.UUID, valuer.UUID) (*StorableDashboard, error) + + List(context.Context, valuer.UUID) ([]*StorableDashboard, error) + + Update(context.Context, valuer.UUID, *StorableDashboard) error + + Delete(context.Context, valuer.UUID, valuer.UUID) error +} diff --git a/pkg/types/featuretypes/feature.go b/pkg/types/featuretypes/feature.go index 964cd4a15c..68d2e7f538 100644 --- a/pkg/types/featuretypes/feature.go +++ b/pkg/types/featuretypes/feature.go @@ -26,3 +26,4 @@ func NewStorableFeature() {} const UseSpanMetrics = "USE_SPAN_METRICS" const AnomalyDetection = "ANOMALY_DETECTION" const TraceFunnels = "TRACE_FUNNELS" +const DotMetricsEnabled = "DOT_METRICS_ENABLED" diff --git a/pkg/types/licensetypes/license.go b/pkg/types/licensetypes/license.go index 994b2c7b63..d78c45585a 100644 --- a/pkg/types/licensetypes/license.go +++ b/pkg/types/licensetypes/license.go @@ -87,9 +87,6 @@ func GetActiveLicenseFromStorableLicenses(storableLicenses []*StorableLicense, o return nil, err } - if license.Status != "VALID" { - continue - } if activeLicense == nil && (license.ValidFrom != 0) && (license.ValidUntil == -1 || license.ValidUntil > time.Now().Unix()) { @@ -383,7 +380,4 @@ type Store interface { GetFeature(context.Context, string) (*featuretypes.StorableFeature, error) GetAllFeatures(context.Context) ([]*featuretypes.StorableFeature, error) UpdateFeature(context.Context, *featuretypes.StorableFeature) error - - // ListOrganizations returns the list of orgs - ListOrganizations(context.Context) ([]valuer.UUID, error) } diff --git a/pkg/types/organization.go b/pkg/types/organization.go index d18e149890..49fa8db910 100644 --- a/pkg/types/organization.go +++ b/pkg/types/organization.go @@ -2,6 +2,7 @@ package types import ( "context" + "hash/fnv" "time" "github.com/SigNoz/signoz/pkg/errors" @@ -20,13 +21,15 @@ type Organization struct { Identifiable Name string `bun:"name,type:text,nullzero" json:"name"` Alias string `bun:"alias,type:text,nullzero" json:"alias"` + Key uint32 `bun:"key,type:bigint,notnull" json:"key"` DisplayName string `bun:"display_name,type:text,notnull" json:"displayName"` } func NewOrganization(displayName string) *Organization { + id := valuer.GenerateUUID() return &Organization{ Identifiable: Identifiable{ - ID: valuer.GenerateUUID(), + ID: id, }, TimeAuditable: TimeAuditable{ CreatedAt: time.Now(), @@ -34,22 +37,35 @@ func NewOrganization(displayName string) *Organization { }, // Name: "default/main", TODO: take the call and uncomment this later DisplayName: displayName, + Key: NewOrganizationKey(id), } } -type ApdexSettings struct { - bun.BaseModel `bun:"table:apdex_setting"` +func NewOrganizationKey(orgID valuer.UUID) uint32 { + hasher := fnv.New32a() + + // Hasher never returns err. + _, _ = hasher.Write([]byte(orgID.String())) + return hasher.Sum32() +} + +type TTLSetting struct { + bun.BaseModel `bun:"table:ttl_setting"` Identifiable - OrgID string `bun:"org_id,type:text" json:"orgId"` - ServiceName string `bun:"service_name,type:text" json:"serviceName"` - Threshold float64 `bun:"threshold,type:float,notnull" json:"threshold"` - ExcludeStatusCodes string `bun:"exclude_status_codes,type:text,notnull" json:"excludeStatusCodes"` + TimeAuditable + TransactionID string `bun:"transaction_id,type:text,notnull"` + TableName string `bun:"table_name,type:text,notnull"` + TTL int `bun:"ttl,notnull,default:0"` + ColdStorageTTL int `bun:"cold_storage_ttl,notnull,default:0"` + Status string `bun:"status,type:text,notnull"` + OrgID string `json:"-" bun:"org_id,notnull"` } type OrganizationStore interface { Create(context.Context, *Organization) error Get(context.Context, valuer.UUID) (*Organization, error) GetAll(context.Context) ([]*Organization, error) + ListByKeyRange(context.Context, uint32, uint32) ([]*Organization, error) Update(context.Context, *Organization) error Delete(context.Context, valuer.UUID) error } diff --git a/pkg/types/ruletypes/rule.go b/pkg/types/ruletypes/rule.go index 55fcc801e6..ffe5774f27 100644 --- a/pkg/types/ruletypes/rule.go +++ b/pkg/types/ruletypes/rule.go @@ -31,5 +31,4 @@ type RuleStore interface { GetStoredRules(context.Context, string) ([]*Rule, error) GetStoredRule(context.Context, valuer.UUID) (*Rule, error) GetRuleUUID(context.Context, int) (*RuleHistory, error) - ListOrgs(context.Context) ([]valuer.UUID, error) } diff --git a/pkg/types/tracefunneltypes/store.go b/pkg/types/tracefunneltypes/store.go new file mode 100644 index 0000000000..ba000410e0 --- /dev/null +++ b/pkg/types/tracefunneltypes/store.go @@ -0,0 +1,15 @@ +package tracefunneltypes + +import ( + "context" + + "github.com/SigNoz/signoz/pkg/valuer" +) + +type FunnelStore interface { + Create(context.Context, *StorableFunnel) error + Get(context.Context, valuer.UUID, valuer.UUID) (*StorableFunnel, error) + List(context.Context, valuer.UUID) ([]*StorableFunnel, error) + Update(context.Context, *StorableFunnel) error + Delete(context.Context, valuer.UUID, valuer.UUID) error +} diff --git a/pkg/types/tracefunneltypes/tracefunnel.go b/pkg/types/tracefunneltypes/tracefunnel.go new file mode 100644 index 0000000000..fdc51d943a --- /dev/null +++ b/pkg/types/tracefunneltypes/tracefunnel.go @@ -0,0 +1,98 @@ +package tracefunneltypes + +import ( + "github.com/SigNoz/signoz/pkg/errors" + v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3" + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/uptrace/bun" +) + +var ( + ErrFunnelAlreadyExists = errors.MustNewCode("funnel_already_exists") +) + +// StorableFunnel Core Data Structure (StorableFunnel and FunnelStep) +type StorableFunnel struct { + types.Identifiable + types.TimeAuditable + types.UserAuditable + bun.BaseModel `bun:"table:trace_funnel"` + Name string `json:"funnel_name" bun:"name,type:text,notnull"` + Description string `json:"description" bun:"description,type:text"` + OrgID valuer.UUID `json:"org_id" bun:"org_id,type:varchar,notnull"` + Steps []*FunnelStep `json:"steps" bun:"steps,type:text,notnull"` + Tags string `json:"tags" bun:"tags,type:text"` + CreatedByUser *types.User `json:"user" bun:"rel:belongs-to,join:created_by=id"` +} + +type FunnelStep struct { + ID valuer.UUID `json:"id,omitempty"` + Name string `json:"name,omitempty"` // step name + Description string `json:"description,omitempty"` // step description + Order int64 `json:"step_order"` + ServiceName string `json:"service_name"` + SpanName string `json:"span_name"` + Filters *v3.FilterSet `json:"filters,omitempty"` + LatencyPointer string `json:"latency_pointer,omitempty"` + LatencyType string `json:"latency_type,omitempty"` + HasErrors bool `json:"has_errors"` +} + +// PostableFunnel represents all possible funnel-related requests +type PostableFunnel struct { + FunnelID valuer.UUID `json:"funnel_id,omitempty"` + Name string `json:"funnel_name,omitempty"` + Timestamp int64 `json:"timestamp,omitempty"` + Description string `json:"description,omitempty"` + Steps []*FunnelStep `json:"steps,omitempty"` + UserID string `json:"user_id,omitempty"` + + // Analytics specific fields + StartTime int64 `json:"start_time,omitempty"` + EndTime int64 `json:"end_time,omitempty"` + StepAOrder int64 `json:"step_a_order,omitempty"` + StepBOrder int64 `json:"step_b_order,omitempty"` +} + +// GettableFunnel represents all possible funnel-related responses +type GettableFunnel struct { + FunnelID string `json:"funnel_id,omitempty"` + FunnelName string `json:"funnel_name,omitempty"` + Description string `json:"description,omitempty"` + CreatedAt int64 `json:"created_at,omitempty"` + CreatedBy string `json:"created_by,omitempty"` + UpdatedAt int64 `json:"updated_at,omitempty"` + UpdatedBy string `json:"updated_by,omitempty"` + OrgID string `json:"org_id,omitempty"` + UserEmail string `json:"user_email,omitempty"` + Funnel *StorableFunnel `json:"funnel,omitempty"` + Steps []*FunnelStep `json:"steps,omitempty"` +} + +// TimeRange represents a time range for analytics +type TimeRange struct { + StartTime int64 `json:"start_time"` + EndTime int64 `json:"end_time"` +} + +// StepTransitionRequest represents a request for step transition analytics +type StepTransitionRequest struct { + TimeRange + StepStart int64 `json:"step_start,omitempty"` + StepEnd int64 `json:"step_end,omitempty"` +} + +// UserInfo represents basic user information +type UserInfo struct { + ID string `json:"id"` + Email string `json:"email"` +} + +type FunnelStepFilter struct { + StepNumber int + ServiceName string + SpanName string + LatencyPointer string // "start" or "end" + CustomFilters *v3.FilterSet +} diff --git a/pkg/types/tracefunneltypes/utils.go b/pkg/types/tracefunneltypes/utils.go new file mode 100644 index 0000000000..60ca4eaf36 --- /dev/null +++ b/pkg/types/tracefunneltypes/utils.go @@ -0,0 +1,139 @@ +package tracefunneltypes + +import ( + "fmt" + "sort" + "time" + + "github.com/SigNoz/signoz/pkg/errors" + "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/valuer" +) + +// ValidateTimestamp validates a timestamp +func ValidateTimestamp(timestamp int64, fieldName string) error { + if timestamp == 0 { + return fmt.Errorf("%s is required", fieldName) + } + if timestamp < 0 { + return fmt.Errorf("%s must be positive", fieldName) + } + return nil +} + +// ValidateTimestampIsMilliseconds validates that a timestamp is in milliseconds +func ValidateTimestampIsMilliseconds(timestamp int64) bool { + return timestamp >= 1000000000000 && timestamp <= 9999999999999 +} + +func ValidateFunnelSteps(steps []*FunnelStep) error { + if len(steps) < 2 { + return fmt.Errorf("funnel must have at least 2 steps") + } + + for i, step := range steps { + if step.ServiceName == "" { + return fmt.Errorf("step %d: service name is required", i+1) + } + if step.SpanName == "" { + return fmt.Errorf("step %d: span name is required", i+1) + } + if step.Order < 0 { + return fmt.Errorf("step %d: order must be non-negative", i+1) + } + } + + return nil +} + +// NormalizeFunnelSteps normalizes step orders to be sequential starting from 1. +// The function takes a slice of pointers to FunnelStep and returns a new slice with normalized step orders. +// The input slice is left unchanged. If the input slice contains nil pointers, they will be filtered out. +// Returns an empty slice if the input is empty or contains only nil pointers. +func NormalizeFunnelSteps(steps []*FunnelStep) []*FunnelStep { + if len(steps) == 0 { + return []*FunnelStep{} + } + + // Filter out nil pointers and create a new slice + validSteps := make([]*FunnelStep, 0, len(steps)) + for _, step := range steps { + if step != nil { + validSteps = append(validSteps, step) + } + } + + if len(validSteps) == 0 { + return []*FunnelStep{} + } + + // Create a defensive copy of the valid steps + newSteps := make([]*FunnelStep, len(validSteps)) + for i, step := range validSteps { + // Create a copy of each step to avoid modifying the original + stepCopy := *step + newSteps[i] = &stepCopy + } + + sort.Slice(newSteps, func(i, j int) bool { + return newSteps[i].Order < newSteps[j].Order + }) + + for i := range newSteps { + newSteps[i].Order = int64(i + 1) + } + + return newSteps +} + +func ValidateAndConvertTimestamp(timestamp int64) (time.Time, error) { + if err := ValidateTimestamp(timestamp, "timestamp"); err != nil { + return time.Time{}, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "timestamp is invalid: %v", err) + } + return time.Unix(0, timestamp*1000000), nil // Convert to nanoseconds +} + +func ConstructFunnelResponse(funnel *StorableFunnel, claims *authtypes.Claims) GettableFunnel { + resp := GettableFunnel{ + FunnelName: funnel.Name, + FunnelID: funnel.ID.String(), + Steps: funnel.Steps, + CreatedAt: funnel.CreatedAt.UnixNano() / 1000000, + CreatedBy: funnel.CreatedBy, + OrgID: funnel.OrgID.String(), + UpdatedBy: funnel.UpdatedBy, + UpdatedAt: funnel.UpdatedAt.UnixNano() / 1000000, + Description: funnel.Description, + } + + if funnel.CreatedByUser != nil { + resp.UserEmail = funnel.CreatedByUser.Email + } else if claims != nil { + resp.UserEmail = claims.Email + } + + return resp +} + +func ProcessFunnelSteps(steps []*FunnelStep) ([]*FunnelStep, error) { + // First validate the steps + if err := ValidateFunnelSteps(steps); err != nil { + return nil, errors.Newf(errors.TypeInvalidInput, + errors.CodeInvalidInput, + "invalid funnel steps: %v", err) + } + + // Then process the steps + for i := range steps { + if steps[i].Order < 1 { + steps[i].Order = int64(i + 1) + } + if steps[i].ID.IsZero() { + steps[i].ID = valuer.GenerateUUID() + } + } + + return NormalizeFunnelSteps(steps), nil +} diff --git a/pkg/types/tracefunneltypes/utils_test.go b/pkg/types/tracefunneltypes/utils_test.go new file mode 100644 index 0000000000..cf345d92b5 --- /dev/null +++ b/pkg/types/tracefunneltypes/utils_test.go @@ -0,0 +1,698 @@ +package tracefunneltypes + +import ( + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/SigNoz/signoz/pkg/types" + "github.com/SigNoz/signoz/pkg/types/authtypes" + "github.com/SigNoz/signoz/pkg/valuer" + "github.com/stretchr/testify/assert" +) + +func TestValidateTimestamp(t *testing.T) { + tests := []struct { + name string + timestamp int64 + fieldName string + expectError bool + }{ + { + name: "valid timestamp", + timestamp: time.Now().UnixMilli(), + fieldName: "timestamp", + expectError: false, + }, + { + name: "zero timestamp", + timestamp: 0, + fieldName: "timestamp", + expectError: true, + }, + { + name: "negative timestamp", + timestamp: -1, + fieldName: "timestamp", + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := ValidateTimestamp(tt.timestamp, tt.fieldName) + if tt.expectError { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestValidateTimestampIsMilliseconds(t *testing.T) { + tests := []struct { + name string + timestamp int64 + expected bool + }{ + { + name: "valid millisecond timestamp", + timestamp: 1700000000000, // 2023-11-14 12:00:00 UTC + expected: true, + }, + { + name: "too small timestamp", + timestamp: 999999999999, + expected: false, + }, + { + name: "too large timestamp", + timestamp: 10000000000000, + expected: false, + }, + { + name: "second precision timestamp", + timestamp: 1700000000, + expected: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := ValidateTimestampIsMilliseconds(tt.timestamp) + assert.Equal(t, tt.expected, result) + }) + } +} + +func TestValidateFunnelSteps(t *testing.T) { + tests := []struct { + name string + steps []*FunnelStep + expectError bool + }{ + { + name: "valid steps", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: false, + }, + { + name: "too few steps", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + expectError: true, + }, + { + name: "missing service name", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + SpanName: "test-span", + Order: 1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: true, + }, + { + name: "missing span name", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + Order: 1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: true, + }, + { + name: "negative order", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: -1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := ValidateFunnelSteps(tt.steps) + if tt.expectError { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } +} + +func TestNormalizeFunnelSteps(t *testing.T) { + tests := []struct { + name string + steps []*FunnelStep + expected []*FunnelStep + }{ + { + name: "already normalized steps", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expected: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + }, + { + name: "unordered steps", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + expected: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + }, + { + name: "steps with gaps in order", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 3", + ServiceName: "test-service", + SpanName: "test-span-3", + Order: 3, + }, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expected: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + { + Name: "Step 3", + ServiceName: "test-service", + SpanName: "test-span-3", + Order: 3, + }, + }, + }, + { + name: "steps with nil pointers", + steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + nil, + { + ID: valuer.GenerateUUID(), + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expected: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + }, + { + name: "empty steps", + steps: []*FunnelStep{}, + expected: []*FunnelStep{}, + }, + { + name: "all nil steps", + steps: []*FunnelStep{nil, nil}, + expected: []*FunnelStep{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := NormalizeFunnelSteps(tt.steps) + + // Compare only the relevant fields + assert.Len(t, result, len(tt.expected)) + for i := range result { + assert.Equal(t, tt.expected[i].Name, result[i].Name) + assert.Equal(t, tt.expected[i].ServiceName, result[i].ServiceName) + assert.Equal(t, tt.expected[i].SpanName, result[i].SpanName) + assert.Equal(t, tt.expected[i].Order, result[i].Order) + } + }) + } +} + +func TestGetClaims(t *testing.T) { + tests := []struct { + name string + setup func(*http.Request) + expectError bool + }{ + { + name: "valid claims", + setup: func(r *http.Request) { + claims := authtypes.Claims{ + UserID: "user-123", + OrgID: "org-123", + Email: "test@example.com", + } + *r = *r.WithContext(authtypes.NewContextWithClaims(r.Context(), claims)) + }, + expectError: false, + }, + { + name: "no claims in context", + setup: func(r *http.Request) { + claims := authtypes.Claims{} + *r = *r.WithContext(authtypes.NewContextWithClaims(r.Context(), claims)) + }, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + req := httptest.NewRequest("GET", "/", nil) + tt.setup(req) + + claims, err := authtypes.ClaimsFromContext(req.Context()) + if tt.expectError { + assert.Equal(t, authtypes.Claims{}, claims) + } else { + assert.NoError(t, err) + assert.NotNil(t, claims) + assert.Equal(t, "user-123", claims.UserID) + assert.Equal(t, "org-123", claims.OrgID) + assert.Equal(t, "test@example.com", claims.Email) + } + }) + } +} + +func TestValidateAndConvertTimestamp(t *testing.T) { + tests := []struct { + name string + timestamp int64 + expectError bool + }{ + { + name: "valid timestamp", + timestamp: time.Now().UnixMilli(), + expectError: false, + }, + { + name: "zero timestamp", + timestamp: 0, + expectError: true, + }, + { + name: "negative timestamp", + timestamp: -1, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result, err := ValidateAndConvertTimestamp(tt.timestamp) + if tt.expectError { + assert.Error(t, err) + assert.True(t, result.IsZero()) + } else { + assert.NoError(t, err) + assert.False(t, result.IsZero()) + // Verify the conversion from milliseconds to nanoseconds + assert.Equal(t, tt.timestamp*1000000, result.UnixNano()) + } + }) + } +} + +func TestConstructFunnelResponse(t *testing.T) { + now := time.Now() + funnelID := valuer.GenerateUUID() + orgID := valuer.GenerateUUID() + userID := valuer.GenerateUUID() + + tests := []struct { + name string + funnel *StorableFunnel + claims *authtypes.Claims + expected GettableFunnel + }{ + { + name: "with user email from funnel", + funnel: &StorableFunnel{ + Identifiable: types.Identifiable{ + ID: funnelID, + }, + TimeAuditable: types.TimeAuditable{ + CreatedAt: now, + UpdatedAt: now, + }, + UserAuditable: types.UserAuditable{ + CreatedBy: userID.String(), + UpdatedBy: userID.String(), + }, + Name: "test-funnel", + OrgID: orgID, + CreatedByUser: &types.User{ + Identifiable: types.Identifiable{ + ID: userID, + }, + Email: "funnel@example.com", + }, + Steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + }, + claims: &authtypes.Claims{ + UserID: userID.String(), + OrgID: orgID.String(), + Email: "claims@example.com", + }, + expected: GettableFunnel{ + FunnelName: "test-funnel", + FunnelID: funnelID.String(), + Steps: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + CreatedAt: now.UnixNano() / 1000000, + CreatedBy: userID.String(), + UpdatedAt: now.UnixNano() / 1000000, + UpdatedBy: userID.String(), + OrgID: orgID.String(), + UserEmail: "funnel@example.com", + }, + }, + { + name: "with user email from claims", + funnel: &StorableFunnel{ + Identifiable: types.Identifiable{ + ID: funnelID, + }, + TimeAuditable: types.TimeAuditable{ + CreatedAt: now, + UpdatedAt: now, + }, + UserAuditable: types.UserAuditable{ + CreatedBy: userID.String(), + UpdatedBy: userID.String(), + }, + Name: "test-funnel", + OrgID: orgID, + Steps: []*FunnelStep{ + { + ID: valuer.GenerateUUID(), + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + }, + claims: &authtypes.Claims{ + UserID: userID.String(), + OrgID: orgID.String(), + Email: "claims@example.com", + }, + expected: GettableFunnel{ + FunnelName: "test-funnel", + FunnelID: funnelID.String(), + Steps: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 1, + }, + }, + CreatedAt: now.UnixNano() / 1000000, + CreatedBy: userID.String(), + UpdatedAt: now.UnixNano() / 1000000, + UpdatedBy: userID.String(), + OrgID: orgID.String(), + UserEmail: "claims@example.com", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := ConstructFunnelResponse(tt.funnel, tt.claims) + + // Compare top-level fields + assert.Equal(t, tt.expected.FunnelName, result.FunnelName) + assert.Equal(t, tt.expected.FunnelID, result.FunnelID) + assert.Equal(t, tt.expected.CreatedAt, result.CreatedAt) + assert.Equal(t, tt.expected.CreatedBy, result.CreatedBy) + assert.Equal(t, tt.expected.UpdatedAt, result.UpdatedAt) + assert.Equal(t, tt.expected.UpdatedBy, result.UpdatedBy) + assert.Equal(t, tt.expected.OrgID, result.OrgID) + assert.Equal(t, tt.expected.UserEmail, result.UserEmail) + + // Compare steps + assert.Len(t, result.Steps, len(tt.expected.Steps)) + for i, step := range result.Steps { + expectedStep := tt.expected.Steps[i] + assert.Equal(t, expectedStep.Name, step.Name) + assert.Equal(t, expectedStep.ServiceName, step.ServiceName) + assert.Equal(t, expectedStep.SpanName, step.SpanName) + assert.Equal(t, expectedStep.Order, step.Order) + } + }) + } +} + +func TestProcessFunnelSteps(t *testing.T) { + tests := []struct { + name string + steps []*FunnelStep + expectError bool + }{ + { + name: "valid steps with missing IDs", + steps: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: 0, // Will be normalized to 1 + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 0, // Will be normalized to 2 + }, + }, + expectError: false, + }, + { + name: "invalid steps - missing service name", + steps: []*FunnelStep{ + { + Name: "Step 1", + SpanName: "test-span", + Order: 1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: true, + }, + { + name: "invalid steps - negative order", + steps: []*FunnelStep{ + { + Name: "Step 1", + ServiceName: "test-service", + SpanName: "test-span", + Order: -1, + }, + { + Name: "Step 2", + ServiceName: "test-service", + SpanName: "test-span-2", + Order: 2, + }, + }, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result, err := ProcessFunnelSteps(tt.steps) + if tt.expectError { + assert.Error(t, err) + assert.Nil(t, result) + } else { + assert.NoError(t, err) + assert.NotNil(t, result) + assert.Len(t, result, len(tt.steps)) + + // Verify IDs are generated + for _, step := range result { + assert.False(t, step.ID.IsZero()) + } + + // Verify orders are normalized + for i, step := range result { + assert.Equal(t, int64(i+1), step.Order) + } + } + }) + } +} diff --git a/pkg/valuer/string.go b/pkg/valuer/string.go index 18259ed0c9..ce2b5f7ea4 100644 --- a/pkg/valuer/string.go +++ b/pkg/valuer/string.go @@ -67,3 +67,8 @@ func (enum *String) Scan(val interface{}) error { *enum = NewString(str) return nil } + +func (enum *String) UnmarshalText(text []byte) error { + *enum = NewString(string(text)) + return nil +} diff --git a/pkg/valuer/uuid.go b/pkg/valuer/uuid.go index 35b49cda8a..a12979e0ce 100644 --- a/pkg/valuer/uuid.go +++ b/pkg/valuer/uuid.go @@ -122,3 +122,13 @@ func (enum *UUID) Scan(val interface{}) error { *enum = enumVal return nil } + +func (enum *UUID) UnmarshalText(text []byte) error { + uuid, err := NewUUID(string(text)) + if err != nil { + return err + } + + *enum = uuid + return nil +} diff --git a/pkg/valuer/valuer.go b/pkg/valuer/valuer.go index f069da04d8..7e65ac2857 100644 --- a/pkg/valuer/valuer.go +++ b/pkg/valuer/valuer.go @@ -3,6 +3,7 @@ package valuer import ( "database/sql" "database/sql/driver" + "encoding" "encoding/json" "fmt" ) @@ -28,4 +29,7 @@ type Valuer interface { // Implement fmt.Stringer to allow the value to be printed as a string fmt.Stringer + + // Implement encoding.TextUnmarshaler to allow the value to be unmarshalled from a string + encoding.TextUnmarshaler }