Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Add table tabs showing summary of metrics #153044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
560e20e
update UI for tables tabs
MiriamAparicio Mar 8, 2023
4cda1da
added endpoint for main statistics
MiriamAparicio Mar 9, 2023
bc8259c
add endpoint detailed statistics
MiriamAparicio Mar 21, 2023
fcc8c82
create components for fields tables
MiriamAparicio Mar 21, 2023
288a836
pr review comments
MiriamAparicio Mar 22, 2023
414cea7
hide App launch time columns for IOS
MiriamAparicio Mar 24, 2023
b3121cc
added API basic test
MiriamAparicio Mar 24, 2023
c03dac7
rename tab param
MiriamAparicio Mar 24, 2023
e291660
Merge branch 'main' into 146877-mobile-tables-metrics
MiriamAparicio Mar 24, 2023
57f57be
Adding app.launch.time to mobile devices synthtrace
yngrdyn Mar 28, 2023
674e409
Merge branch 'main' into 146877-mobile-tables-metrics
yngrdyn Mar 28, 2023
4442319
renamed kueryWithMobileFilters to kuery
yngrdyn Mar 28, 2023
854319d
using startWithOffset and endWithOffset instead of start and end
yngrdyn Mar 28, 2023
b2d0611
Merge branch 'main' into 146877-mobile-tables-metrics
yngrdyn Apr 4, 2023
979934a
Merge branch 'main' into 146877-mobile-tables-metrics
yngrdyn Apr 6, 2023
65ea0d7
using asPercent to show crashRate
yngrdyn Apr 6, 2023
a1666e1
Adding crashes to synthtrace
yngrdyn Apr 6, 2023
6bb19f6
Merge remote-tracking branch 'upstream/main' into 146877-mobile-table…
MiriamAparicio Apr 10, 2023
bd46802
fix detailed statistics api test
MiriamAparicio Apr 10, 2023
e0061f9
Merge remote-tracking branch 'upstream/main' into 146877-mobile-table…
MiriamAparicio Apr 10, 2023
05d1ae4
added api test for detailed statistics
MiriamAparicio Apr 10, 2023
7c6ba18
Merge remote-tracking branch 'upstream/main' into 146877-mobile-table…
MiriamAparicio Apr 11, 2023
c00ed12
added e2e tests
MiriamAparicio Apr 11, 2023
ec047aa
change typing for mobile detailed statistics response)
MiriamAparicio Apr 11, 2023
cd68c3e
PR review comments
MiriamAparicio Apr 17, 2023
fd1bcbf
review api tests
MiriamAparicio Apr 17, 2023
d07d024
split main statistic request in transaction events and metrics
MiriamAparicio Apr 19, 2023
2e24a1a
Merge remote-tracking branch 'upstream/main' into 146877-mobile-table…
MiriamAparicio Apr 19, 2023
578b81e
fix api tests
MiriamAparicio Apr 19, 2023
9078127
rename operation request name
MiriamAparicio Apr 19, 2023
37443f2
fix types errors
MiriamAparicio Apr 20, 2023
581eb90
fix merging conflicts
MiriamAparicio Apr 20, 2023
072ab64
Merge remote-tracking branch 'upstream/main' into 146877-mobile-table…
MiriamAparicio Apr 21, 2023
f84d981
remove application launch time
MiriamAparicio Apr 21, 2023
a79ebaa
split main statistics query, use sources instead of events, i18n impr…
MiriamAparicio Apr 25, 2023
27f1bf9
Merge branch 'main' into 146877-mobile-tables-metrics
MiriamAparicio Apr 25, 2023
826f1bc
Merge branch 'main' into 146877-mobile-tables-metrics
MiriamAparicio Apr 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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();
MiriamAparicio marked this conversation as resolved.
Show resolved Hide resolved
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,
MiriamAparicio marked this conversation as resolved.
Show resolved Hide resolved
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) =>
MiriamAparicio marked this conversation as resolved.
Show resolved Hide resolved
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
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