Skip to content

Commit

Permalink
Merge branch 'main' into investigate-in-timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 15, 2022
2 parents 032866c + c55c6c8 commit b12e48b
Show file tree
Hide file tree
Showing 264 changed files with 12,114 additions and 814 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,14 @@ module.exports = {
],
},
},

// Profiling
{
files: ['x-pack/plugins/profiling/**/*.{js,mjs,ts,tsx}'],
rules: {
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': ['error', { additionalHooks: '^(useAsync)$' }],
},
},
{
// disable imports from legacy uptime plugin
files: ['x-pack/plugins/synthetics/public/apps/synthetics/**/*.{js,mjs,ts,tsx}'],
Expand Down
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ x-pack/examples/files_example @elastic/kibana-app-services
/x-pack/plugins/apm/public/components/app/rum_dashboard @elastic/uptime
/x-pack/test/apm_api_integration/tests/csm/ @elastic/uptime

# Profiling
/x-pack/plugins/profiling @elastic/profiling-ui

# Observability onboarding tour
/x-pack/plugins/observability/public/components/shared/tour @elastic/platform-onboarding
/x-pack/test/functional/apps/infra/tour.ts @elastic/platform-onboarding
Expand Down Expand Up @@ -362,6 +365,10 @@ x-pack/examples/files_example @elastic/kibana-app-services
/x-pack/plugins/ingest_pipelines/ @elastic/platform-deployment-management
#CC# /x-pack/plugins/cross_cluster_replication/ @elastic/platform-deployment-management

# Management Experience - Platform Onboarding
/src/plugins/guided_onboarding/ @elastic/platform-onboarding
/examples/guided_onboarding_example/ @elastic/platform-onboarding

# Security Solution
/x-pack/test/endpoint_api_integration_no_ingest/ @elastic/security-solution
/x-pack/test/security_solution_endpoint/ @elastic/security-solution
Expand Down
2 changes: 1 addition & 1 deletion STYLEGUIDE.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ Doing so ensures the styles are never separated or lost on import and allows
for better modularization (smaller individual plugin asset footprint).
All SASS (.scss) files will automatically build with the [EUI](https://elastic.github.io/eui/#/guidelines/sass)
& Kibana invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/core/public/core_app/styles/_globals_v8light.scss).
& Kibana invisibles (SASS variables, mixins, functions) from the [`globals_[theme].scss` file](src/core/public/styles/core_app/_globals_v8light.scss).
While the styles for this component will only be loaded if the component exists on the page,
the styles **will** be global and so it is recommended to use a three letter prefix on your
Expand Down
6 changes: 3 additions & 3 deletions api_docs/security_solution.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"label": "experimentalFeatures",
"description": [],
"signature": [
"{ readonly tGridEnabled: boolean; readonly tGridEventRenderedViewEnabled: boolean; readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly disableIsolationUIPendingStatuses: boolean; readonly riskyHostsEnabled: boolean; readonly riskyUsersEnabled: boolean; readonly pendingActionResponsesWithAck: boolean; readonly policyListEnabled: boolean; readonly policyResponseInFleetEnabled: boolean; readonly threatIntelligenceEnabled: boolean; readonly entityAnalyticsDashboardEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly responseActionsConsoleEnabled: boolean; readonly insightsRelatedAlertsByProcessAncestry: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; }"
"{ readonly tGridEnabled: boolean; readonly tGridEventRenderedViewEnabled: boolean; readonly excludePoliciesInFilterEnabled: boolean; readonly kubernetesEnabled: boolean; readonly disableIsolationUIPendingStatuses: boolean; readonly pendingActionResponsesWithAck: boolean; readonly policyListEnabled: boolean; readonly policyResponseInFleetEnabled: boolean; readonly threatIntelligenceEnabled: boolean; readonly previewTelemetryUrlEnabled: boolean; readonly responseActionsConsoleEnabled: boolean; readonly insightsRelatedAlertsByProcessAncestry: boolean; readonly extendedRuleExecutionLoggingEnabled: boolean; readonly socTrendsEnabled: boolean; }"
],
"path": "x-pack/plugins/security_solution/public/plugin.tsx",
"deprecated": false,
Expand Down Expand Up @@ -1095,7 +1095,7 @@
"label": "ConfigType",
"description": [],
"signature": [
"Readonly<{} & { signalsIndex: string; maxRuleImportExportSize: number; maxRuleImportPayloadBytes: number; maxTimelineImportExportSize: number; maxTimelineImportPayloadBytes: number; alertMergeStrategy: \"allFields\" | \"missingFields\" | \"noFields\"; alertIgnoreFields: string[]; enableExperimental: string[]; packagerTaskInterval: string; prebuiltRulesFromFileSystem: boolean; prebuiltRulesFromSavedObjects: boolean; }> & { experimentalFeatures: Readonly<{ tGridEnabled: boolean; tGridEventRenderedViewEnabled: boolean; excludePoliciesInFilterEnabled: boolean; kubernetesEnabled: boolean; disableIsolationUIPendingStatuses: boolean; riskyHostsEnabled: boolean; riskyUsersEnabled: boolean; pendingActionResponsesWithAck: boolean; policyListEnabled: boolean; policyResponseInFleetEnabled: boolean; threatIntelligenceEnabled: boolean; entityAnalyticsDashboardEnabled: boolean; previewTelemetryUrlEnabled: boolean; responseActionsConsoleEnabled: boolean; insightsRelatedAlertsByProcessAncestry: boolean; extendedRuleExecutionLoggingEnabled: boolean; socTrendsEnabled: boolean; }>; }"
"Readonly<{} & { signalsIndex: string; maxRuleImportExportSize: number; maxRuleImportPayloadBytes: number; maxTimelineImportExportSize: number; maxTimelineImportPayloadBytes: number; alertMergeStrategy: \"allFields\" | \"missingFields\" | \"noFields\"; alertIgnoreFields: string[]; enableExperimental: string[]; packagerTaskInterval: string; prebuiltRulesFromFileSystem: boolean; prebuiltRulesFromSavedObjects: boolean; }> & { experimentalFeatures: Readonly<{ tGridEnabled: boolean; tGridEventRenderedViewEnabled: boolean; excludePoliciesInFilterEnabled: boolean; kubernetesEnabled: boolean; disableIsolationUIPendingStatuses: boolean; pendingActionResponsesWithAck: boolean; policyListEnabled: boolean; policyResponseInFleetEnabled: boolean; threatIntelligenceEnabled: boolean; previewTelemetryUrlEnabled: boolean; responseActionsConsoleEnabled: boolean; insightsRelatedAlertsByProcessAncestry: boolean; extendedRuleExecutionLoggingEnabled: boolean; socTrendsEnabled: boolean; }>; }"
],
"path": "x-pack/plugins/security_solution/server/config.ts",
"deprecated": false,
Expand Down Expand Up @@ -1141,4 +1141,4 @@
"misc": [],
"objects": []
}
}
}
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ Elastic.
|This plugin helps users learn how to use the Painless scripting language.
|{kib-repo}blob/{branch}/x-pack/plugins/profiling/README.md[profiling]
|undefined
|{kib-repo}blob/{branch}/x-pack/plugins/remote_clusters/README.md[remoteClusters]
|This plugin helps users manage their remote clusters, which enable cross-cluster search and cross-cluster replication.
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@
"fast-deep-equal": "^3.1.1",
"fflate": "^0.6.9",
"file-saver": "^1.3.8",
"fnv-plus": "^1.3.1",
"font-awesome": "4.7.0",
"formik": "^2.2.9",
"fp-ts": "^2.3.1",
Expand Down Expand Up @@ -534,6 +535,7 @@
"pbf": "3.2.1",
"pdfjs-dist": "^2.13.216",
"pdfmake": "^0.2.5",
"peggy": "^1.2.0",
"pluralize": "3.1.0",
"polished": "^3.7.2",
"pretty-ms": "6.0.0",
Expand Down Expand Up @@ -774,6 +776,7 @@
"@types/d3-time": "^1.0.10",
"@types/d3-time-format": "^2.1.1",
"@types/d3-transition": "^3.0.1",
"@types/dagre": "^0.7.47",
"@types/dedent": "^0.7.0",
"@types/deep-freeze-strict": "^1.1.0",
"@types/delete-empty": "^2.0.0",
Expand All @@ -786,6 +789,7 @@
"@types/fetch-mock": "^7.3.1",
"@types/file-saver": "^2.0.0",
"@types/flot": "^0.0.31",
"@types/fnv-plus": "^1.3.0",
"@types/geojson": "7946.0.7",
"@types/getos": "^3.0.0",
"@types/gulp": "^4.0.6",
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/apm_fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export type ApmApplicationMetricFields = Partial<{
'jvm.memory.heap.used': number;
'jvm.memory.non_heap.used': number;
'jvm.thread.count': number;
'faas.billed_duration': number;
'faas.timeout': number;
'faas.coldstart_duration': number;
'faas.duration': number;
}>;

