Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .buildkite/scripts/steps/artifacts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -euo pipefail

RELEASE_BUILD="${RELEASE_BUILD:="false"}"
VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"
RELEASE_BUILD="true"
VERSION_QUALIFIER=""

BASE_VERSION="$(jq -r '.version' package.json)"

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@
"@kbn/index-management-plugin": "link:x-pack/plugins/index_management",
"@kbn/index-management-shared-types": "link:x-pack/packages/index-management/index_management_shared_types",
"@kbn/index-patterns-test-plugin": "link:test/plugin_functional/plugins/index_patterns",
"@kbn/inference_integration_flyout": "link:x-pack/packages/ml/inference_integration_flyout",
"@kbn/inference-common": "link:x-pack/packages/ai-infra/inference-common",
"@kbn/inference-plugin": "link:x-pack/plugins/inference",
"@kbn/inference_integration_flyout": "link:x-pack/packages/ml/inference_integration_flyout",
"@kbn/infra-forge": "link:x-pack/packages/kbn-infra-forge",
"@kbn/infra-plugin": "link:x-pack/plugins/observability_solution/infra",
"@kbn/ingest-pipelines-plugin": "link:x-pack/plugins/ingest_pipelines",
Expand Down Expand Up @@ -1125,6 +1125,7 @@
"expiry-js": "0.1.7",
"exponential-backoff": "^3.1.1",
"extract-zip": "^2.0.1",
"fast-content-type-parse": "^3.0.0",
"fast-deep-equal": "^3.1.3",
"fast-glob": "^3.3.2",
"fastest-levenshtein": "^1.0.12",
Expand Down Expand Up @@ -1843,4 +1844,4 @@
"zod-to-json-schema": "^3.23.0"
},
"packageManager": "yarn@1.22.21"
}
}
5 changes: 1 addition & 4 deletions src/dev/build/lib/version_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ type ResolvedType<T extends Promise<any>> = T extends Promise<infer X> ? X : nev
export type VersionInfo = ResolvedType<ReturnType<typeof getVersionInfo>>;

