diff --git a/dashboards-observability/common/constants/metrics.ts b/dashboards-observability/common/constants/metrics.ts new file mode 100644 index 000000000..4dc2fa32d --- /dev/null +++ b/dashboards-observability/common/constants/metrics.ts @@ -0,0 +1,11 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export const SELECTED_METRICS = 'selectedMetrics'; +export const RECENTLY_CREATED_METRICS = 'unselectedMetrics'; +export const AVAILABLE_METRICS = 'availableMetrics'; + +// redux +export const REDUX_SLICE_METRICS = 'metrics'; diff --git a/dashboards-observability/public/components/metrics/helpers/utils.tsx b/dashboards-observability/public/components/metrics/helpers/utils.tsx index 775b04118..313992fd5 100644 --- a/dashboards-observability/public/components/metrics/helpers/utils.tsx +++ b/dashboards-observability/public/components/metrics/helpers/utils.tsx @@ -2,15 +2,19 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-console */ import dateMath from '@elastic/datemath'; import { ShortDate } from '@elastic/eui'; import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; import _ from 'lodash'; import { Moment } from 'moment-timezone'; +import React from 'react'; +import { SavedVisualizationType } from 'common/types/custom_panels'; +import { CUSTOM_PANELS_API_PREFIX } from '../../../../common/constants/custom_panels'; import { PPL_DATE_FORMAT, PPL_INDEX_REGEX } from '../../../../common/constants/shared'; import PPLService from '../../../services/requests/ppl'; -import React from 'react'; +import { CoreStart } from '../../../../../../src/core/public'; export const convertDateTime = (datetime: string, isStart = true, formatted = true) => { let returnTime: undefined | Moment; diff --git a/dashboards-observability/public/components/metrics/index.tsx b/dashboards-observability/public/components/metrics/index.tsx index 257de9186..43546767e 100644 --- a/dashboards-observability/public/components/metrics/index.tsx +++ b/dashboards-observability/public/components/metrics/index.tsx @@ -2,14 +2,13 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable no-console */ import './index.scss'; import { EuiButtonIcon, EuiPage, EuiPageBody, - EuiPageHeader, - EuiPageHeaderSection, EuiSpacer, EuiSuperDatePicker, EuiSuperDatePickerProps, @@ -25,16 +24,18 @@ import { EuiFlexItem, } from '@elastic/eui'; import { DurationRange } from '@elastic/eui/src/components/date_picker/types'; -import React, { Fragment, useState } from 'react'; -import { StaticContext } from 'react-router-dom'; +import React, { Fragment, useEffect, useState } from 'react'; import { Route, RouteComponentProps } from 'react-router-dom'; +import classNames from 'classnames'; +import { useSelector } from 'react-redux'; +import { StaticContext } from 'react-router-dom'; +import { CUSTOM_PANELS_API_PREFIX } from ' ../../../common/constants/custom_panels'; import { uiSettingsService } from '../../../common/utils'; import { ChromeBreadcrumb, CoreStart } from '../../../../../src/core/public'; -import { ObservabilitySideBar } from '../common/side_nav'; import { onTimeChange } from './helpers/utils'; import { Sidebar } from './sidebar/sidebar'; -import { EuiAccordion } from '@opensearch-project/oui'; import { EmptyMetricsView } from './view/empty_view'; +import { selectMetrics } from './redux/slices/metrics_slice'; interface MetricsProps { http: CoreStart['http']; @@ -52,16 +53,30 @@ export const Home = ({ http, chrome, parentBreadcrumb, renderProps }: MetricsPro // Side bar constants const [isSidebarClosed, setIsSidebarClosed] = useState(false); - const recentlyCreatedFields = ['1', '2', '3', '4']; - - const onRefreshFilters = (startTime: ShortDate, endTime: ShortDate) => { - // if (!isDateValid(convertDateTime(startTime), convertDateTime(endTime, false), setToast)) { - // return; - // } + const metricsList = useSelector(selectMetrics); - console.log('refreshed date picker'); + // Using Visualizations for recently created custom metrics for now + const [visualizationsList, setVisualizationsList] = useState([]); + // Fetch Saved Visualizations + const fetchVisualizations = async () => { + let savedVisualizations; + await http + .get(`${CUSTOM_PANELS_API_PREFIX}/visualizations/`) + .then((res) => { + setVisualizationsList(res.visualizations); + }) + .catch((err) => { + console.error('Issue in fetching all saved visualizations', err); + }); + return savedVisualizations; }; + useEffect(() => { + fetchVisualizations(); + }, []); + // Date Picker functions + // Empty functions for now + const onRefreshFilters = (startTime: ShortDate, endTime: ShortDate) => {}; const onDatePickerChange = (props: OnTimeChangeProps) => { onTimeChange( props.start, @@ -74,6 +89,11 @@ export const Home = ({ http, chrome, parentBreadcrumb, renderProps }: MetricsPro onRefreshFilters(props.start, props.end); }; + const mainSectionClassName = classNames({ + 'col-md-9': !isSidebarClosed, + 'col-md-12': isSidebarClosed, + }); + return ( <> - - - -

