The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/app/features/trails/DataTrail.tsx

751 lines
27 KiB

import { css } from '@emotion/css';
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
import { useEffect, useRef } from 'react';
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
import { AdHocVariableFilter, GrafanaTheme2, RawTimeRange, urlUtil, VariableHide } from '@grafana/data';
import { PromQuery } from '@grafana/prometheus';
import { locationService, useChromeHeaderHeight } from '@grafana/runtime';
import {
AdHocFiltersVariable,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
ConstantVariable,
CustomVariable,
DataSourceVariable,
SceneComponentProps,
SceneControlsSpacer,
sceneGraph,
SceneObject,
SceneObjectBase,
SceneObjectState,
SceneObjectUrlSyncConfig,
SceneObjectUrlValues,
SceneObjectWithUrlSync,
SceneQueryRunner,
SceneRefreshPicker,
SceneTimePicker,
SceneTimeRange,
sceneUtils,
SceneVariable,
SceneVariableSet,
UrlSyncContextProvider,
UrlSyncManager,
VariableDependencyConfig,
VariableValueSelectors,
} from '@grafana/scenes';
import { useStyles2 } from '@grafana/ui';
import { DataTrailSettings } from './DataTrailSettings';
import { DataTrailHistory } from './DataTrailsHistory';
import { MetricScene } from './MetricScene';
import { MetricSelectScene } from './MetricSelect/MetricSelectScene';
import { MetricsHeader } from './MetricsHeader';
import { getTrailStore } from './TrailStore/TrailStore';
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
import { NativeHistogramBanner } from './banners/NativeHistogramBanner';
import { MetricDatasourceHelper } from './helpers/MetricDatasourceHelper';
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
import { reportChangeInLabelFilters, reportExploreMetrics } from './interactions';
import { migrateOtelDeploymentEnvironment } from './migrations/otelDeploymentEnvironment';
import { getDeploymentEnvironments, getNonPromotedOtelResources, totalOtelResources } from './otel/api';
import { OtelTargetType } from './otel/types';
import { manageOtelAndMetricFilters, updateOtelData, updateOtelJoinWithGroupLeft } from './otel/util';
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
import {
getVariablesWithOtelJoinQueryConstant,
MetricSelectedEvent,
trailDS,
VAR_DATASOURCE,
VAR_DATASOURCE_EXPR,
VAR_FILTERS,
VAR_MISSING_OTEL_TARGETS,
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
VAR_OTEL_AND_METRIC_FILTERS,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
VAR_OTEL_DEPLOYMENT_ENV,
VAR_OTEL_GROUP_LEFT,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
VAR_OTEL_JOIN_QUERY,
VAR_OTEL_RESOURCES,
} from './shared';
import { getTrailFor, limitAdhocProviders } from './utils';
export interface DataTrailState extends SceneObjectState {
topScene?: SceneObject;
embedded?: boolean;
controls: SceneObject[];
history: DataTrailHistory;
settings: DataTrailSettings;
createdAt: number;
// just for the starting data source
initialDS?: string;
initialFilters?: AdHocVariableFilter[];
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// this is for otel, if the data source has it, it will be updated here
hasOtelResources?: boolean;
useOtelExperience?: boolean;
otelTargets?: OtelTargetType; // all the targets with job and instance regex, job=~"<job-v>|<job-v>"", instance=~"<instance-v>|<instance-v>"
otelJoinQuery?: string;
isStandardOtel?: boolean;
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
nonPromotedOtelResources?: string[];
initialOtelCheckComplete?: boolean; // updated after the first otel check
startButtonClicked?: boolean; // from original landing page
afterFirstOtelCheck?: boolean; // when starting there is always a DS var change from variable dependency
resettingOtel?: boolean; // when switching OTel off from the switch
isUpdatingOtel?: boolean;
addingLabelFromBreakdown?: boolean; // do not use the otel and metrics var subscription when adding label from the breakdown
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// moved into settings
showPreviews?: boolean;
// Synced with url
metric?: string;
metricSearch?: string;
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
histogramsLoaded: boolean;
nativeHistograms: string[];
nativeHistogramMetric: string;
}
export class DataTrail extends SceneObjectBase<DataTrailState> implements SceneObjectWithUrlSync {
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
protected _urlSync = new SceneObjectUrlSyncConfig(this, {
keys: ['metric', 'metricSearch', 'showPreviews', 'nativeHistogramMetric'],
});
public constructor(state: Partial<DataTrailState>) {
super({
$timeRange: state.$timeRange ?? new SceneTimeRange({}),
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// the initial variables should include a metric for metric scene and the otelJoinQuery.
// NOTE: The other OTEL filters should be included too before this work is merged
$variables:
state.$variables ?? getVariableSet(state.initialDS, state.metric, state.initialFilters, state.otelJoinQuery),
controls: state.controls ?? [
new VariableValueSelectors({ layout: 'vertical' }),
new SceneControlsSpacer(),
new SceneTimePicker({}),
new SceneRefreshPicker({}),
],
history: state.history ?? new DataTrailHistory({}),
settings: state.settings ?? new DataTrailSettings({}),
createdAt: state.createdAt ?? new Date().getTime(),
// default to false but update this to true on updateOtelData()
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// or true if the user either turned on the experience
useOtelExperience: state.useOtelExperience ?? false,
// preserve the otel join query
otelJoinQuery: state.otelJoinQuery ?? '',
showPreviews: state.showPreviews ?? true,
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
nativeHistograms: state.nativeHistograms ?? [],
histogramsLoaded: state.histogramsLoaded ?? false,
nativeHistogramMetric: state.nativeHistogramMetric ?? '',
...state,
});
this.addActivationHandler(this._onActivate.bind(this));
}
public _onActivate() {
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
const urlParams = urlUtil.getUrlSearchParams();
migrateOtelDeploymentEnvironment(this, urlParams);
if (!this.state.topScene) {
this.setState({ topScene: getTopSceneFor(this.state.metric) });
}
// Some scene elements publish this
this.subscribeToEvent(MetricSelectedEvent, this._handleMetricSelectedEvent.bind(this));
const filtersVariable = sceneGraph.lookupVariable(VAR_FILTERS, this);
if (filtersVariable instanceof AdHocFiltersVariable) {
this._subs.add(
filtersVariable?.subscribeToState((newState, prevState) => {
if (!this._addingFilterWithoutReportingInteraction) {
reportChangeInLabelFilters(newState.filters, prevState.filters);
}
})
);
}
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// This is for OTel consolidation filters
// whenever the otel and metric filter is updated,
// we need to add that filter to the correct otel resource var or var filter
// so the filter can be interpolated in the query correctly
const otelAndMetricsFiltersVariable = sceneGraph.lookupVariable(VAR_OTEL_AND_METRIC_FILTERS, this);
const otelFiltersVariable = sceneGraph.lookupVariable(VAR_OTEL_RESOURCES, this);
if (
otelAndMetricsFiltersVariable instanceof AdHocFiltersVariable &&
otelFiltersVariable instanceof AdHocFiltersVariable &&
filtersVariable instanceof AdHocFiltersVariable
) {
this._subs.add(
otelAndMetricsFiltersVariable?.subscribeToState((newState, prevState) => {
// identify the added, updated or removed variables and update the correct filter,
// either the otel resource or the var filter
// do not update on switching on otel experience or the initial check
// do not update when selecting a label from metric scene breakdown
if (
this.state.useOtelExperience &&
this.state.initialOtelCheckComplete &&
!this.state.addingLabelFromBreakdown
) {
const nonPromotedOtelResources = this.state.nonPromotedOtelResources ?? [];
manageOtelAndMetricFilters(
newState.filters,
prevState.filters,
nonPromotedOtelResources,
otelFiltersVariable,
filtersVariable
);
}
})
);
}
Feat: New homepage design (#93354) * wip: homepage (new user) * fix: spacing between button and text; wip refactor: separating bookmarks and recent metrics from home page * feat: new user homepage; wip: need to clean up code * fix: change rocket icon to svg * wip feat: rendering recent metrics * chore: add comments to understand code, will need to delete / cleanup later / pare down into documentation comments * wip: new recent metric card design * wip: display recent metrics cards in rows of 3 (height still incorrect) * feat: apply conditional styling to remainder recent metrics exploration cards (any cards that are not a complete row of 3) * fix: render new recent metrics explorations without refresh * style: render recent metrics explorations in rows of 3 using grid instead of flex; fix: remove remainder card styling * fix: remove delete button from recent metrics exp cards * style: make background color for each card take up the entire card/grid space; make height of cards for each row the tallest card * chore: clean up code * fix: fix eslint errors * style: implement recent metrics card header styling * style: in recent metrics exp cards, format datasource line * fix: add initial value for _lastModified to fix eslint err * style: format date correctly; chore: clean up code; wip: get date to render properly on bottom left * style: make inner card height match outer card height; style: add date footer; style: wrap last metric name; style: wrap labels * style: adjust font for label name and label value * style: truncate singular label if value is greater than 35 characters * style: truncate singular long labels at 44 characters; style: truncate multiple labels at 3 lines; style: correct the border width and radius * style: make background border radius match the border * style: correct gap between rows and columns of cards; style: correct padding inside card * chore: clean up code * refactor: apply new card UI to DataTrailCard component * feat: add bookmarks (not formatted correctly), only render section if there are bookmarks, hook up delete functionality * style: add horizontal line above bookmarks header; style: add bookmarks header * style: add additional padding above bookmarks divider; chore: delete unused code * style: add carrot button to bookmarks; style: format heading font style * refactor: separate bookmarks into functional component; feat: make bookmarks section collapsed by default; feat: allow toggle to expand bookmarks section * style: position delete button for bookmarks in bottom right of card * fix: only render recent metrics and bookmarks headings if there are any * style: add show more button (not functional); style: fix padding around show more button * chore: delete unused code * fix: add back gap underneath bookmarks header * feat: implement show more/less button for recent metrics * fix: do not show select metric card if user does not actually select a metric * chore: preliminary code clean up * chore: delete console.logs, comments * chore: clean up styling * Update public/app/features/trails/DataTrailCard.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * fix: add i18nKey to Trans tags * fix: attempt to remove go.work.sum changes that are unrelated to my PR * fix: add Trans tags * refactor: sepearate recent metrics into functional component; chore: delete unused code; fix: add Trans tags * chore: generate translation json * trigger drone * trigger drone * fix: add trans tag to date * chore: abbreviate descriptive key, regenerate json * Update public/app/features/trails/DataTrailBookmarks.tsx Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> * Update public/app/features/trails/DataTrailsRecentMetrics.tsx Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> * Update public/app/features/trails/DataTrailBookmarks.tsx Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> * fix: revert trans tag on date created to fix formatting * chore: return null immediately if no recent metrics * style: add margin between bookmarks header and carrot toggle button * style: adjust margin to 8px between bookmarks header and carrot toggle button * style: make margins multiples of 4 * Update public/app/features/trails/DataTrailBookmarks.tsx Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com> * style: fix light mode styles; style: fix border radius * fix: save select metric view as recent metric card if labels are applied * Update public/app/features/trails/DataTrailCard.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * refactor: move rocket svgs into assets folder * chore: add back accidentally deleted console log * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrailBookmarks.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * chore: revert lastModified related changes since behavior appears to remain the same * fix: add back lastModified changes because they make the recent metrics show more functionality work --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
8 months ago
// Save the current trail as a recent (if the browser closes or reloads) if user selects a metric OR applies filters to metric select view
const saveRecentTrail = () => {
const filtersVariable = sceneGraph.lookupVariable(VAR_FILTERS, this);
const hasFilters = filtersVariable instanceof AdHocFiltersVariable && filtersVariable.state.filters.length > 0;
if (this.state.metric || hasFilters) {
getTrailStore().setRecentTrail(this);
}
};
window.addEventListener('unload', saveRecentTrail);
return () => {
if (!this.state.embedded) {
saveRecentTrail();
}
window.removeEventListener('unload', saveRecentTrail);
};
}
protected _variableDependency = new VariableDependencyConfig(this, {
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
variableNames: [VAR_DATASOURCE, VAR_OTEL_RESOURCES, VAR_OTEL_JOIN_QUERY, VAR_OTEL_AND_METRIC_FILTERS],
onReferencedVariableValueChanged: async (variable: SceneVariable) => {
const { name } = variable.state;
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
if (name === VAR_DATASOURCE) {
this.datasourceHelper.reset();
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// reset native histograms
this.resetNativeHistograms();
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (this.state.afterFirstOtelCheck) {
// we need a new check for OTel
this.setState({ initialOtelCheckComplete: false });
// clear out the OTel filters, do not clear out var filters
this.resetOtelExperience();
}
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// fresh check for otel experience
this.checkDataSourceForOTelResources();
}
// update otel variables when changed
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (this.state.useOtelExperience && name === VAR_OTEL_RESOURCES && this.state.initialOtelCheckComplete) {
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// for state and variables
const timeRange: RawTimeRange | undefined = this.state.$timeRange?.state;
const datasourceUid = sceneGraph.interpolate(this, VAR_DATASOURCE_EXPR);
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (timeRange) {
updateOtelData(this, datasourceUid, timeRange);
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
}
}
},
});
/**
* Assuming that the change in filter was already reported with a cause other than `'adhoc_filter'`,
* this will modify the adhoc filter variable and prevent the automatic reporting which would
* normally occur through the call to `reportChangeInLabelFilters`.
*/
public addFilterWithoutReportingInteraction(filter: AdHocVariableFilter) {
const variable = sceneGraph.lookupVariable('filters', this);
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
const otelAndMetricsFiltersVariable = sceneGraph.lookupVariable(VAR_OTEL_AND_METRIC_FILTERS, this);
if (
!(variable instanceof AdHocFiltersVariable) ||
!(otelAndMetricsFiltersVariable instanceof AdHocFiltersVariable)
) {
return;
}
this._addingFilterWithoutReportingInteraction = true;
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (this.state.useOtelExperience) {
otelAndMetricsFiltersVariable.setState({ filters: [...otelAndMetricsFiltersVariable.state.filters, filter] });
} else {
variable.setState({ filters: [...variable.state.filters, filter] });
}
this._addingFilterWithoutReportingInteraction = false;
}
private _addingFilterWithoutReportingInteraction = false;
private datasourceHelper = new MetricDatasourceHelper(this);
public getMetricMetadata(metric?: string) {
return this.datasourceHelper.getMetricMetadata(metric);
}
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
public isNativeHistogram(metric: string) {
return this.datasourceHelper.isNativeHistogram(metric);
}
// use this to initialize histograms in all scenes
public async initializeHistograms() {
if (!this.state.histogramsLoaded) {
await this.datasourceHelper.initializeHistograms();
this.setState({
nativeHistograms: this.listNativeHistograms(),
histogramsLoaded: true,
});
}
}
public listNativeHistograms() {
return this.datasourceHelper.listNativeHistograms() ?? [];
}
private resetNativeHistograms() {
this.setState({
histogramsLoaded: false,
nativeHistograms: [],
});
}
public getCurrentMetricMetadata() {
return this.getMetricMetadata(this.state.metric);
}
public restoreFromHistoryStep(state: DataTrailState) {
if (!state.topScene && !state.metric) {
// If the top scene for an is missing, correct it.
state.topScene = new MetricSelectScene({});
}
this.setState(
sceneUtils.cloneSceneObjectState(state, {
history: this.state.history,
metric: !state.metric ? undefined : state.metric,
metricSearch: !state.metricSearch ? undefined : state.metricSearch,
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// store type because this requires an expensive api call to determine
// when loading the metric scene
nativeHistogramMetric: !state.nativeHistogramMetric ? undefined : state.nativeHistogramMetric,
})
);
const urlState = new UrlSyncManager().getUrlState(this);
const fullUrl = urlUtil.renderUrl(locationService.getLocation().pathname, urlState);
locationService.replace(fullUrl);
}
private async _handleMetricSelectedEvent(evt: MetricSelectedEvent) {
const metric = evt.payload ?? '';
if (this.state.useOtelExperience) {
await updateOtelJoinWithGroupLeft(this, metric);
}
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// from the metric preview panel we have the info loaded to determine that a metric is a native histogram
let nativeHistogramMetric = false;
if (this.isNativeHistogram(metric)) {
nativeHistogramMetric = true;
}
this.setState(this.getSceneUpdatesForNewMetricValue(metric, nativeHistogramMetric));
// Add metric to adhoc filters baseFilter
const filterVar = sceneGraph.lookupVariable(VAR_FILTERS, this);
if (filterVar instanceof AdHocFiltersVariable) {
filterVar.setState({
baseFilters: getBaseFiltersForMetric(evt.payload),
});
}
}
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
private getSceneUpdatesForNewMetricValue(metric: string | undefined, nativeHistogramMetric?: boolean) {
const stateUpdate: Partial<DataTrailState> = {};
stateUpdate.metric = metric;
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// refactoring opportunity? Or do we pass metric knowledge all the way down?
// must pass this native histogram prometheus knowledge deep into
// the topscene set on the trail > MetricScene > getAutoQueriesForMetric() > createHistogramMetricQueryDefs();
stateUpdate.nativeHistogramMetric = nativeHistogramMetric ? '1' : '';
stateUpdate.topScene = getTopSceneFor(metric, nativeHistogramMetric);
return stateUpdate;
}
getUrlState(): SceneObjectUrlValues {
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
const { metric, metricSearch, showPreviews, nativeHistogramMetric } = this.state;
return {
metric,
metricSearch,
...{ showPreviews: showPreviews === false ? 'false' : null },
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// store the native histogram knowledge in url for the metric scene
nativeHistogramMetric,
};
}
updateFromUrl(values: SceneObjectUrlValues) {
const stateUpdate: Partial<DataTrailState> = {};
if (typeof values.metric === 'string') {
if (this.state.metric !== values.metric) {
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// if we have a metric and we have stored in the url that it is a native histogram
// we can pass that info into the metric scene to generate the appropriate queries
let nativeHistogramMetric = false;
if (values.nativeHistogramMetric === '1') {
nativeHistogramMetric = true;
}
Object.assign(stateUpdate, this.getSceneUpdatesForNewMetricValue(values.metric, nativeHistogramMetric));
}
} else if (values.metric == null) {
stateUpdate.metric = undefined;
stateUpdate.topScene = new MetricSelectScene({});
}
if (typeof values.metricSearch === 'string') {
stateUpdate.metricSearch = values.metricSearch;
} else if (values.metric == null) {
stateUpdate.metricSearch = undefined;
}
if (typeof values.showPreviews === 'string') {
stateUpdate.showPreviews = values.showPreviews !== 'false';
}
this.setState(stateUpdate);
}
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
/**
* Check that the data source has otel resources
* Check that the data source is standard for OTEL
* Show a warning if not
* Update the following variables:
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
* otelResources (filters), otelJoinQuery (used in the query)
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
* Enable the otel experience
*
* @returns
*/
public async checkDataSourceForOTelResources() {
// call up in to the parent trail
const trail = getTrailFor(this);
// get the time range
const timeRange: RawTimeRange | undefined = trail.state.$timeRange?.state;
if (timeRange) {
const datasourceUid = sceneGraph.interpolate(trail, VAR_DATASOURCE_EXPR);
const otelTargets = await totalOtelResources(datasourceUid, timeRange);
const deploymentEnvironments = await getDeploymentEnvironments(
datasourceUid,
timeRange,
sceneGraph.getScopesBridge(trail)?.getValue() ?? []
);
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
const hasOtelResources = otelTargets.jobs.length > 0 && otelTargets.instances.length > 0;
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// loading from the url with otel resources selected will result in turning on OTel experience
const otelResourcesVariable = sceneGraph.lookupVariable(VAR_OTEL_AND_METRIC_FILTERS, this);
let previouslyUsedOtelResources = false;
if (otelResourcesVariable instanceof AdHocFiltersVariable) {
previouslyUsedOtelResources = otelResourcesVariable.state.filters.length > 0;
}
// Future refactor: non promoted resources could be the full check
// - remove hasOtelResources
// - remove deployment environments as a check
const nonPromotedOtelResources = await getNonPromotedOtelResources(datasourceUid, timeRange);
// This is the function that will turn on OTel for the entire app.
// The conditions to use this function are
// 1. must be an otel data source
// 2. Do not turn it on if the start button was clicked
// 3. Url or bookmark has previous otel filters
// 4. We are restting OTel with the toggle switch
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
if (
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
hasOtelResources &&
nonPromotedOtelResources && // it is an otel data source
!this.state.startButtonClicked && // we are not starting from the start button
(previouslyUsedOtelResources || this.state.resettingOtel) // there are otel filters or we are restting
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
) {
// HERE WE START THE OTEL EXPERIENCE ENGINE
// 1. Set deployment variable values
// 2. update all other variables and state
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
updateOtelData(
this,
datasourceUid,
timeRange,
deploymentEnvironments,
hasOtelResources,
nonPromotedOtelResources
);
} else {
this.resetOtelExperience(hasOtelResources, nonPromotedOtelResources);
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
}
}
}
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
resetOtelExperience(hasOtelResources?: boolean, nonPromotedResources?: string[]) {
const otelResourcesVariable = sceneGraph.lookupVariable(VAR_OTEL_RESOURCES, this);
const filtersVariable = sceneGraph.lookupVariable(VAR_FILTERS, this);
const otelAndMetricsFiltersVariable = sceneGraph.lookupVariable(VAR_OTEL_AND_METRIC_FILTERS, this);
const otelJoinQueryVariable = sceneGraph.lookupVariable(VAR_OTEL_JOIN_QUERY, this);
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (
!(
otelResourcesVariable instanceof AdHocFiltersVariable &&
filtersVariable instanceof AdHocFiltersVariable &&
otelAndMetricsFiltersVariable instanceof AdHocFiltersVariable &&
otelJoinQueryVariable instanceof ConstantVariable
)
) {
return;
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
}
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// show the var filters normally
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
filtersVariable.setState({
addFilterButtonText: 'Add label',
label: 'Select label',
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
hide: VariableHide.hideLabel,
});
// Resetting the otel experience filters means clearing both the otel resources var and the otelMetricsVar
// hide the super otel and metric filter and reset it
otelAndMetricsFiltersVariable.setState({
filters: [],
hide: VariableHide.hideVariable,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
});
// if there are no resources reset the otel variables and otel state
// or if not standard
otelResourcesVariable.setState({
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
filters: [],
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
defaultKeys: [],
hide: VariableHide.hideVariable,
});
otelJoinQueryVariable.setState({ value: '' });
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// potential full reset when a data source fails the check or is the initial check with turning off
if (hasOtelResources && nonPromotedResources) {
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
this.setState({
hasOtelResources,
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
isStandardOtel: nonPromotedResources.length > 0,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
useOtelExperience: false,
otelTargets: { jobs: [], instances: [] },
otelJoinQuery: '',
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
afterFirstOtelCheck: true,
initialOtelCheckComplete: true,
isUpdatingOtel: false,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
});
} else {
// partial reset when a user turns off the otel experience
this.setState({
otelTargets: { jobs: [], instances: [] },
otelJoinQuery: '',
useOtelExperience: false,
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
afterFirstOtelCheck: true,
initialOtelCheckComplete: true,
isUpdatingOtel: false,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
});
}
}
public getQueries(): PromQuery[] {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const sqrs = sceneGraph.findAllObjects(this, (b) => b instanceof SceneQueryRunner) as SceneQueryRunner[];
return sqrs.reduce<PromQuery[]>((acc, sqr) => {
acc.push(
...sqr.state.queries.map((q) => ({
...q,
expr: sceneGraph.interpolate(sqr, q.expr),
}))
);
return acc;
}, []);
}
static Component = ({ model }: SceneComponentProps<DataTrail>) => {
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
const {
controls,
topScene,
history,
settings,
useOtelExperience,
hasOtelResources,
embedded,
histogramsLoaded,
nativeHistograms,
} = model.useState();
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
const chromeHeaderHeight = useChromeHeaderHeight();
const styles = useStyles2(getStyles, embedded ? 0 : (chromeHeaderHeight ?? 0));
const showHeaderForFirstTimeUsers = getTrailStore().recent.length < 2;
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// need to initialize this here and not on activate because it requires the data source helper to be fully initialized first
model.initializeHistograms();
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
useEffect(() => {
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
if (model.state.addingLabelFromBreakdown) {
return;
}
if (!useOtelExperience && model.state.afterFirstOtelCheck) {
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
// if the experience has been turned off, reset the otel variables
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
model.resetOtelExperience();
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
} else {
// if experience is enabled, check standardization and update the otel variables
model.checkDataSourceForOTelResources();
}
}, [model, hasOtelResources, useOtelExperience]);
useEffect(() => {
const filtersVariable = sceneGraph.lookupVariable(VAR_FILTERS, model);
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
const otelAndMetricsFiltersVariable = sceneGraph.lookupVariable(VAR_OTEL_AND_METRIC_FILTERS, model);
const limitedFilterVariable = useOtelExperience ? otelAndMetricsFiltersVariable : filtersVariable;
const datasourceHelper = model.datasourceHelper;
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
limitAdhocProviders(model, limitedFilterVariable, datasourceHelper);
}, [model, useOtelExperience]);
const reportOtelExperience = useRef(false);
// only report otel experience once
if (useOtelExperience && !reportOtelExperience.current) {
reportExploreMetrics('otel_experience_used', {});
reportOtelExperience.current = true;
}
return (
<div className={styles.container}>
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
{NativeHistogramBanner({ histogramsLoaded, nativeHistograms, trail: model })}
{showHeaderForFirstTimeUsers && <MetricsHeader />}
<history.Component model={history} />
{controls && (
<div className={styles.controls}>
{controls.map((control) => (
<control.Component key={control.state.key} model={control} />
))}
<settings.Component model={settings} />
</div>
)}
{topScene && (
<UrlSyncContextProvider scene={topScene}>
<div className={styles.body}>{topScene && <topScene.Component model={topScene} />}</div>
</UrlSyncContextProvider>
)}
</div>
);
};
}
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
export function getTopSceneFor(metric?: string, nativeHistogram?: boolean) {
if (metric) {
Explore metrics: Support native histograms (#98894) * identify native histograms by classic histograms * use trail to expose ds helper * identify native histograms for preview panel * refactor ds helper to initialize all native histograms * remove await * add info message for native histograms * hide button on show examples * show nh in metric scene by passing check for nh and storing in url for url loads, bookmarks and recent explorations * add badge for native histograms * click native histogram examples in info message to see them * add link for learn more * close banner on select when selecting native histogram in info banner * show message for newly selected data sources * capitalize Native Histogram badge * prettier * fix badge ui width * add padding for badge * add images, styling and tests for native histogram banner * move images to img folder * fix store tests * run i18n * fix betterer * fix betterer with translations * cannot translate interpolated metric in button text * Fix import * do not indent the > See examples section * trans component interferes with text with special chars * update sm text with 4px padding and 16px spacing between images * do not show banner after closing then changing data sources * prettier * Update public/app/features/trails/helpers/MetricDatasourceHelper.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/banners/NativeHistogramBanner.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * update comments * remove unnecessary code check * add rudderstack types * add close example functionality * prettier * add t() for betterer * prettier * fix betterer and trans issues * fix test --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
return new MetricScene({ metric: metric, nativeHistogram: nativeHistogram ?? false });
} else {
return new MetricSelectScene({});
}
}
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
function getVariableSet(
initialDS?: string,
metric?: string,
initialFilters?: AdHocVariableFilter[],
otelJoinQuery?: string
) {
return new SceneVariableSet({
variables: [
new DataSourceVariable({
name: VAR_DATASOURCE,
label: 'Data source',
description: 'Only prometheus data sources are supported',
value: initialDS,
pluginId: 'prometheus',
}),
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
new AdHocFiltersVariable({
name: VAR_OTEL_RESOURCES,
label: 'Select resource attributes',
addFilterButtonText: 'Select resource attributes',
datasource: trailDS,
hide: VariableHide.hideVariable,
layout: 'combobox',
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
defaultKeys: [],
applyMode: 'manual',
allowCustomValue: true,
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
}),
new AdHocFiltersVariable({
name: VAR_FILTERS,
addFilterButtonText: 'Add label',
datasource: trailDS,
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// default to use var filters and have otel off
hide: VariableHide.hideLabel,
layout: 'combobox',
filters: initialFilters ?? [],
baseFilters: getBaseFiltersForMetric(metric),
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
applyMode: 'manual',
allowCustomValue: true,
expressionBuilder: (filters: AdHocVariableFilter[]) => {
return [...getBaseFiltersForMetric(metric), ...filters]
.map((filter) => `${filter.key}${filter.operator}"${filter.value}"`)
.join(',');
},
}),
Explore Metrics: Get OTel resources and filter metrics and labels (#91221) * add OTel filter in metric select scene * add resource query to get matching OTEL job&instance * filter metrics by OTEL resources * only add otel select if DS has OTEL matching job and instance * add folder for otel resources * upate metric select for new otel folder * move otel api call * get otel resources for labels for single series job/instance target_info * add otel resources to adhoc variable dropdown * update otel api to check for standardization and return labels * label types for api * check standardization, show otel variable, select depenv, update other variables * remove otel target list from metric select scene * load resources if dep_env label has already been selected * exclude previously used filters * do not check standardization if there are already otel filters * drop filters when switching data sources * add experience var for switching to otel experience * remove otel from variables and place near settings * add error for non-standard prom with otel resources * fix typescript errors, remove ts-ignores * add custom variable for deployment environment like app-olly * fix name of otel variable * add function for getting otel resources from variables * add otel join query const * update standard check to be simpler * allow for unstandard otel data sources but give warning * add otelJoinQuery to the base query and clean up variables when state changes * refactor otel functions to return filters for targets, use targets to filter metrics * update metric names on otel target filter change * when no otel targets for otel resource filter, show no metrics * move switch to settings, default to use experience, refactor otel checks * clean code * fix refactor to add hasOtelResources for showing the switch in settings * sort otel resources by blessed list * reset otel when data source is changed * move otel experience toggle back outside settings * move showPreviews into settings * do not re-add otel resources from blessed list to filters when already selected * add otel join query variable to histogram base query * only show settings for appropriate scenes * show info tooltip the same but show error on hover for disabling otel exp for unstandard DS * refactor tagKeys and tagValues for otel resources variable, fix promoted list ordering, fix dep env state bug * default dep env value * apply var filters only where they are using VAR_FILTER_EXPR in queryies * change copy for labels to attributes * do not group_left job label when already joining by job * update copy for label variable when using otel * remove isStandard check for now because of data staleness in Prometheus * default to showing heatmap for histograms * add trail history for selecting dep env and otel resources * add otel resource attributes tests for DataTrail * move otel functions to utils * write tests for otel api calls * write tests for otel utils functions * fix history * standard otel has target_info metric and deployment_environment resource attributes * fix tests * refactor otel functions for updating state and variables * clean code * fix tests * fix tests * mock checkDataSourceForOtelResources * fix tests * update query tests with otelJoinQuery and default to heatmap for _bucket metrics * fix tests for otel api * fix trail history test * fix trail store tests for missing otel variables * make i18n-extract * handle target_info with inconsistent job and instance labels * fix otel copy and <Trans> component * fix custom variable deployment environment bug when switchiing data sources from non otel to otel * fix linting error for trans component * format i18nKey correctly * clean up old comments * add frontend hardening for OTel job and instance metric list filtering * fix test for deployment environment custom variable to use changeValueTo * fix i18n * remove comments for fixed bug * edit skipped tests
9 months ago
...getVariablesWithOtelJoinQueryConstant(otelJoinQuery ?? ''),
new ConstantVariable({
name: VAR_OTEL_GROUP_LEFT,
value: undefined,
hide: VariableHide.hideVariable,
}),
new ConstantVariable({
name: VAR_MISSING_OTEL_TARGETS,
hide: VariableHide.hideVariable,
value: false,
}),
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
new AdHocFiltersVariable({
name: VAR_OTEL_AND_METRIC_FILTERS,
addFilterButtonText: 'Filter',
datasource: trailDS,
hide: VariableHide.hideVariable,
layout: 'combobox',
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
filters: initialFilters ?? [],
baseFilters: getBaseFiltersForMetric(metric),
applyMode: 'manual',
allowCustomValue: true,
Explore metrics: Consolidate filters with the OTel experience (#98371) * sort otel resources to top of adhoc filters * add bool in datatrail * add function to find non promoted otel resources * add additional super filter variable * hide filters var and keep otel filters var hidden * add nonpromoted resources to state, update otel or var filters when super filter is updated * update comments * update plan * Allow deployment environment values from both metrics and target_info * Remove usage of dep env var in getting resources * update code comments for clarity * Remove dep env variable, autoselect dep env in otelmetricvar and allow updating of vals in otelmetricvar * Fix bug that conflicts with local storage useOtelExperience check * expose metadata to show data source is loaded to prevent otel race conditions * remove filtering check on target_info in the itel join query * update plan with extra issues * refactor update and reset functions for otel experience * use non promoted resources as the standardization check * sort the resources in filters var if using otel experience * add test for sorting resources with otelmetricsvar * update tests for otel experience in datatrail.test * update tests for otel utils * update otel api tests * update trail store tests to remove dep env var * run prettier * remove unused imports * add tests, distinguish on start and when the initial otel check is done, update comments * Fix bug when adding multiple otel resources * fix when adding filter from breakdown * add migration for dep env var * update migration function and write tests * prettier * Update dep env migration to handle bookmarks * fix trailstore tests for reintroducing the dep env var * refactor default env function, we only need the value * remove redundant check * move otel functions to utils and update and add tests * prettier * cleanup * fix migration for fromStart * update tests for migration * use join and use push * fix flow with state * Fix flow in update OTel function * update tests for flow fixes * fix toggle OTel bugs * report when dep env has been migrated and delete dep env filters to not migrate it again * Clear out dep env after migration * run prettier * improve non promoted attribute function * remove unused functions * prettier * default otel experience to off * report when otel experience is used * report when otel is turned on and off * report otel filters changed * prettier * keep default otel off, respect the local storage, but if loading with otel vars from url or bookmark we can turn it on * Add new badge * fix metric scene breakdown add filter bug around non promoted labels on a metric that are different than non promoted labels for all metrics * prettier * make i18n-extract * prettier for translations * change button name to "Filter" * Update public/app/features/trails/Breakdown/AddToFiltersGraphAction.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/migrations/otelDeploymentEnvironment.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/DataTrail.tsx Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/api.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Update public/app/features/trails/otel/util.ts Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com> * Add more padding for pill where capital letter gets to close to the left border and looks off. * clear up comments --------- Co-authored-by: Nick Richmond <5732000+NWRichmond@users.noreply.github.com>
5 months ago
// skipUrlSync: true
}),
// Legacy variable needed for bookmarking which is necessary because
// url sync method does not handle multiple dep env values
// Remove this when the rudderstack event "deployment_environment_migrated" tapers off
new CustomVariable({
name: VAR_OTEL_DEPLOYMENT_ENV,
label: 'Deployment environment',
hide: VariableHide.hideVariable,
value: undefined,
placeholder: 'Select',
isMulti: true,
}),
],
});
}
function getStyles(theme: GrafanaTheme2, chromeHeaderHeight: number) {
return {
container: css({
flexGrow: 1,
display: 'flex',
gap: theme.spacing(1),
flexDirection: 'column',
background: theme.isLight ? theme.colors.background.primary : theme.colors.background.canvas,
padding: theme.spacing(2, 3, 2, 3),
}),
body: css({
flexGrow: 1,
display: 'flex',
flexDirection: 'column',
}),
controls: css({
display: 'flex',
gap: theme.spacing(1),
padding: theme.spacing(1, 0),
alignItems: 'flex-end',
flexWrap: 'wrap',
position: 'sticky',
background: theme.isDark ? theme.colors.background.canvas : theme.colors.background.primary,
zIndex: theme.zIndex.navbarFixed,
top: chromeHeaderHeight,
}),
};
}
function getBaseFiltersForMetric(metric?: string): AdHocVariableFilter[] {
if (metric) {
return [{ key: '__name__', operator: '=', value: metric }];
}
return [];
}