Skip to content

Commit

Permalink
Merge branch 'main' into fix-127802
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Apr 29, 2022
2 parents 0b61084 + 3b07ec6 commit 91fd4f8
Show file tree
Hide file tree
Showing 86 changed files with 2,115 additions and 1,380 deletions.
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/steps/checks/commit/commit.sh
.buildkite/scripts/steps/checks/bazel_packages.sh
.buildkite/scripts/steps/checks/telemetry.sh
.buildkite/scripts/steps/checks/validate_ci_groups.sh
.buildkite/scripts/steps/checks/ts_projects.sh
.buildkite/scripts/steps/checks/jest_configs.sh
.buildkite/scripts/steps/checks/doc_api_changes.sh
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/steps/checks/validate_ci_groups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

source .buildkite/scripts/common/util.sh

echo --- Ensure that all tests are in a CI Group
checks-reporter-with-killswitch "Ensure that all tests are in a CI Group" \
node scripts/ensure_all_tests_in_ci_group
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
"brace": "0.11.1",
"broadcast-channel": "^4.11.0",
"broadcast-channel": "4.10.0",
"canvg": "^3.0.9",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
Expand Down Expand Up @@ -249,7 +249,7 @@
"deep-freeze-strict": "^1.1.1",
"deepmerge": "^4.2.2",
"del": "^5.1.0",
"elastic-apm-node": "^3.31.0",
"elastic-apm-node": "^3.32.0",
"email-addresses": "^5.0.0",
"execa": "^4.0.2",
"exit-hook": "^2.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as InputMode from '../../models/legacy_core_editor/mode/input';
const inputMode = new InputMode.Mode();
import * as editor from '../../models/legacy_core_editor';
import { applyCurrentSettings } from '../editor/legacy/console_editor/apply_editor_settings';
import { formatRequestBodyDoc } from '../../../lib/utils';