Metrics

-
-
-
- {/* */} - - - -
+
+
+
{!isSidebarClosed && ( - + )}
- - - - - - {/* */} +
+
+
+
+ +
+
+
+
diff --git a/dashboards-observability/public/components/metrics/redux/reducers/metrics_fetch_reducers.ts b/dashboards-observability/public/components/metrics/redux/reducers/metrics_fetch_reducers.ts new file mode 100644 index 000000000..a850c1690 --- /dev/null +++ b/dashboards-observability/public/components/metrics/redux/reducers/metrics_fetch_reducers.ts @@ -0,0 +1,4 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ diff --git a/dashboards-observability/public/components/metrics/redux/slices/metrics_slice.ts b/dashboards-observability/public/components/metrics/redux/slices/metrics_slice.ts new file mode 100644 index 000000000..f11886fea --- /dev/null +++ b/dashboards-observability/public/components/metrics/redux/slices/metrics_slice.ts @@ -0,0 +1,72 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { createSlice } from '@reduxjs/toolkit'; +import { forEach } from 'lodash'; +import { + SELECTED_METRICS, + RECENTLY_CREATED_METRICS, + AVAILABLE_METRICS, + REDUX_SLICE_METRICS, +} from '../../../../../common/constants/metrics'; + +const METRIC_NAMES_PPL = 'source = prometheus.information_schema.tables'; +import { metricNamesTablePPL } from './mockMetrics'; + +const initialMetrics = { + [SELECTED_METRICS]: [], + [RECENTLY_CREATED_METRICS]: [], + [AVAILABLE_METRICS]: metricNamesTablePPL.datarows, +}; + +const initialState = { + metrics: { ...initialMetrics }, +}; + +export const metricSlice = createSlice({ + name: REDUX_SLICE_METRICS, + initialState, + reducers: { + init: (state) => { + state.metrics = { + ...initialMetrics, + }; + }, + updateMetrics: (state, { payload }) => { + state.metrics = { + ...state.metrics, + ...payload.data, + }; + console.log('updated metrics'); + console.log(state); + }, + reset: (state) => { + state.metrics = { + ...initialMetrics, + }; + }, + remove: (state) => { + delete state.metrics; + }, + sortMetrics: (state, { payload }) => { + forEach(payload.data, (toSort: string) => { + state.metrics[toSort].sort((prev: any, cur: any) => cur[2].localeCompare(prev[2])); + }); + }, + fetchMetrics: (state, { payload }) => { + state = { + ...state, + ...payload.data, + }; + }, + }, + extraReducers: (builder) => {}, +}); + +export const { init, reset, remove, updateMetrics, sortMetrics } = metricSlice.actions; + +export const selectMetrics = (state) => state.metrics; + +export default metricSlice.reducer; diff --git a/dashboards-observability/public/components/metrics/redux/slices/mockMetrics.js b/dashboards-observability/public/components/metrics/redux/slices/mockMetrics.js new file mode 100644 index 000000000..cfb5f24c0 --- /dev/null +++ b/dashboards-observability/public/components/metrics/redux/slices/mockMetrics.js @@ -0,0 +1,2437 @@ + +export const metricNamesTablePPL = { + 'schema': [ + { + 'name': 'TABLE_CAT', + 'type': 'string' + }, + { + 'name': 'TABLE_SCHEM', + 'type': 'string' + }, + { + 'name': 'TABLE_NAME', + 'type': 'string' + }, + { + 'name': 'TABLE_TYPE', + 'type': 'string' + }, + { + 'name': 'REMARKS', + 'type': 'string' + }, + { + 'name': 'TYPE_CAT', + 'type': 'string' + }, + { + 'name': 'TYPE_SCHEM', + 'type': 'string' + }, + { + 'name': 'TYPE_NAME', + 'type': 'string' + }, + { + 'name': 'SELF_REFERENCING_COL_NAME', + 'type': 'string' + }, + { + 'name': 'REF_GENERATION', + 'type': 'string' + } + ], + 'datarows': [ + [ + 'catalog', + null, + 'prometheus_tsdb_reloads_total', + 'counter', + 'Number of times the database reloaded block data from disk.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_heap_stacks_bytes', + 'gauge', + 'Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_page_flushes_total', + 'counter', + 'Total number of page flushes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_mspan_sys_bytes', + 'gauge', + 'Number of bytes used for mspan structures obtained from system.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_stack_sys_bytes', + 'gauge', + 'Number of bytes obtained from system for stack allocator.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compactions_total', + 'counter', + 'Total number of compactions that were executed for the partition.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_max_exemplars', + 'gauge', + 'Total number of exemplars the exemplar storage can store, resizeable.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_exemplars_in_storage', + 'gauge', + 'Number of exemplars currently in circular storage.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_engine_query_duration_seconds', + 'summary', + 'Query timings', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_isolation_high_watermark', + 'gauge', + 'The highest TSDB append ID that has been given out.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_engine_queries_concurrent_max', + 'gauge', + 'The max number of concurrent queries.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_remote_storage_exemplars_in_total', + 'counter', + 'Exemplars in to remote storage, compare to exemplars out for queue managers.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_data_replay_duration_seconds', + 'gauge', + 'Time taken to replay the data on disk.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_dialer_conn_closed_total', + 'counter', + 'Total number of connections closed which originated from the dialer of a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_frees_total', + 'counter', + 'Total number of frees.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_allocs_objects_total', + 'counter', + 'Cumulative count of heap allocations triggered by the application. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_out_of_order_exemplars_total', + 'counter', + 'Total number of out of order exemplar ingestion failed attempts.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_mallocs_total', + 'counter', + 'Total number of mallocs.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_mmap_chunk_corruptions_total', + 'counter', + 'Total number of memory-mapped chunk corruptions.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_web_federation_errors_total', + 'counter', + 'Total number of errors that occurred while sending federation responses.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_file_read_errors_total', + 'counter', + 'The number of File-SD read errors.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_kuma_fetch_duration_seconds', + 'summary', + 'The duration of a Kuma MADS fetch call.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_isolation_low_watermark', + 'gauge', + 'The lowest TSDB append ID that is still referenced.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_http_request_duration_seconds', + 'histogram', + 'Histogram of latencies for HTTP requests.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_resident_memory_bytes', + 'gauge', + 'Resident memory size in bytes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_checkpoint_creations_failed_total', + 'counter', + 'Total number of checkpoint creations that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_sample_duplicate_timestamp_total', + 'counter', + 'Total number of samples rejected due to duplicate timestamps but different values.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_treecache_zookeeper_failures_total', + 'counter', + 'The total number of ZooKeeper failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compaction_chunk_size_bytes', + 'histogram', + 'Final size of chunks on their first compaction', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_gc_duration_seconds', + 'summary', + 'Runtime of garbage collection in the head block.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_objects_objects', + 'gauge', + 'Number of objects, live or unswept, occupying heap memory.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_open_fds', + 'gauge', + 'Number of open file descriptors.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_max_fds', + 'gauge', + 'Maximum number of open file descriptors.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_profiling_buckets_bytes', + 'gauge', + 'Memory that is used by the stack trace hash map used for profiling.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_inuse_bytes', + 'gauge', + 'Number of heap bytes that are in use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_dialer_conn_failed_total', + 'counter', + 'Total number of connections failed to dial by the dialer a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_mcache_sys_bytes', + 'gauge', + 'Number of bytes used for mcache structures obtained from system.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_min_time', + 'gauge', + 'Minimum time bound of the head block. The unit is decided by the library consumer.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_series_with_exemplars_in_storage', + 'gauge', + 'Number of series with exemplars currently in circular storage.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_duration_seconds', + 'summary', + 'A summary of the pause duration of garbage collection cycles.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_metadata_mspan_inuse_bytes', + 'gauge', + 'Memory that is occupied by runtime mspan structures that are currently being used.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_build_info', + 'gauge', + 'A metric with a constant 1 value labeled by version, revision, branch, and goversion from which prometheus was built.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compaction_chunk_range_seconds', + 'histogram', + 'Final time range of chunks on their first compaction', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_exemplars_appended_total', + 'counter', + 'Total number of appended exemplars.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_chunks', + 'gauge', + 'Total number of chunks in the head block.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_max_time', + 'gauge', + 'Maximum timestamp of the head block. The unit is decided by the library consumer.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_corruptions_total', + 'counter', + 'Total number of WAL corruptions.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_listener_conn_closed_total', + 'counter', + 'Total number of connections closed that were made to the listener of a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_fsync_duration_seconds', + 'summary', + 'Duration of WAL fsync.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_segment_current', + 'gauge', + 'WAL segment index that TSDB is currently writing to.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_sched_latencies_seconds', + 'histogram', + 'Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_dialer_conn_attempted_total', + 'counter', + 'Total number of connections attempted by the given dialer a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_min_time_seconds', + 'gauge', + 'Minimum time bound of the head block.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_blocks_loaded', + 'gauge', + 'Number of currently loaded data blocks', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_last_gc_time_seconds', + 'gauge', + 'Number of seconds since 1970 of last garbage collection.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_notifications_dropped_total', + 'counter', + 'Total number of alerts dropped due to errors when sending to Alertmanager.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_config_last_reload_success_timestamp_seconds', + 'gauge', + 'Timestamp of the last successful configuration reload.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_remote_storage_highest_timestamp_in_seconds', + 'gauge', + 'Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_rule_evaluation_duration_seconds', + 'summary', + 'The duration for a rule to execute.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_completed_pages_total', + 'counter', + 'Total number of completed pages.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'promhttp_metric_handler_requests_total', + 'counter', + 'Total number of scrapes by HTTP status code.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_notifications_queue_length', + 'gauge', + 'The number of alert notifications in the queue.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_lookups_total', + 'counter', + 'Total number of pointer lookups.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_frees_by_size_bytes_total', + 'histogram', + 'Distribution of freed heap allocations by approximate size. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_checkpoint_deletions_total', + 'counter', + 'Total number of checkpoint deletions attempted.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_alloc_bytes', + 'gauge', + 'Number of bytes allocated and still in use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_sample_out_of_order_total', + 'counter', + 'Total number of samples rejected due to not being out of the expected order.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pools_total', + 'counter', + 'Total number of scrape pool creation attempts.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_exceeded_label_limits_total', + 'counter', + 'Total number of times scrape pools hit the label limits, during sync or config reload.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_checkpoint_deletions_failed_total', + 'counter', + 'Total number of checkpoint deletions that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compactions_failed_total', + 'counter', + 'Total number of compactions that failed for the partition.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_heap_unused_bytes', + 'gauge', + 'Memory that is reserved for heap objects but is not currently used to hold heap objects.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_file_scan_duration_seconds', + 'summary', + 'The duration of the File-SD scan in seconds.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_exceeded_sample_limit_total', + 'counter', + 'Total number of scrapes that hit the sample limit and were rejected.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_cache_flush_forced_total', + 'counter', + 'How many times a scrape cache was flushed due to getting big while scrapes are failing.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_out_of_order_samples_total', + 'counter', + 'Total number of out of order samples ingestion failed attempts.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_cycles_automatic_gc_cycles_total', + 'counter', + 'Count of completed GC cycles generated by the Go runtime.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_idle_bytes', + 'gauge', + 'Number of heap bytes waiting to be used.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_consul_rpc_failures_total', + 'counter', + 'The number of Consul RPC call failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_cycles_forced_gc_cycles_total', + 'counter', + 'Count of completed GC cycles forced by the application.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_sync_total', + 'counter', + 'Total number of syncs that were executed on a scrape pool.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_allocs_bytes_total', + 'counter', + 'Cumulative sum of memory allocated to the heap by the application.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_remote_storage_string_interner_zero_reference_releases_total', + 'counter', + 'The number of times release has been called for strings that are not interned.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_dns_lookup_failures_total', + 'counter', + 'The number of DNS-SD lookup failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_gc_sys_bytes', + 'gauge', + 'Number of bytes used for garbage collection system metadata.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_info', + 'gauge', + 'Information about the Go environment.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_engine_queries', + 'gauge', + 'The current number of queries being executed or waiting.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_consul_rpc_duration_seconds', + 'summary', + 'The duration of a Consul RPC call in seconds.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_size_retentions_total', + 'counter', + 'The number of times that blocks were deleted because the maximum number of bytes was exceeded.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_sync_length_seconds', + 'summary', + 'Actual interval to sync the scrape pool.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_heap_released_bytes', + 'gauge', + "Memory that is completely free and has been returned to the underlying system. This metric is the runtime's estimate of free address space that is still mapped into the process, but is not backed by physical memory.", + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_exceeded_target_limit_total', + 'counter', + 'Total number of times scrape pools hit the target limit, during sync or config reload.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_max_time_seconds', + 'gauge', + 'Maximum timestamp of the head block.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_api_remote_read_queries', + 'gauge', + 'The current number of remote read queries being executed or waiting.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_rule_group_duration_seconds', + 'summary', + 'The duration of rule group evaluations.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compaction_populating_block', + 'gauge', + 'Set to 1 when a block is currently being written to the disk.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_metadata_mcache_free_bytes', + 'gauge', + 'Memory that is reserved for runtime mcache structures, but not in-use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_released_bytes', + 'gauge', + 'Number of heap bytes released to OS.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_truncations_failed_total', + 'counter', + 'Total number of head truncations that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_template_text_expansion_failures_total', + 'counter', + 'The total number of template text expansion failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_chunks_created_total', + 'counter', + 'Total number of chunks created in the head', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_next_gc_bytes', + 'gauge', + 'Number of heap bytes when next garbage collection will take place.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_http_response_size_bytes', + 'histogram', + 'Histogram of response size for HTTP requests.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_metadata_mcache_inuse_bytes', + 'gauge', + 'Memory that is occupied by runtime mcache structures that are currently being used.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_lowest_timestamp_seconds', + 'gauge', + 'Lowest timestamp value stored in the database.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_http_requests_total', + 'counter', + 'Counter of HTTP requests.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_snapshot_replay_error_total', + 'counter', + 'Total number snapshot replays that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'promhttp_metric_handler_requests_in_flight', + 'gauge', + 'Current number of scrapes being served.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_virtual_memory_bytes', + 'gauge', + 'Virtual memory size in bytes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_exceeded_body_size_limit_total', + 'counter', + 'Total number of scrapes that hit the body size limit', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_truncations_failed_total', + 'counter', + 'Total number of WAL truncations that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_engine_query_log_enabled', + 'gauge', + 'State of the query log.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_targets', + 'gauge', + 'Current number of targets in this scrape pool.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_dns_lookups_total', + 'counter', + 'The number of DNS-SD lookups.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_out_of_bound_samples_total', + 'counter', + 'Total number of out of bound samples ingestion failed attempts.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_chunk_write_queue_operations_total', + 'counter', + 'Number of operations on the chunk_write_queue.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_writes_failed_total', + 'counter', + 'Total number of WAL writes that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_metadata_cache_bytes', + 'gauge', + 'The number of bytes that are currently used for storing metric metadata in the cache', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_buck_hash_sys_bytes', + 'gauge', + 'Number of bytes used by the profiling bucket hash table.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_sync_failed_total', + 'counter', + 'Total number of target sync failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_discovered_targets', + 'gauge', + 'Current number of discovered targets.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_series_created_total', + 'counter', + 'Total number of series created in the head', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_active_appenders', + 'gauge', + 'Number of currently active appender transactions', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_symbol_table_size_bytes', + 'gauge', + 'Size of symbol table in memory for loaded blocks', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_received_updates_total', + 'counter', + 'Total number of update events received from the SD providers.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compaction_chunk_samples', + 'histogram', + 'Final number of samples on their first compaction', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_truncations_total', + 'counter', + 'Total number of head truncations attempted.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compactions_triggered_total', + 'counter', + 'Total number of triggered compactions for the partition.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_dialer_conn_established_total', + 'counter', + 'Total number of connections successfully established by the given dialer a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_lowest_timestamp', + 'gauge', + 'Lowest timestamp value stored in the database. The unit is decided by the library consumer.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_sys_bytes', + 'gauge', + 'Number of heap bytes obtained from system.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_tombstone_cleanup_seconds', + 'histogram', + 'The time taken to recompact blocks to remove tombstones.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_metadata_cache_entries', + 'gauge', + 'Total number of metric metadata entries in the cache', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_treecache_watcher_goroutines', + 'gauge', + 'The current number of watcher goroutines.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_objects', + 'gauge', + 'Number of allocated objects.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_mcache_inuse_bytes', + 'gauge', + 'Number of bytes in use by mcache structures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_other_sys_bytes', + 'gauge', + 'Number of bytes used for other system allocations.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_reloads_total', + 'counter', + 'Total number of scrape pool reloads.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_threads', + 'gauge', + 'Number of OS threads created.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_other_bytes', + 'gauge', + 'Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_remote_storage_samples_in_total', + 'counter', + 'Samples in to remote storage, compare to samples out for queue managers.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_exemplar_last_exemplars_timestamp_seconds', + 'gauge', + 'The timestamp of the oldest exemplar stored in circular storage. Useful to check for what timerange the current exemplar buffer limit allows. This usually means the last timestampfor all exemplars for a typical setup. This is not true though if one of the series timestamp is in future compared to rest series.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_config_last_reload_successful', + 'gauge', + 'Whether the last configuration reload attempt was successful.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_allocs_by_size_bytes_total', + 'histogram', + 'Distribution of heap allocations by approximate size. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_alloc_bytes_total', + 'counter', + 'Total number of bytes allocated, even if freed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_series', + 'gauge', + 'Total number of series in the head block.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_kubernetes_events_total', + 'counter', + 'The number of Kubernetes events handled.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_sample_out_of_bounds_total', + 'counter', + 'Total number of samples rejected due to timestamp falling outside of the time bounds.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_storage_blocks_bytes', + 'gauge', + 'The number of bytes that are currently used for local storage by all blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_updates_total', + 'counter', + 'Total number of update events sent to the SD consumers.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_time_retentions_total', + 'counter', + 'The number of times that blocks were deleted because the maximum time limit was exceeded.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_series_removed_total', + 'counter', + 'Total number of series removed in the head', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_truncate_duration_seconds', + 'summary', + 'Duration of WAL truncation.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_frees_objects_total', + 'counter', + 'Cumulative count of heap allocations whose storage was freed by the garbage collector. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_vertical_compactions_total', + 'counter', + 'Total number of compactions done on overlapping blocks.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_goal_bytes', + 'gauge', + 'Heap size target for the end of the GC cycle.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_metadata_mspan_free_bytes', + 'gauge', + 'Memory that is reserved for runtime mspan structures, but not in-use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrapes_exemplar_out_of_order_total', + 'counter', + 'Total number of exemplar rejected due to not being out of the expected order.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_checkpoint_creations_total', + 'counter', + 'Total number of checkpoint creations attempted.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pool_reloads_failed_total', + 'counter', + 'Total number of failed scrape pool reloads.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_notifications_alertmanagers_discovered', + 'gauge', + 'The number of alertmanagers discovered and active.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_notifications_queue_capacity', + 'gauge', + 'The capacity of the alert notifications queue.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_tiny_allocs_objects_total', + 'counter', + 'Count of small allocations that are packed together into blocks. These allocations are counted separately from other allocations because each individual allocation is not tracked by the runtime, only their block. Each block is already accounted for in allocs-by-size and frees-by-size.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compaction_duration_seconds', + 'histogram', + 'Duration of compaction runs', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_web_federation_warnings_total', + 'counter', + 'Total number of warnings that occurred while sending federation responses.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_start_time_seconds', + 'gauge', + 'Start time of the process since unix epoch in seconds.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_heap_alloc_bytes', + 'gauge', + 'Number of heap bytes allocated and still in use.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_mspan_inuse_bytes', + 'gauge', + 'Number of bytes in use by mspan structures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_heap_objects_bytes', + 'gauge', + 'Memory occupied by live objects and dead objects that have not yet been marked free by the garbage collector.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_template_text_expansions_total', + 'counter', + 'The total number of template text expansions.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_sys_bytes', + 'gauge', + 'Number of bytes obtained from system.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_heap_free_bytes', + 'gauge', + 'Memory that is completely free and eligible to be returned to the underlying system, but has not been. This metric is the runtime\'s estimate of free address space that is backed by physical memory.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_chunks_removed_total', + 'counter', + 'Total number of chunks removed in the head', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_compactions_skipped_total', + 'counter', + 'Total number of skipped compactions due to disabled auto compaction.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_kuma_fetch_skipped_updates_total', + 'counter', + 'The number of Kuma MADS fetch calls that result in no updates to the targets.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_scrape_pools_failed_total', + 'counter', + 'Total number of scrape pool creations that failed.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_gc_cpu_fraction', + 'gauge', + 'The fraction of this program\'s available CPU time used by the GC since the program started.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_clean_start', + 'gauge', + '-1: lockfile is disabled. 0: a lockfile from a previous execution was replaced. 1: lockfile creation was clean', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_wal_truncations_total', + 'counter', + 'Total number of WAL truncations attempted.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_target_interval_length_seconds', + 'summary', + 'Actual intervals between scrapes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_retention_limit_bytes', + 'gauge', + 'Max number of bytes to be retained in the tsdb blocks, configured 0 means disabled', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_sched_goroutines_goroutines', + 'gauge', + 'Count of live goroutines.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_cpu_seconds_total', + 'counter', + 'Total user and system CPU time spent in seconds.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_metadata_other_bytes', + 'gauge', + 'Memory that is reserved for or used to hold runtime metadata.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_total_bytes', + 'gauge', + 'All memory mapped by the Go runtime into the current process as read-write. Note that this does not include memory mapped by code called via cgo or via the syscall package. Sum of all metrics in /memory/classes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_pauses_seconds_total', + 'histogram', + 'Distribution individual GC-related stop-the-world pause latencies.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_cycles_total_gc_cycles_total', + 'counter', + 'Count of all completed GC cycles.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_failed_configs', + 'gauge', + 'Current number of service discovery configurations that failed to load.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memstats_stack_inuse_bytes', + 'gauge', + 'Number of bytes in use by the stack allocator.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_memory_classes_os_stacks_bytes', + 'gauge', + 'Stack memory allocated by the underlying operating system.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_engine_query_log_failures_total', + 'counter', + 'The number of query log failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_goroutines', + 'gauge', + 'Number of goroutines that currently exist.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_reloads_failures_total', + 'counter', + 'Number of times the database failed to reloadBlocks block data from disk.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_samples_appended_total', + 'counter', + 'Total number of appended samples.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'net_conntrack_listener_conn_accepted_total', + 'counter', + 'Total number of connections opened to the listener of a given name.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'process_virtual_memory_max_bytes', + 'gauge', + 'Maximum amount of virtual memory available in bytes.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'go_gc_heap_frees_bytes_total', + 'counter', + 'Cumulative sum of heap memory freed by the garbage collector.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_sd_kuma_fetch_failures_total', + 'counter', + 'The number of Kuma MADS fetch call failures.', + null, + null, + null, + null, + null + ], + [ + 'catalog', + null, + 'prometheus_tsdb_head_series_not_found_total', + 'counter', + 'Total number of requests for series that were not found.', + null, + null, + null, + null, + null + ] + ], + 'total': 199, + 'size': 199 +} \ No newline at end of file diff --git a/dashboards-observability/public/components/metrics/sidebar/sidebar.scss b/dashboards-observability/public/components/metrics/sidebar/sidebar.scss new file mode 100644 index 000000000..92274afdd --- /dev/null +++ b/dashboards-observability/public/components/metrics/sidebar/sidebar.scss @@ -0,0 +1,145 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + + .dscSidebar__container { + padding-left: 0 !important; + padding-right: 0 !important; + background-color: transparent; + border-right-color: transparent; + border-bottom-color: transparent; +} + +.dscIndexPattern__container { + display: flex; + align-items: center; + height: $euiSize * 3; + margin-top: -$euiSizeS; +} + +.dscIndexPattern__triggerButton { + @include euiTitle('xs'); + line-height: $euiSizeXXL; +} + +.dscFieldList { + list-style: none; + margin-bottom: 0; +} + +.dscFieldListHeader { + padding: $euiSizeS $euiSizeS 0 $euiSizeS; + background-color: lightOrDarkTheme(tint($euiColorPrimary, 90%), $euiColorLightShade); +} + +.dscFieldList--popular { + background-color: lightOrDarkTheme(tint($euiColorPrimary, 90%), $euiColorLightShade); +} + +.dscFieldChooser__toggle { + color: $euiColorMediumShade; + margin-left: $euiSizeS !important; +} + +/** + * 1. Only visually hide the action, so that it's still accessible to screen readers. + * 2. When tabbed to, this element needs to be visible for keyboard accessibility. + */ +.dscSidebarItem__action { + opacity: 0; /* 1 */ + transition: none; + + &:focus { + opacity: 1; /* 2 */ + } + font-size: $euiFontSizeXS; + padding: 2px 6px !important; + height: 22px !important; + min-width: auto !important; + .euiButton__content { + padding: 0 4px; + } +} + +.dscFieldSearch { + padding: $euiSizeS; +} + +.dscFieldSearch__toggleButton { + width: calc(100% - #{$euiSizeS}); + color: $euiColorPrimary; + padding-left: $euiSizeXS; + margin-left: $euiSizeXS; +} + +.dscFieldSearch__filterWrapper { + flex-grow: 0; +} + +.dscFieldSearch__formWrapper { + padding: $euiSizeM; +} + +.dscFieldDetails { + color: $euiTextColor; + margin-bottom: $euiSizeS; +} + +.dscSidebarItem__fieldPopoverPanel { + min-width: 300px; + max-width: 600px; + max-height: 600px; + overflow-y: scroll; +} + +.override_timestamp_loading { + vertical-align: middle; +} + +.explorerFieldSelector { + padding: $euiSizeS; +} + +#vis__mainContent { + .explorer__insights { + min-height: 0; + display: grid; + grid-template-columns: 50% 50%; + height: 100%; + .explorerFieldSelector, .explorer__vizDataConfig { + padding: $euiSizeS; + overflow: auto; + + &__fieldGroups { + @include euiYScrollWithShadows; + + overflow-y: auto; + margin-right: -$euiSizeS; + padding-right: $euiSizeS; + margin-top: $euiSizeS; + } + + &__fieldGroup { + margin-top: $euiSizeS; + + &:first-child { + margin-top: 0; + } + } + } + .explorerFieldSelector { + @include euiYScrollWithShadows; + .sidebar-list { + height: 100%; + } + } + } +} + +.sidebarHeight { + // @include euiYScrollWithShadows; + line-height:normal; + overflow:auto; + max-height:100vh; +} diff --git a/dashboards-observability/public/components/metrics/sidebar/sidebar.tsx b/dashboards-observability/public/components/metrics/sidebar/sidebar.tsx index 312e2fc5b..8eebfa11f 100644 --- a/dashboards-observability/public/components/metrics/sidebar/sidebar.tsx +++ b/dashboards-observability/public/components/metrics/sidebar/sidebar.tsx @@ -3,25 +3,80 @@ * SPDX-License-Identifier: Apache-2.0 */ +import './sidebar.scss'; + import React, { useState } from 'react'; -import { isEmpty } from 'lodash'; -import { EuiTitle, EuiSpacer, EuiFieldSearch, EuiAccordion } from '@elastic/eui'; +import { cloneDeep } from 'lodash'; +import { EuiTitle, EuiSpacer, EuiAccordion, EuiLink } from '@elastic/eui'; import { I18nProvider } from '@osd/i18n/react'; +import { batch, useDispatch } from 'react-redux'; +import { AVAILABLE_METRICS, SELECTED_METRICS } from '../../../../common/constants/metrics'; +import { updateMetrics, sortMetrics, selectMetrics } from '../redux/slices/metrics_slice'; interface ISidebarProps { - // recentlyCreatedFields: any; - // selectedFields: any; - // availableFields: any; + metricsList: any; + visualizationsList: any; } export const Sidebar = (props: ISidebarProps) => { - // const { recentlyCreatedFields } = props; + const dispatch = useDispatch(); + + // Initializing sidebar with dummy data + const { metricsList, visualizationsList } = props; + const metricNames = metricsList.metrics; const [showFields, setShowFields] = useState(false); const [searchTerm, setSearchTerm] = useState(''); + /** + * Toggle metric names between selected and available sets + * @param metric metric to be toggled + * @param MetricSetToRemove set where this metric needs to be removed from + * @param MetricSetToAdd set where this metric needs to be added to + */ + const toggleMetrics = ( + metric: any, + visualization: boolean, + MetricSetToRemove: string, + MetricSetToAdd: string + ) => { + const nextMetrics = cloneDeep(metricsList); + const thisMetricSet = nextMetrics.metrics[MetricSetToRemove]; + // Dummy data for now, will globalize the filter later + // If statements are to separate visualizations and dummy data from prometheus + let nextMetricSet; + if (visualization) { + nextMetricSet = thisMetricSet.filter((row: any) => row.name !== metric.name); + } else { + nextMetricSet = thisMetricSet.filter((row: any) => row[2] !== metric[2]); + } + nextMetrics.metrics[MetricSetToRemove] = nextMetricSet; + if (!visualization || MetricSetToRemove !== SELECTED_METRICS) { + nextMetrics.metrics[MetricSetToAdd].push(metric); + } + batch(() => { + dispatch( + updateMetrics({ + data: { ...nextMetrics.metrics }, + }) + ); + dispatch( + sortMetrics({ + data: [MetricSetToAdd], + }) + ); + }); + }; + + const handleAddMetric = (metric: any, visualization: boolean) => + toggleMetrics(metric, visualization, AVAILABLE_METRICS, SELECTED_METRICS); + + const handleRemoveMetric = (metric: any, visualization: boolean) => { + toggleMetrics(metric, visualization, SELECTED_METRICS, AVAILABLE_METRICS); + }; + return ( -
+
{ Selected Metrics } - /> + paddingSize="xs" + > +
    + {metricNames[SELECTED_METRICS].map((metric: any) => { + let name; + if (metric.name) { + name = metric.name; + } else { + name = metric[2]; + } + return ( +
  • + { + if (metric.name) { + handleRemoveMetric(metric, true); + } else { + handleRemoveMetric(metric, false); + } + }} + > + {name} + +
  • + ); + })} +
+
+ Available Metrics } - /> + paddingSize="xs" + > +
    + {visualizationsList.map((visualization: any) => { + return ( +
  • + { + handleAddMetric(visualization, true); + }} + > + {visualization.name} + +
  • + ); + })} + {metricNames[AVAILABLE_METRICS].map((metric: any) => { + return ( +
  • + { + handleAddMetric(metric, false); + }} + > + {metric[2]} + +
  • + ); + })} +
