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][Otel] Fix an error with mobile services #6

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions packages/kbn-apm-types/src/es_schemas/raw/transaction_raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface TransactionRaw extends APMBaseDoc {
trace: { id: string }; // trace is required
event?: { outcome?: EventOutcome };
transaction: {
duration: { us: number };
duration?: { us?: number };
id: string;
marks?: {
// "agent": not defined by APM Server - only sent by RUM agent
Expand All @@ -46,12 +46,12 @@ export interface TransactionRaw extends APMBaseDoc {
name?: string;
page?: Page; // special property for RUM: shared by error and transaction
result?: string;
sampled: boolean;
sampled?: boolean;
span_count?: {
started?: number;
dropped?: number;
};
type: string;
type?: string;
custom?: Record<string, unknown>;
message?: {
queue?: { name: string };
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-apm-types/src/es_schemas/ui/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Agent } from './fields/agent';
// and thus it doesn't make sense to treat it as optional
type InnerTransaction = TransactionRaw['transaction'];
interface InnerTransactionWithName extends InnerTransaction {
name: string;
name?: string;
}

export interface Transaction extends TransactionRaw {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export interface WaterfallTransaction {
event?: { outcome?: EventOutcome };
parent?: { id?: string };
processor: { event: 'transaction' };
transaction: {
duration: { us: number };
transaction?: {
duration?: { us?: number };
id: string;
name: string;
type: string;
name?: string;
type?: string;
result?: string;
};
faas?: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,7 @@ async function getTraceDocsPerPage({
PROCESSOR_EVENT,
] as const);

const requiredTxFields = asMutableArray([
TRANSACTION_ID,
TRANSACTION_DURATION,
TRANSACTION_NAME,
TRANSACTION_TYPE,
] as const);
const requiredTxFields = asMutableArray([TRANSACTION_ID] as const);

const requiredSpanFields = asMutableArray([
SPAN_ID,
Expand All @@ -301,6 +296,9 @@ async function getTraceDocsPerPage({
SPAN_COMPOSITE_SUM,
SPAN_SYNC,
CHILD_ID,
TRANSACTION_NAME,
TRANSACTION_TYPE,
TRANSACTION_DURATION,
] as const);

const body = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ export async function getTransaction({
TIMESTAMP_US,
SERVICE_NAME,
TRANSACTION_ID,
] as const);

const optionalFields = asMutableArray([
PROCESSOR_NAME,
SERVICE_LANGUAGE_NAME,
TRANSACTION_DURATION,
TRANSACTION_NAME,
TRANSACTION_SAMPLED,
TRANSACTION_TYPE,
] as const);

const optionalFields = asMutableArray([PROCESSOR_NAME, SERVICE_LANGUAGE_NAME] as const);

const resp = await apmEventClient.search('get_transaction', {
apm: {
sources: [
Expand All @@ -83,7 +86,7 @@ export async function getTransaction({
},
},
fields: [...requiredFields, ...optionalFields],
_source: [SPAN_LINKS, TRANSACTION_AGENT_MARKS],
_source: [SPAN_LINKS, TRANSACTION_AGENT_MARKS, TRANSACTION_NAME],
},
});

Expand Down
Loading