export type ApmUserAgentFields = Partial<{
Expand Down Expand Up @@ -104,6 +108,7 @@ export type ApmFields = Fields &
'cloud.region': string;
'host.os.platform': string;
'faas.id': string;
'faas.name': string;
'faas.coldstart': boolean;
'faas.execution': string;
'faas.trigger.type': string;
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import { service } from './service';
import { browser } from './browser';
import { serverlessFunction } from './serverless_function';
import { getTransactionMetrics } from './processors/get_transaction_metrics';
import { getSpanDestinationMetrics } from './processors/get_span_destination_metrics';
import { getChromeUserAgentDefaults } from './defaults/get_chrome_user_agent_defaults';
Expand All @@ -27,6 +28,7 @@ export const apm = {
getApmWriteTargets,
ApmSynthtraceEsClient,
ApmSynthtraceKibanaClient,
serverlessFunction,
};

export type { ApmSynthtraceEsClient, ApmException };
88 changes: 88 additions & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/serverless.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { generateLongId, generateShortId } from '../utils/generate_id';
import { ApmFields } from './apm_fields';
import { BaseSpan } from './base_span';
import { Metricset } from './metricset';

export type FaasTriggerType = 'http' | 'pubsub' | 'datasource' | 'timer' | 'other';

export class Serverless extends BaseSpan {
private readonly metric: Metricset<ApmFields>;

constructor(fields: ApmFields) {
const faasExection = generateLongId();
const triggerType = 'other';
super({
...fields,
'processor.event': 'transaction',
'transaction.id': generateShortId(),
'transaction.sampled': true,
'faas.execution': faasExection,
'faas.trigger.type': triggerType,
'transaction.name': fields['transaction.name'] || fields['faas.name'],
'transaction.type': 'request',
});
this.metric = new Metricset<ApmFields>({
...fields,
'metricset.name': 'app',
'faas.execution': faasExection,
'faas.id': fields['service.name'],
});
}

duration(duration: number) {
this.fields['transaction.duration.us'] = duration * 1000;
return this;
}

coldStart(coldstart: boolean) {
this.fields['faas.coldstart'] = coldstart;
this.metric.fields['faas.coldstart'] = coldstart;
return this;
}

billedDuration(billedDuration: number) {
this.metric.fields['faas.billed_duration'] = billedDuration;
return this;
}

faasTimeout(faasTimeout: number) {
this.metric.fields['faas.timeout'] = faasTimeout;
return this;
}

memory({ total, free }: { total: number; free: number }) {
this.metric.fields['system.memory.total'] = total;
this.metric.fields['system.memory.actual.free'] = free;
return this;
}

coldStartDuration(coldStartDuration: number) {
this.metric.fields['faas.coldstart_duration'] = coldStartDuration;
return this;
}

faasDuration(faasDuration: number) {
this.metric.fields['faas.duration'] = faasDuration;
return this;
}

timestamp(time: number): this {
super.timestamp(time);
this.metric.fields['@timestamp'] = time;
return this;
}

serialize(): ApmFields[] {
const transaction = super.serialize();
const metric = this.metric.serialize();
return [...transaction, ...metric];
}
}
45 changes: 45 additions & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/serverless_function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { Entity } from '../entity';
import { generateShortId } from '../utils/generate_id';
import { ApmFields } from './apm_fields';
import { ServerlessInstance } from './serverless_instance';

export class ServerlessFunction extends Entity<ApmFields> {
instance({ instanceName, ...apmFields }: { instanceName: string } & ApmFields) {
return new ServerlessInstance({
...this.fields,
['service.node.name']: instanceName,
'host.name': instanceName,
...apmFields,
});
}
}

export function serverlessFunction({
functionName,
serviceName,
environment,
agentName,
}: {
functionName: string;
environment: string;
agentName: string;
serviceName?: string;
}) {
const faasId = `arn:aws:lambda:us-west-2:${generateShortId()}:function:${functionName}`;
return new ServerlessFunction({
'service.name': serviceName || faasId,
'faas.id': faasId,
'faas.name': functionName,
'service.environment': environment,
'agent.name': agentName,
'service.runtime.name': 'AWS_lambda',
});
}
22 changes: 22 additions & 0 deletions packages/kbn-apm-synthtrace/src/lib/apm/serverless_instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { Entity } from '../entity';
import { ApmFields } from './apm_fields';
import { FaasTriggerType, Serverless } from './serverless';

export class ServerlessInstance extends Entity<ApmFields> {
invocation(params: { transactionName?: string; faasTriggerType?: FaasTriggerType } = {}) {
const { transactionName, faasTriggerType = 'other' } = params;
return new Serverless({
...this.fields,
'transaction.name': transactionName,
'faas.trigger.type': faasTriggerType,
});
}
}
Loading

0 comments on commit b12e48b

Please sign in to comment.