export async function getVersionInfo({ isRelease, versionQualifier, pkg }: Options) {
const buildVersion = pkg.version.concat(
versionQualifier ? `-${versionQualifier}` : '',
isRelease ? '' : '-SNAPSHOT'
);
const buildVersion = pkg.version;

const buildSha = fs.existsSync(join(REPO_ROOT, '.git'))
? (await execa('git', ['rev-parse', 'HEAD'], { cwd: REPO_ROOT })).stdout
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/download_cloud_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const DownloadCloudDependencies: Task = {
description: 'Downloading cloud dependencies',

async run(config, log, build) {
const subdomain = config.isRelease ? 'artifacts-staging' : 'artifacts-snapshot';
const subdomain = 'artifacts-staging';

const downloadBeat = async (beat: string, id: string) => {
const version = config.getBuildVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const getCustomMetricLabel = (metric: SnapshotCustomMetricInput) => {
defaultMessage: 'Rate of {field}',
values: { field: metric.field },
}),
last_value: i18n.translate('xpack.infra.waffle.aggregationNames.last_value', {
defaultMessage: 'Last value of {field}',
values: { field: metric.field },
}),
};
return metric.label ? metric.label : METRIC_LABELS[metric.aggregation];
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const METRIC_EXPLORER_AGGREGATIONS = [
'p95',
'p99',
'custom',
'last_value',
] as const;

export const OMITTED_AGGREGATIONS_FOR_CUSTOM_METRICS = ['custom', 'rate', 'p95', 'p99'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const SnapshotNamedMetricInputRT = rt.type({
type: SnapshotMetricTypeRT,
});

export const SNAPSHOT_CUSTOM_AGGREGATIONS = ['avg', 'max', 'min', 'rate'] as const;
export const SNAPSHOT_CUSTOM_AGGREGATIONS = ['avg', 'max', 'min', 'rate', 'last_value'] as const;

export type SnapshotCustomAggregation = (typeof SNAPSHOT_CUSTOM_AGGREGATIONS)[number];

Expand Down Expand Up @@ -108,9 +108,9 @@ export const SnapshotRequestRT = rt.intersection([
groupBy: rt.union([SnapshotGroupByRT, rt.null]),
nodeType: ItemTypeRT,
sourceId: rt.string,
includeTimeseries: rt.union([rt.boolean, createLiteralValueFromUndefinedRT(true)]),
}),
rt.partial({
includeTimeseries: rt.union([rt.boolean, createLiteralValueFromUndefinedRT(false)]),
accountId: rt.string,
region: rt.string,
filterQuery: rt.union([rt.string, rt.null]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,29 @@ export const inventoryColorPaletteRT = rt.keyof({
negative: null,
});

const inventoryLegendOptionsRT = rt.type({
palette: inventoryColorPaletteRT,
steps: inRangeRt(2, 18),
reverseColors: rt.boolean,
const inventoryLegendTypeRT = rt.keyof({
gradient: null,
steps: null,
});

const inventoryLegendStepRT = rt.type({
color: rt.string,
value: rt.number,
label: rt.string,
});

const inventoryLegendOptionsRT = rt.intersection([
rt.type({
palette: inventoryColorPaletteRT,
steps: inRangeRt(2, 18),
reverseColors: rt.boolean,
}),
rt.partial({
type: inventoryLegendTypeRT,
rules: rt.array(inventoryLegendStepRT),
}),
]);

export const inventorySortOptionRT = rt.type({
by: rt.keyof({ name: null, value: null }),
direction: rt.keyof({ asc: null, desc: null }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { i18n } from '@kbn/i18n';
import { mapValues } from 'lodash';
import type { InventoryItemType, SnapshotMetricType } from '@kbn/metrics-data-access-plugin/common';
import type { SnapshotCustomAggregation } from './http_api/snapshot_api';

// Lowercase versions of all metrics, for when they need to be used in the middle of a sentence;
// these may need to be translated differently depending on language, e.g. still capitalizing "CPU"
Expand Down Expand Up @@ -282,3 +283,21 @@ export const toMetricOpt = (
};
}
};

export const AGGREGATION_LABELS: Record<SnapshotCustomAggregation, string> = {
['avg']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.avg', {
defaultMessage: 'Average',
}),
['max']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.max', {
defaultMessage: 'Max',
}),
['min']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.min', {
defaultMessage: 'Min',
}),
['rate']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.rate', {
defaultMessage: 'Rate',
}),
['last_value']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLabels.lastValue', {
defaultMessage: 'Last value',
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const ExpressionChart: React.FC<Props> = ({
accountId,
region,
timerange,
includeTimeseries: true,
});

const metric = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
SnapshotCustomMetricInputRT,
SNAPSHOT_CUSTOM_AGGREGATIONS,
} from '../../../../common/http_api/snapshot_api';

import { AGGREGATION_LABELS } from '../../../../common/snapshot_metric_i18n';
interface Props {
metric?: { value: string; text: string };
metrics: Array<{ value: string; text: string }>;
Expand Down Expand Up @@ -68,22 +68,8 @@ const V2ToLegacyMapping: Record<V2MetricType, string> = {
cpuV2: 'cpu',
};

const AGGREGATION_LABELS = {
['avg']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.avg', {
defaultMessage: 'Average',
}),
['max']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.max', {
defaultMessage: 'Max',
}),
['min']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.min', {
defaultMessage: 'Min',
}),
['rate']: i18n.translate('xpack.infra.waffle.customMetrics.aggregationLables.rate', {
defaultMessage: 'Rate',
}),
};
const aggregationOptions = SNAPSHOT_CUSTOM_AGGREGATIONS.map((k) => ({
text: AGGREGATION_LABELS[k as SnapshotCustomAggregation],
text: AGGREGATION_LABELS[k],
value: k,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ export const PALETTES = {
export const StepRuleRT = rt.intersection([
rt.type({
value: rt.number,
operator: OperatorRT,
color: rt.string,
}),
rt.partial({ label: rt.string }),
rt.partial({ label: rt.string, operator: OperatorRT }),
]);

export const StepLegendRT = rt.type({
type: rt.literal('step'),
type: rt.literal('steps'),
rules: rt.array(StepRuleRT),
});
export type InfraWaffleMapStepRule = rt.TypeOf<typeof StepRuleRT>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ export const Layout = React.memo(({ currentView, reload, interval, nodes, loadin
const { currentTime, jumpToTime, isAutoReloading } = useWaffleTimeContext();
const { applyFilterQuery } = useWaffleFiltersContext();
const legendPalette = legend?.palette ?? DEFAULT_LEGEND.palette;
const legendRules = legend?.rules ?? DEFAULT_LEGEND.rules;
const legendSteps = legend?.steps ?? DEFAULT_LEGEND.steps;
const legendReverseColors = legend?.reverseColors ?? DEFAULT_LEGEND.reverseColors;

const legendType = legend?.type ?? 'gradient';
const AUTO_REFRESH_INTERVAL = 5 * 1000;

const options = {
formatter: InfraFormatterType.percent,
formatTemplate: '{{value}}',
legend: createLegend(legendPalette, legendSteps, legendReverseColors),
legend: createLegend(legendPalette, legendSteps, legendReverseColors, legendRules, legendType),
metric,
sort,
groupBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ describe('ConditionalToolTip', () => {
groupBy: [],
nodeType: 'host',
sourceId: 'default',
includeTimeseries: true,
currentTime,
accountId: '',
region: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const ConditionalToolTip = ({ node, nodeType, currentTime }: Props) => {
currentTime: requestCurrentTime.current,
accountId: '',
region: '',
includeTimeseries: true,
});

const dataNode = first(nodes);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import type { Meta, StoryObj } from '@storybook/react';
import { LegendControls } from './legend_controls';

const meta = {
component: LegendControls,
title: 'Waffle Map/Legend controls',
} satisfies Meta<typeof LegendControls>;
export default meta;
type Story = StoryObj<typeof meta>;

export const Basic: Story = {
args: {
options: {
palette: 'cool',
reverseColors: false,
steps: 10,
},
dataBounds: {
min: 0,
max: 0.0637590382345481,
},
bounds: {
min: 0,
max: 0.0637590382345481,
},
autoBounds: true,
boundsOverride: {
max: 1,
min: 0,
},
onChange: () => {},
},
};
Loading