Skip to content

Commit

Permalink
Merge branch 'main' into new-heatmap-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Nov 24, 2021
2 parents 808856d + 5a63073 commit 0bb4c7f
Show file tree
Hide file tree
Showing 81 changed files with 1,605 additions and 1,273 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
/x-pack/plugins/lens/ @elastic/kibana-vis-editors
/src/plugins/advanced_settings/ @elastic/kibana-vis-editors
/src/plugins/charts/ @elastic/kibana-vis-editors
/src/plugins/kibana_legacy/ @elastic/kibana-vis-editors
/src/plugins/vis_default_editor/ @elastic/kibana-vis-editors
/src/plugins/vis_types/metric/ @elastic/kibana-vis-editors
/src/plugins/vis_types/table/ @elastic/kibana-vis-editors
Expand Down
1 change: 0 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"indexPatternManagement": "src/plugins/data_view_management",
"interactiveSetup": "src/plugins/interactive_setup",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
"kibanaOverview": "src/plugins/kibana_overview",
"kibana_react": "src/legacy/core_plugins/kibana_react",
"kibana-react": "src/plugins/kibana_react",
Expand Down
4 changes: 0 additions & 4 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ in Kibana, e.g. visualizations. It has the form of a flyout panel.
|The plugin provides UI and APIs for the interactive setup mode.
|{kib-repo}blob/{branch}/src/plugins/kibana_legacy/README.md[kibanaLegacy]
|This plugin contains several helpers and services to integrate pieces of the legacy Kibana app with the new Kibana platform.
|{kib-repo}blob/{branch}/src/plugins/kibana_overview/README.md[kibanaOverview]
|An overview page highlighting Kibana apps
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pageLoadAssetSize:
ingestPipelines: 58003
inputControlVis: 172675
inspector: 148711
kibanaLegacy: 107711
kibanaOverview: 56279
lens: 96624
licenseManagement: 41817
Expand Down
4 changes: 4 additions & 0 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
getServerOptions,
getRequestId,
} from '@kbn/server-http-tools';
import agent from 'elastic-apm-node';

import type { Duration } from 'moment';
import { Observable } from 'rxjs';
Expand Down Expand Up @@ -345,6 +346,9 @@ export class HttpServer {
...(request.app ?? {}),
requestId,
requestUuid: uuid.v4(),
// Kibana stores trace.id until https://github.com/elastic/apm-agent-nodejs/issues/2353 is resolved
// The current implementation of the APM agent ends a request transaction before "response" log is emitted.
traceId: agent.currentTraceIds['trace.id'],
} as KibanaRequestState;
return responseToolkit.continue;
});
Expand Down
15 changes: 15 additions & 0 deletions src/core/server/http/logging/get_response_log.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface RequestFixtureOptions {
path?: string;
query?: Record<string, any>;
response?: Record<string, any> | Boom.Boom;
app?: Record<string, any>;
}

