[APM] Return operationName as part of _inspect response (#103616)

Closes #103448.
This commit is contained in:
Dario Gieselaar 2021-06-30 15:49:50 +02:00 committed by GitHub
parent 39b6597219
commit 4b54ccecd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 0 deletions

View file

@ -23,6 +23,7 @@ export async function callAsyncWithDebug<T>({
request, request,
requestType, requestType,
requestParams, requestParams,
operationName,
isCalledWithInternalUser, isCalledWithInternalUser,
}: { }: {
cb: () => Promise<T>; cb: () => Promise<T>;
@ -31,6 +32,7 @@ export async function callAsyncWithDebug<T>({
request: KibanaRequest; request: KibanaRequest;
requestType: string; requestType: string;
requestParams: Record<string, any>; requestParams: Record<string, any>;
operationName: string;
isCalledWithInternalUser: boolean; // only allow inspection of queries that were retrieved with credentials of the end user isCalledWithInternalUser: boolean; // only allow inspection of queries that were retrieved with credentials of the end user
}) { }) {
if (!debug) { if (!debug) {
@ -65,6 +67,7 @@ export async function callAsyncWithDebug<T>({
const inspectableEsQueries = inspectableEsQueriesMap.get(request); const inspectableEsQueries = inspectableEsQueriesMap.get(request);
if (!isCalledWithInternalUser && inspectableEsQueries) { if (!isCalledWithInternalUser && inspectableEsQueries) {
inspectableEsQueries.push({ inspectableEsQueries.push({
operationName,
response: res, response: res,
duration, duration,
requestType, requestType,

View file

@ -120,6 +120,7 @@ export function createApmEventClient({
debug, debug,
request, request,
requestType, requestType,
operationName,
requestParams: searchParams, requestParams: searchParams,
}); });
}, },

View file

@ -54,6 +54,7 @@ export function createInternalESClient({
request, request,
requestType, requestType,
requestParams: params, requestParams: params,
operationName,
}); });
} }

View file

@ -29,6 +29,7 @@ export type InspectResponse = Array<{
requestType: string; requestType: string;
requestParams: Record<string, unknown>; requestParams: Record<string, unknown>;
esError: Error; esError: Error;
operationName: string;
}>; }>;
export interface APMRouteCreateOptions { export interface APMRouteCreateOptions {

View file

@ -53,6 +53,7 @@ export default function customLinksTests({ getService }: FtrProviderContext) {
// @ts-expect-error // @ts-expect-error
expect(Object.keys(body._inspect[0])).to.eql([ expect(Object.keys(body._inspect[0])).to.eql([
'operationName',
'response', 'response',
'duration', 'duration',
'requestType', 'requestType',