2.6 KiB
2.6 KiB
Using APM for server traces
Kibana ships with the Elastic APM Node.js Agent built-in for debugging purposes. We don't currently merge this to release builds, but it can be very helpful to diagnose or confirm the flow & timing of a request traveling through multiple services.
To use it in Fleet,
- Import the shared apm instance as needed (HTTP handler, service layer, etc)
import { apm } from '../path/to/ingest_manager/server'
- add
apm.startTransaction
and/orapm.startSpan
- TODO: More details around rules / conventions for tracing
- One example from
reporting
plugin:a537f9af50/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts (L30-L31)
- start Kibana with APM enabled (as described in Instrumenting with Elastic APM)
-
via env variable or
config/apm.dev.js
ELASTIC_APM_ACTIVE=true yarn start
or
module.exports = { active: true, };
- By default traces are sent to a remote server, but you can send to a local APM by setting the
serverUrl
value inconfig/apm.dev.js
- TODO: document default server & credentials
-
- Run the code where you added the annotations e.g. make an HTTP request
- Go to
/app/apm#/traces
and see your trace search filter by host, transaction result, etcexample screenshot