Skip to content

Commit

Permalink
Merge branch 'main' into feature/darkmode_discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
kc13greiner authored Apr 25, 2023
2 parents c076fcd + 8c1008f commit 084ed22
Show file tree
Hide file tree
Showing 158 changed files with 5,766 additions and 1,460 deletions.
2 changes: 2 additions & 0 deletions packages/kbn-apm-synthtrace-client/src/lib/apm/apm_fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ApmApplicationMetricFields = Partial<{
'faas.timeout': number;
'faas.coldstart_duration': number;
'faas.duration': number;
'application.launch.time': number;
}>;

export type ApmUserAgentFields = Partial<{
Expand Down Expand Up @@ -88,6 +89,7 @@ export type ApmFields = Fields<{
'error.grouping_key': string;
'error.grouping_name': string;
'error.id': string;
'error.type': string;
'event.ingested': number;
'event.name': string;
'event.outcome': string;
Expand Down
22 changes: 21 additions & 1 deletion packages/kbn-apm-synthtrace-client/src/lib/apm/mobile_device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import { Entity } from '../entity';
import { Span } from './span';
import { Transaction } from './transaction';
import { ApmFields, SpanParams, GeoLocation } from './apm_fields';
import { ApmFields, SpanParams, GeoLocation, ApmApplicationMetricFields } from './apm_fields';
import { generateLongId } from '../utils/generate_id';
import { Metricset } from './metricset';
import { ApmError } from './apm_error';

export interface DeviceInfo {
manufacturer: string;
Expand Down Expand Up @@ -115,6 +117,7 @@ export class MobileDevice extends Entity<ApmFields> {
return this;
}

// FIXME synthtrace shouldn't have side-effects like this. We should use an API like .session() which returns a session
startNewSession() {
this.fields['session.id'] = generateLongId();
return this;
Expand Down Expand Up @@ -238,4 +241,21 @@ export class MobileDevice extends Entity<ApmFields> {

return this.span(spanParameters);
}

appMetrics(metrics: ApmApplicationMetricFields) {
return new Metricset<ApmFields>({
...this.fields,
'metricset.name': 'app',
...metrics,
});
}

crash({ message, groupingName }: { message: string; groupingName?: string }) {
return new ApmError({
...this.fields,
'error.type': 'crash',
'error.exception': [{ message, ...{ type: 'crash' } }],
'error.grouping_name': groupingName || message,
});
}
}
88 changes: 60 additions & 28 deletions packages/kbn-apm-synthtrace/src/scenarios/mobile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ const ENVIRONMENT = getSynthtraceEnvironment(__filename);

type DeviceMetadata = DeviceInfo & OSInfo;

const modelIdentifiersWithCrashes = [
'SM-G930F',
'HUAWEI P2-0000',
'Pixel 3a',
'LG K10',
'iPhone11,8',
'Watch6,8',
'iPad12,2',
];

const ANDROID_DEVICES: DeviceMetadata[] = [
{
manufacturer: 'Samsung',
Expand Down Expand Up @@ -354,34 +364,40 @@ const scenario: Scenario<ApmFields> = async ({ scenarioOpts, logger }) => {
device.startNewSession();
const framework =
device.fields['device.manufacturer'] === 'Apple' ? 'iOS' : 'Android Activity';
const couldCrash = modelIdentifiersWithCrashes.includes(
device.fields['device.model.identifier'] ?? ''
);
const startTx = device
.transaction('Start View - View Appearing', framework)
.timestamp(timestamp)
.duration(500)
.success()
.children(
device
.span({
spanName: 'onCreate',
spanType: 'app',
spanSubtype: 'external',
'service.target.type': 'http',
'span.destination.service.resource': 'external',
})
.duration(50)
.success()
.timestamp(timestamp + 20),
device
.httpSpan({
spanName: 'GET backend:1234',
httpMethod: 'GET',
httpUrl: 'https://backend:1234/api/start',
})
.duration(800)
.failure()
.timestamp(timestamp + 400)
);
return [
device
.transaction('Start View - View Appearing', framework)
.timestamp(timestamp)
.duration(500)
.success()
.children(
device
.span({
spanName: 'onCreate',
spanType: 'app',
spanSubtype: 'external',
'service.target.type': 'http',
'span.destination.service.resource': 'external',
})
.duration(50)
.success()
.timestamp(timestamp + 20),
device
.httpSpan({
spanName: 'GET backend:1234',
httpMethod: 'GET',
httpUrl: 'https://backend:1234/api/start',
})
.duration(800)
.failure()
.timestamp(timestamp + 400)
),
couldCrash && index % 2 === 0
? startTx.errors(device.crash({ message: 'error' }).timestamp(timestamp))
: startTx,
device
.transaction('Second View - View Appearing', framework)
.timestamp(10000 + timestamp)
Expand Down Expand Up @@ -418,7 +434,23 @@ const scenario: Scenario<ApmFields> = async ({ scenarioOpts, logger }) => {
});
};

return [...androidDevices, ...iOSDevices].map((device) => sessionTransactions(device));
const appLaunchMetrics = (device: MobileDevice) => {
return clickRate.generator((timestamp, index) =>
device
.appMetrics({
'application.launch.time': 100 * (index + 1),
})
.timestamp(timestamp)
);
};

return [
...androidDevices.flatMap((device) => [
sessionTransactions(device),
appLaunchMetrics(device),
]),
...iOSDevices.map((device) => sessionTransactions(device)),
];
},
};
};
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
dashboardSettings: `${KIBANA_DOCS}advanced-options.html#kibana-dashboard-settings`,
indexManagement: `${ELASTICSEARCH_DOCS}index-mgmt.html`,
kibanaSearchSettings: `${KIBANA_DOCS}advanced-options.html#kibana-search-settings`,
discoverSettings: `${KIBANA_DOCS}advanced-options.html#kibana-discover-settings`,
visualizationSettings: `${KIBANA_DOCS}advanced-options.html#kibana-visualization-settings`,
timelionSettings: `${KIBANA_DOCS}advanced-options.html#kibana-timelion-settings`,
savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-rule-data-utils/src/default_alerts_as_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const ALERT_RULE_TAGS = `${ALERT_RULE_NAMESPACE}.tags` as const;
// kibana.alert.rule_type_id - rule type id for rule that generated this alert
const ALERT_RULE_TYPE_ID = `${ALERT_RULE_NAMESPACE}.rule_type_id` as const;

// kibana.alert.url - allow our user to go back to the details url in kibana
// kibana.alert.url - url which will redirect users to a page related to the given alert
const ALERT_URL = `${ALERT_NAMESPACE}.url` as const;

// kibana.alert.rule.uuid - rule ID for rule that generated this alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
import { omit } from 'lodash';
import { AnyAction, Middleware } from 'redux';
import { debounceTime, Observable, Subject, switchMap } from 'rxjs';
import { debounceTime, Observable, startWith, Subject, switchMap } from 'rxjs';

import { DashboardContainerInput } from '../../../../common';
import type { DashboardDiffFunctions } from './dashboard_diffing_functions';
Expand Down Expand Up @@ -90,6 +90,7 @@ export function startDiffingDashboardState(
this.subscriptions.add(
checkForUnsavedChangesSubject$
.pipe(
startWith(null),
debounceTime(CHANGE_CHECK_DEBOUNCE),
switchMap(() => {
return new Observable((observer) => {
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/discover/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export const getUiSettings: (docLinks: DocLinksServiceSetup) => Record<string, U
}),
category: ['discover'],
schema: schema.boolean(),
deprecation: {
message: i18n.translate('discover.advancedSettings.showLegacyFieldStatsTextDeprecation', {
defaultMessage: 'This setting is deprecated and will not be supported in a future version.',
}),
docLinksKey: 'discoverSettings',
},
},
[DOC_HIDE_TIME_COLUMN_SETTING]: {
name: i18n.translate('discover.advancedSettings.docTableHideTimeColumnTitle', {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/apm/common/data_source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ type AnyApmDocumentType =
| ApmDocumentType.TransactionMetric
| ApmDocumentType.TransactionEvent
| ApmDocumentType.ServiceDestinationMetric
| ApmDocumentType.ServiceSummaryMetric;
| ApmDocumentType.ServiceSummaryMetric
| ApmDocumentType.ErrorEvent;

export interface ApmDataSource<
TDocumentType extends AnyApmDocumentType = AnyApmDocumentType
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/common/document_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum ApmDocumentType {
TransactionEvent = 'transactionEvent',
ServiceDestinationMetric = 'serviceDestinationMetric',
ServiceSummaryMetric = 'serviceSummaryMetric',
ErrorEvent = 'error',
}

export type ApmServiceTransactionDocumentType =
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions x-pack/plugins/apm/common/es_fields/apm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const ERROR_EXC_MESSAGE = 'error.exception.message'; // only to be used i
export const ERROR_EXC_HANDLED = 'error.exception.handled'; // only to be used in es queries, since error.exception is now an array
export const ERROR_EXC_TYPE = 'error.exception.type';
export const ERROR_PAGE_URL = 'error.page.url';
export const ERROR_TYPE = 'error.type';

// METRICS
export const METRIC_SYSTEM_FREE_MEMORY = 'system.memory.actual.free';
Expand Down
Loading

0 comments on commit 084ed22

Please sign in to comment.