2

I'm using elastic apm to profiling my NestJS application and my apm agent is elastic-apm-node. My ORM is typeOrm and my database is Oracle.

My problem is apm agent does not record database query spans and I can't see database query spans in kibana ui. Can anyone help me?

Banafshe Alipour
  • 1,041
  • 4
  • 12
  • 27

1 Answers1

2

unfortunately oracle is not supported by elastic apm agent. you should wrap your oracleQueryRunner in order to start and end agent spans manually. put this code in your main.ts file:

import { OracleQueryRunner } from 'typeorm/driver/oracle/OracleQueryRunner';

const query = OracleQueryRunner.prototype.query;

OracleQueryRunner.prototype.query = async function (...args) {
  const span = apm.startSpan('query');
  if (span) {
    span.type = 'db';
    span.action = args[0];
  }
  const result = await query.bind(this)(...args);
  if (span) { span.end(); }
  return result;
};