+
); diff --git a/dashboards-observability/public/components/metrics/view/empty_view.tsx b/dashboards-observability/public/components/metrics/view/empty_view.tsx index f67b6e1a4..a495e2d8c 100644 --- a/dashboards-observability/public/components/metrics/view/empty_view.tsx +++ b/dashboards-observability/public/components/metrics/view/empty_view.tsx @@ -9,20 +9,17 @@ import './empty_view.scss'; export const EmptyMetricsView = () => { return ( -
- -
- - - -

No Metrics Selected

- - - Select a metric from the left sidepanel to view results. - -
-
-
+
+ + + + +

No Metrics Selected

+ + + Select a metric from the left sidepanel to view results. + +
); }; diff --git a/dashboards-observability/public/framework/redux/reducers/index.ts b/dashboards-observability/public/framework/redux/reducers/index.ts index 1dfcf743c..61f44f584 100644 --- a/dashboards-observability/public/framework/redux/reducers/index.ts +++ b/dashboards-observability/public/framework/redux/reducers/index.ts @@ -12,6 +12,7 @@ import FieldsReducer from '../../../components/event_analytics/redux/slices/fiel import countDistributionReducer from '../../../components/event_analytics/redux/slices/count_distribution_slice'; import explorerVisualizationReducer from '../../../components/event_analytics/redux/slices/visualization_slice'; import explorerVisualizationConfigReducer from '../../../components/event_analytics/redux/slices/viualization_config_slice'; +import metricsReducers from '../../../components/metrics/redux/slices/metrics_slice'; const rootReducer = combineReducers({ // explorer reducers @@ -22,6 +23,7 @@ const rootReducer = combineReducers({ countDistribution: countDistributionReducer, explorerVisualization: explorerVisualizationReducer, explorerVisualizationConfig: explorerVisualizationConfigReducer, + metrics: metricsReducers, }); export type RootState = ReturnType;