interface Props {
settings: DevToolsSettings;
Expand All @@ -41,7 +42,9 @@ export function HistoryViewer({ settings, req }: Props) {
if (viewerRef.current) {
const { current: viewer } = viewerRef;
if (req) {
const s = req.method + ' ' + req.endpoint + '\n' + (req.data || '');
const indent = true;
const formattedData = req.data ? formatRequestBodyDoc([req.data], indent).data : '';
const s = req.method + ' ' + req.endpoint + '\n' + formattedData;
viewer.update(s, inputMode);
viewer.clearSelection();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import RowParser from '../../../lib/row_parser';
import { ESRequest } from '../../../types';
import { SenseEditor } from '../../models/sense_editor';
import { formatRequestBodyDoc } from '../../../lib/utils';

export function restoreRequestFromHistory(editor: SenseEditor, req: ESRequest) {
const coreEditor = editor.getCoreEditor();
Expand All @@ -32,7 +33,9 @@ export function restoreRequestFromHistory(editor: SenseEditor, req: ESRequest) {

let s = prefix + req.method + ' ' + req.endpoint;
if (req.data) {
s += '\n' + req.data;
const indent = true;
const formattedData = formatRequestBodyDoc([req.data], indent);
s += '\n' + formattedData.data;
}

s += suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { convertIntervalToUnit } from '../../helpers/unit_to_seconds';
import { getLastMetric } from '../../helpers/get_last_metric';
import { SERIES_SEPARATOR } from '../../../../../common/constants';

const percentileValueMatch = /\[([0-9\.]+)\]$/;
Expand All @@ -16,7 +17,7 @@ import { evaluate } from '@kbn/tinymath';

export function mathAgg(resp, panel, series, meta, extractFields) {
return (next) => async (results) => {
const mathMetric = last(series.metrics);
const mathMetric = getLastMetric(series);
if (mathMetric.type !== 'math') return next(results);
// Filter the results down to only the ones that match the series.id. Sometimes
// there will be data from other series mixed in.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,33 @@ describe('math(resp, panel, series)', () => {
});
});

test('handles math even if there is a series agg', async () => {
series.metrics.push({
id: 'myid',
type: 'series_agg',
function: 'sum',
});
const next = await mathAgg(resp, panel, series)((results) => results);
const results = await stdMetric(resp, panel, series)(next)([]);

expect(results).toHaveLength(1);

expect(results[0]).toEqual({
id: 'test╰┄►example-01',
label: 'example-01',
color: 'rgb(255, 0, 0)',
stack: false,
seriesId: 'test',
lines: { show: true, fill: 0, lineWidth: 1, steps: false },
points: { show: true, radius: 1, lineWidth: 1 },
bars: { fill: 0, lineWidth: 1, show: false },
data: [
[1, 2],
[2, 1],
],
});
});

test('turns division by zero into null values', async () => {
resp.aggregations.test.buckets[0].timeseries.buckets[0].mincpu = 0;
const next = await mathAgg(resp, panel, series)((results) => results);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.maps.showMapsInspectorAdapter (boolean)',
'xpack.observability.unsafe.alertingExperience.enabled (boolean)',
'xpack.observability.unsafe.cases.enabled (boolean)',
'xpack.observability.unsafe.overviewNext.enabled (boolean)',
'xpack.observability.unsafe.rules.enabled (boolean)',
'xpack.osquery.actionEnabled (boolean)',
'xpack.osquery.packs (boolean)',
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The following table describes the properties of the `options` object.

### Executor

This is the primary function for a rule type. Whenever the rule needs to execute, this function will perform the execution. It receives a variety of parameters. The following table describes the properties the executor receives.
This is the primary function for a rule type. Whenever the rule needs to execute, this function will perform the execution. This function is for running a custom query that returns documents meeting a condition and report them to the framework using the `services.alertFactory`. The function receives a variety of parameters. The following table describes the properties the executor receives.

**executor(options)**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,27 @@ const AgentPolicyLogsNotEnabledCallout: React.FunctionComponent<{ agentPolicy: A
/>
}
>
<FormattedMessage
id="xpack.fleet.agentLogs.logDisabledCallOutDescription"
defaultMessage="Update the agent's policy {settingsLink} to enable logs collection."
values={{
settingsLink: (
<EuiLink
href={getHref('policy_details', {
policyId: agentPolicy.id,
tabId: 'settings',
})}
>
<FormattedMessage
id="xpack.fleet.agentLogs.settingsLink"
defaultMessage="settings"
/>
</EuiLink>
),
}}
/>
{agentPolicy.is_managed ? null : (
<FormattedMessage
id="xpack.fleet.agentLogs.logDisabledCallOutDescription"
defaultMessage="Update the agent's policy {settingsLink} to enable logs collection."
values={{
settingsLink: (
<EuiLink
href={getHref('policy_details', {
policyId: agentPolicy.id,
tabId: 'settings',
})}
>
<FormattedMessage
id="xpack.fleet.agentLogs.settingsLink"
defaultMessage="settings"
/>
</EuiLink>
),
}}
/>
)}
</EuiCallOut>
</EuiFlexItem>
);
Expand Down Expand Up @@ -278,9 +280,9 @@ export const AgentLogsUI: React.FunctionComponent<AgentLogsProps> = memo(

return (
<WrapperFlexGroup direction="column" gutterSize="m">
{agentPolicy &&
!agentPolicy.monitoring_enabled?.includes('logs') &&
!agentPolicy.is_managed && <AgentPolicyLogsNotEnabledCallout agentPolicy={agentPolicy} />}
{agentPolicy && !agentPolicy.monitoring_enabled?.includes('logs') && (
<AgentPolicyLogsNotEnabledCallout agentPolicy={agentPolicy} />
)}
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="m">
<EuiFlexItem>
Expand Down
Loading

0 comments on commit 91fd4f8

Please sign in to comment.