function createMockHapiRequest({
Expand All @@ -39,6 +40,7 @@ function createMockHapiRequest({
path = '/path',
query = {},
response = { headers: {}, statusCode: 200 },
app = {},
}: RequestFixtureOptions = {}): Request {
return {
auth,
Expand All @@ -50,6 +52,7 @@ function createMockHapiRequest({
path,
query,
response,
app,
} as unknown as Request;
}

Expand Down Expand Up @@ -143,6 +146,17 @@ describe('getEcsResponseLog', () => {
expect(result.message).toMatchInlineSnapshot(`"GET /path 200"`);
});

test('set traceId stored in the request app storage', () => {
const req = createMockHapiRequest({
app: {
foo: 'bar',
traceId: 'trace_id',
},
});
const result = getEcsResponseLog(req, logger);
expect(result.meta?.trace?.id).toBe('trace_id');
});

test('handles Boom errors in the response', () => {
const req = createMockHapiRequest({
response: Boom.badRequest(),
Expand Down Expand Up @@ -280,6 +294,7 @@ describe('getEcsResponseLog', () => {
"status_code": 200,
},
},
"trace": undefined,
"url": Object {
"path": "/path",
"query": "",
Expand Down
4 changes: 4 additions & 0 deletions src/core/server/http/logging/get_response_log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import numeral from '@elastic/numeral';
import { LogMeta } from '@kbn/logging';
import { Logger } from '../../logging';
import { getResponsePayloadBytes } from './get_payload_size';
import type { KibanaRequestState } from '../router';

const FORBIDDEN_HEADERS = ['authorization', 'cookie', 'set-cookie'];
const REDACTED_HEADER_TEXT = '[REDACTED]';
Expand Down Expand Up @@ -65,6 +66,8 @@ export function getEcsResponseLog(request: Request, log: Logger) {
const bytes = getResponsePayloadBytes(response, log);
const bytesMsg = bytes ? ` - ${numeral(bytes).format('0.0b')}` : '';

const traceId = (request.app as KibanaRequestState).traceId;

const meta: LogMeta = {
client: {
ip: request.info.remoteAddress,
Expand Down Expand Up @@ -95,6 +98,7 @@ export function getEcsResponseLog(request: Request, log: Logger) {
user_agent: {
original: request.headers['user-agent'],
},
trace: traceId ? { id: traceId } : undefined,
};

return {
Expand Down
1 change: 1 addition & 0 deletions src/core/server/http/router/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface KibanaRequestState extends RequestApplicationState {
requestId: string;
requestUuid: string;
rewrittenUrl?: URL;
traceId?: string;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/core/server/logging/layouts/json_layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ test('format() meta can not override tracing properties', () => {
trace: { id: 'trace_override' },
transaction: { id: 'transaction_override' },
},
spanId: 'spanId-1',
traceId: 'traceId-1',
transactionId: 'transactionId-1',
spanId: 'spanId',
traceId: 'traceId',
transactionId: 'transactionId',
})
)
).toStrictEqual({
Expand All @@ -359,8 +359,8 @@ test('format() meta can not override tracing properties', () => {
process: {
pid: 3,
},
span: { id: 'spanId-1' },
trace: { id: 'traceId-1' },
transaction: { id: 'transactionId-1' },
span: { id: 'span_override' },
trace: { id: 'trace_override' },
transaction: { id: 'transaction_override' },
});
});
10 changes: 7 additions & 3 deletions src/core/server/logging/layouts/json_layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class JsonLayout implements Layout {
}

public format(record: LogRecord): string {
const spanId = record.meta?.span?.id ?? record.spanId;
const traceId = record.meta?.trace?.id ?? record.traceId;
const transactionId = record.meta?.transaction?.id ?? record.transactionId;

const log: Ecs = {
ecs: { version: '8.0.0' },
'@timestamp': moment(record.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
Expand All @@ -54,9 +58,9 @@ export class JsonLayout implements Layout {
process: {
pid: record.pid,
},
span: record.spanId ? { id: record.spanId } : undefined,
trace: record.traceId ? { id: record.traceId } : undefined,
transaction: record.transactionId ? { id: record.transactionId } : undefined,
span: spanId ? { id: spanId } : undefined,
trace: traceId ? { id: traceId } : undefined,
transaction: transactionId ? { id: transactionId } : undefined,
};
const output = record.meta ? merge({ ...record.meta }, log) : log;

Expand Down
7 changes: 0 additions & 7 deletions src/plugins/kibana_legacy/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions src/plugins/kibana_legacy/jest.config.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/plugins/kibana_legacy/kibana.json

This file was deleted.

17 changes: 0 additions & 17 deletions src/plugins/kibana_legacy/public/index.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/plugins/kibana_legacy/public/mocks.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/plugins/kibana_legacy/public/notify/index.ts

This file was deleted.

65 changes: 0 additions & 65 deletions src/plugins/kibana_legacy/public/notify/lib/format_es_msg.test.js

This file was deleted.

26 changes: 0 additions & 26 deletions src/plugins/kibana_legacy/public/notify/lib/format_es_msg.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/plugins/kibana_legacy/public/notify/lib/index.ts

This file was deleted.

Loading

0 comments on commit 0bb4c7f

Please sign in to comment.