elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.71k stars 8.13k forks source link

Failing test: APM API Integration tests (basic).x-pack/test/apm_api_integration/tests/services/agent·spec·ts - APM API tests services/agent.spec.ts basic apm_8.0.0 Agent name when data is loaded returns the agent name #175756

Open kibanamachine opened 7 months ago

kibanamachine commented 7 months ago

A test failed on a tracked branch

ApmApiError: Unhandled ApmApiError.
Status: "500"
Endpoint: "GET /internal/apm/services/{serviceName}/agent"
Body: {"statusCode":500,"error":"Internal Server Error","message":"Cannot read properties of undefined (reading '_source')","attributes":{"data":{},"_inspect":[]}}
    at Proxy.<anonymous> (apm_api_supertest.ts:63:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Context.<anonymous> (agent.spec.ts:42:26)
    at Object.apply (wrap_function.js:73:16) {
  res: <ref *1> Response {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    res: { method: null, url: '', complete: true, aborted: false },
    request: Test {
      _events: [Object: null prototype],
      _eventsCount: 1,
      _maxListeners: undefined,
      _enableHttp2: false,
      _agent: false,
      _formData: null,
      method: 'GET',
      url: 'http://viewer:changeme@localhost:5620/internal/apm/services/opbeans-node/agent?start=2021-08-03T06%3A50%3A15.910Z&end=2021-08-03T07%3A20%3A15.910Z',
      _header: [Object],
      header: [Object],
      writable: true,
      _redirects: 0,
      _maxRedirects: 0,
      cookies: '',
      qs: {},
      _query: [],
      qsRaw: [],
      _redirectList: [],
      _streamRequest: false,
      _lookup: undefined,
      _buffer: true,
      app: 'http://viewer:changeme@localhost:5620',
      _asserts: [],
      req: [ClientRequest],
      protocol: 'http:',
      host: 'localhost:5620',
      _endCalled: true,
      _callback: [Function (anonymous)],
      _fullfilledPromise: [Promise],
      res: [Object],
      _resBuffered: true,
      response: [Circular *1],
      called: true,
      [Symbol(kCapture)]: false
    },
    req: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [Socket],
      _header: 'GET /internal/apm/services/opbeans-node/agent?start=2021-08-03T06%3A50%3A15.910Z&end=2021-08-03T07%3A20%3A15.910Z HTTP/1.1\r\n' +
        'Host: localhost:5620\r\n' +
        'Accept-Encoding: gzip, deflate\r\n' +
        'kbn-xsrf: foo\r\n' +
        'x-elastic-internal-origin: foo\r\n' +
        'Authorization: Basic dmlld2VyOmNoYW5nZW1l\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/internal/apm/services/opbeans-node/agent?start=2021-08-03T06%3A50%3A15.910Z&end=2021-08-03T07%3A20%3A15.910Z',
      _ended: true,
      res: [Object],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'localhost',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    text: `{"statusCode":500,"error":"Internal Server Error","message":"Cannot read properties of undefined (reading '_source')","attributes":{"data":{},"_inspect":[]}}`,
    files: undefined,
    buffered: true,
    headers: {
      'x-content-type-options': 'nosniff',
      'referrer-policy': 'no-referrer-when-downgrade',
      'permissions-policy': 'camera=(), display-capture=(), fullscreen=(self), geolocation=(), microphone=(), web-share=()',
      'cross-origin-opener-policy': 'same-origin',
      'content-security-policy': "script-src 'report-sample' 'self'; worker-src 'report-sample' 'self' blob:; style-src 'report-sample' 'self' 'unsafe-inline'",
      'kbn-name': 'kb-n2-4-spot-59aeabed1de730b1',
      'kbn-license-sig': '064982403f1941fe28c53ac8b8c9ee52a61aa022093b248aa9e45772dc3b4b56',
      'content-type': 'application/json; charset=utf-8',
      'cache-control': 'private, no-cache, no-store, must-revalidate',
      'content-length': '157',
      date: 'Sat, 27 Jan 2024 17:56:55 GMT',
      connection: 'close'
    },
    header: {
      'x-content-type-options': 'nosniff',
      'referrer-policy': 'no-referrer-when-downgrade',
      'permissions-policy': 'camera=(), display-capture=(), fullscreen=(self), geolocation=(), microphone=(), web-share=()',
      'cross-origin-opener-policy': 'same-origin',
      'content-security-policy': "script-src 'report-sample' 'self'; worker-src 'report-sample' 'self' blob:; style-src 'report-sample' 'self' 'unsafe-inline'",
      'kbn-name': 'kb-n2-4-spot-59aeabed1de730b1',
      'kbn-license-sig': '064982403f1941fe28c53ac8b8c9ee52a61aa022093b248aa9e45772dc3b4b56',
      'content-type': 'application/json; charset=utf-8',
      'cache-control': 'private, no-cache, no-store, must-revalidate',
      'content-length': '157',
      date: 'Sat, 27 Jan 2024 17:56:55 GMT',
      connection: 'close'
    },
    statusCode: 500,
    status: 500,
    statusType: 5,
    info: false,
    ok: false,
    redirect: false,
    clientError: false,
    serverError: true,
    error: Error: cannot GET /internal/apm/services/opbeans-node/agent?start=2021-08-03T06%3A50%3A15.910Z&end=2021-08-03T07%3A20%3A15.910Z (500)
        at Response.toError (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/node/response.js:110:17)
        at Response._setStatusProperties (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/response-base.js:107:48)
        at new Response (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/node/response.js:41:8)
        at Test._emitResponse (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/node/index.js:953:20)
        at fn (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/node/index.js:1166:38)
        at IncomingMessage.<anonymous> (/var/lib/buildkite-agent/builds/kb-n2-4-spot-59aeabed1de730b1/elastic/kibana-on-merge/kibana/node_modules/superagent/src/node/parsers/json.js:19:7)
        at IncomingMessage.emit (node:events:526:35)
        at endReadableNT (node:internal/streams/readable:1589:12)
        at processTicksAndRejections (node:internal/process/task_queues:82:21) {
      status: 500,
      text: `{"statusCode":500,"error":"Internal Server Error","message":"Cannot read properties of undefined (reading '_source')","attributes":{"data":{},"_inspect":[]}}`,
      method: 'GET',
      path: '/internal/apm/services/opbeans-node/agent?start=2021-08-03T06%3A50%3A15.910Z&end=2021-08-03T07%3A20%3A15.910Z'
    },
    created: false,
    accepted: false,
    noContent: false,
    badRequest: false,
    unauthorized: false,
    notAcceptable: false,
    forbidden: false,
    notFound: false,
    unprocessableEntity: false,
    type: 'application/json',
    charset: 'utf-8',
    links: {},
    setEncoding: [Function: bound ],
    redirects: [],
    _body: {
      statusCode: 500,
      error: 'Internal Server Error',
      message: "Cannot read properties of undefined (reading '_source')",
      attributes: [Object]
    },
    pipe: [Function (anonymous)],
    [Symbol(kCapture)]: false
  }
}

First failure: CI Build - main

kibanamachine commented 7 months ago

New failure: CI Build - main

elasticmachine commented 7 months ago

Pinging @elastic/apm-ui (Team:APM)

mistic commented 7 months ago

Skipped.

main: 6f8c275

bhavyarm commented 6 months ago

@cauemarcondes is this skipped test handled? If so, can we close this issue? Thanks very much!

cauemarcondes commented 6 months ago

This test is still skipped... I moved it back to our board and I'll look into it when I get the chance.

crespocarlos commented 2 months ago

This is a strange problem. The exception is thrown here and that line can only reached, if total > 0, but if total > 0, it doesn't make sense for the hits array to be empty.