Skip to content

Commit

Permalink
Merge branch 'main' into Trace-waterfall-is-not-cleared-when-there-ar…
Browse files Browse the repository at this point in the history
…e-no-results
  • Loading branch information
achyutjhunjhunwala committed Aug 9, 2023
2 parents d3eaa51 + b59af8b commit 2ec1cb7
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 35 deletions.
13 changes: 1 addition & 12 deletions test/functional/apps/visualize/group6/_tsvb_tsdb_basic.ts
Expand Up @@ -17,8 +17,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/163454
describe.skip('visual builder tsdb check', function describeIndexTests() {
describe('visual builder tsdb check', function describeIndexTests() {
before(async () => {
log.info(`loading sample TSDB index...`);
await esArchiver.load('test/functional/fixtures/es_archiver/kibana_sample_data_logs_tsdb');
Expand Down Expand Up @@ -62,15 +61,5 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(isFieldForAggregationValid).to.be(true);
expect(await testSubjects.exists('visualization-error-text')).to.be(false);
});

it('should show an error when using an unsupported tsdb field type', async () => {
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes_counter');
// this is still returning true
const isFieldForAggregationValid = await visualBuilder.checkFieldForAggregationValidity();
expect(isFieldForAggregationValid).to.be(true);
// but an error should appear in visualization
expect(await testSubjects.exists('visualization-error-text')).to.be(true);
});
});
}
Expand Up @@ -11,6 +11,7 @@ import {
diskIOWrite,
diskReadThroughput,
diskWriteThroughput,
diskSpaceAvailability,
diskSpaceAvailable,
diskSpaceUsage,
logRate,
Expand All @@ -28,6 +29,7 @@ export const hostLensFormulas = {
diskIOWrite,
diskReadThroughput,
diskWriteThroughput,
diskSpaceAvailability,
diskSpaceAvailable,
diskSpaceUsage,
hostCount,
Expand Down
Expand Up @@ -9,7 +9,7 @@ import type { FormulaConfig } from '../../../types';

export const diskReadThroughput: FormulaConfig = {
label: 'Disk Read Throughput',
value: "counter_rate(max(system.diskio.read.count), kql='system.diskio.read.count: *')",
value: "counter_rate(max(system.diskio.read.bytes), kql='system.diskio.read.bytes: *')",
format: {
id: 'bytes',
params: {
Expand Down
@@ -0,0 +1,19 @@
/*
* 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 { FormulaConfig } from '../../../types';

export const diskSpaceAvailability: FormulaConfig = {
label: 'Disk Space Availability',
value: '1 - average(system.filesystem.used.pct)',
format: {
id: 'percent',
params: {
decimals: 0,
},
},
};
Expand Up @@ -9,7 +9,7 @@ import type { FormulaConfig } from '../../../types';

export const diskWriteThroughput: FormulaConfig = {
label: 'Disk Write Throughput',
value: "counter_rate(max(system.diskio.write.count), kql='system.diskio.write.count: *')",
value: "counter_rate(max(system.diskio.write.bytes), kql='system.diskio.write.bytes: *')",
format: {
id: 'bytes',
params: {
Expand Down
Expand Up @@ -10,6 +10,7 @@ export { diskIORead } from './disk_read_iops';
export { diskIOWrite } from './disk_write_iops';
export { diskReadThroughput } from './disk_read_throughput';
export { diskWriteThroughput } from './disk_write_throughput';
export { diskSpaceAvailability } from './disk_space_availability';
export { diskSpaceAvailable } from './disk_space_available';
export { diskSpaceUsage } from './disk_space_usage';
export { hostCount } from './host_count';
Expand Down
Expand Up @@ -126,7 +126,7 @@ const CHARTS_IN_ORDER: Array<
}),
},
{
...hostLensFormulas.diskSpaceAvailable,
...hostLensFormulas.diskSpaceAvailability,
label: i18n.translate(
'xpack.infra.assetDetails.metricsCharts.diskSpace.label.available',
{
Expand Down Expand Up @@ -163,13 +163,13 @@ const CHARTS_IN_ORDER: Array<
{
data: [
{
...hostLensFormulas.diskReadThroughput,
...hostLensFormulas.diskIORead,
label: i18n.translate('xpack.infra.assetDetails.metricsCharts.metric.label.read', {
defaultMessage: 'Read',
}),
},
{
...hostLensFormulas.diskWriteThroughput,
...hostLensFormulas.diskIOWrite,
label: i18n.translate('xpack.infra.assetDetails.metricsCharts.metric.label.write', {
defaultMessage: 'Write',
}),
Expand All @@ -195,13 +195,13 @@ const CHARTS_IN_ORDER: Array<
{
data: [
{
...hostLensFormulas.diskIORead,
...hostLensFormulas.diskReadThroughput,
label: i18n.translate('xpack.infra.assetDetails.metricsCharts.metric.label.read', {
defaultMessage: 'Read',
}),
},
{
...hostLensFormulas.diskIOWrite,
...hostLensFormulas.diskWriteThroughput,
label: i18n.translate('xpack.infra.assetDetails.metricsCharts.metric.label.write', {
defaultMessage: 'Write',
}),
Expand Down
Expand Up @@ -25,4 +25,4 @@ const Template: ComponentStory<typeof Component> = (props: Props) => (
);

export const Default = Template.bind({});
Default.args = { activeAlerts: { count: 2, ruleIds: ['rule-1', 'rule-2'] } };
Default.args = { activeAlerts: { count: 2 } };
Expand Up @@ -19,7 +19,6 @@ interface Params {

export interface ActiveAlerts {
count: number;
ruleIds: string[];
}

type ActiveAlertsMap = Record<SloId, ActiveAlerts>;
Expand All @@ -37,7 +36,6 @@ interface FindApiResponse {
buckets: Array<{
key: string;
doc_count: number;
perRuleId: { buckets: Array<{ key: string; doc_count: number }> };
}>;
};
};
Expand Down Expand Up @@ -77,20 +75,22 @@ export function useFetchActiveAlerts({ sloIds = [] }: Params): UseFetchActiveAle
},
},
],
should: [
{
terms: {
'kibana.alert.rule.parameters.sloId': sloIds,
},
},
],
minimum_should_match: 1,
},
},
aggs: {
perSloId: {
terms: {
size: sloIds.length,
field: 'kibana.alert.rule.parameters.sloId',
},
aggs: {
perRuleId: {
terms: {
field: 'kibana.alert.rule.uuid',
},
},
},
},
},
}),
Expand All @@ -102,7 +102,6 @@ export function useFetchActiveAlerts({ sloIds = [] }: Params): UseFetchActiveAle
...acc,
[bucket.key]: {
count: bucket.doc_count ?? 0,
ruleIds: bucket.perRuleId.buckets.map((rule) => rule.key),
} as ActiveAlerts,
}),
{}
Expand Down
Expand Up @@ -87,7 +87,11 @@ export function SloSummary({ slo, historicalSummary = [], historicalSummaryLoadi
defaultMessage: 'Budget remaining',
})}
textAlign="right"
title={numeral(errorBudgetRemaining).format(percentFormat)}
title={
slo.summary.status === 'NO_DATA'
? NOT_AVAILABLE_LABEL
: numeral(errorBudgetRemaining).format(percentFormat)
}
titleColor={titleColor}
titleSize="m"
reverse
Expand Down
Expand Up @@ -431,8 +431,7 @@ export default function ({ getService }: FtrProviderContext) {
});
});

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/163456
describe.skip('API access with missing access token document or expired refresh token.', () => {
describe('API access with missing access token document or expired refresh token.', () => {
let sessionCookie: Cookie;

beforeEach(async () => {
Expand All @@ -447,6 +446,9 @@ export default function ({ getService }: FtrProviderContext) {
sessionCookie = parseCookie(cookies[0])!;
checkCookieIsSet(sessionCookie);

// Let's make sure that created tokens are available for search.
await getService('es').indices.refresh({ index: '.security-tokens' });

// Let's delete tokens from `.security-tokens` index directly to simulate the case when
// Elasticsearch automatically removes access/refresh token document from the index after
// some period of time.
Expand Down
Expand Up @@ -621,6 +621,9 @@ export default function ({ getService }: FtrProviderContext) {
});

it('should properly set cookie and start new OIDC handshake', async function () {
// Let's make sure that created tokens are available for search.
await getService('es').indices.refresh({ index: '.security-tokens' });

// Let's delete tokens from `.security-tokens` index directly to simulate the case when
// Elasticsearch automatically removes access/refresh token document from the index
// after some period of time.
Expand Down
9 changes: 7 additions & 2 deletions x-pack/test/security_api_integration/tests/saml/saml_login.ts
Expand Up @@ -593,8 +593,7 @@ export default function ({ getService }: FtrProviderContext) {
});
});

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/163455
describe.skip('API access with missing access token document.', () => {
describe('API access with missing access token document.', () => {
let sessionCookie: Cookie;

beforeEach(async () => {
Expand All @@ -615,6 +614,9 @@ export default function ({ getService }: FtrProviderContext) {

sessionCookie = parseCookie(samlAuthenticationResponse.headers['set-cookie'][0])!;

// Let's make sure that created tokens are available for search.
await getService('es').indices.refresh({ index: '.security-tokens' });

// Let's delete tokens from `.security` index directly to simulate the case when
// Elasticsearch automatically removes access/refresh token document from the index
// after some period of time.
Expand Down Expand Up @@ -700,6 +702,9 @@ export default function ({ getService }: FtrProviderContext) {
[
'when access token document is missing',
async () => {
// Let's make sure that created tokens are available for search.
await getService('es').indices.refresh({ index: '.security-tokens' });

const esResponse = await getService('es').deleteByQuery({
index: '.security-tokens',
body: { query: { match: { doc_type: 'token' } } },
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/security_api_integration/tests/token/session.ts
Expand Up @@ -189,6 +189,9 @@ export default function ({ getService }: FtrProviderContext) {
beforeEach(async () => (sessionCookie = await createSessionCookie()));

it('should clear cookie and redirect to login', async function () {
// Let's make sure that created tokens are available for search.
await getService('es').indices.refresh({ index: '.security-tokens' });

// Let's delete tokens from `.security` index directly to simulate the case when
// Elasticsearch automatically removes access/refresh token document from the index
// after some period of time.
Expand Down

0 comments on commit 2ec1cb7

Please sign in to comment.