# NodeJS APM does not report postgres queries

**URL:** <https://discuss.elastic.co/t/nodejs-apm-does-not-report-postgres-queries/208984>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [November 21, 2019, 9:57pm UTC](https://discuss.elastic.co/t/nodejs-apm-does-not-report-postgres-queries/208984 "2019-11-21T21:57:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [November 22, 2019, 1:48am UTC](https://discuss.elastic.co/t/nodejs-apm-does-not-report-postgres-queries/208984/2 "2019-11-22T01:48:37Z")

</div>

Hi @chintanp, welcome to the forum!

The agent will only trace database queries if they're made within the context of a sampled transaction. Typically people use the agent with web applications, measuring the latency of requests, with details of operations such as database queries in those requests.

As yours is not a web application, you'll need to add some more instrumentation. Specifically, you'll need to start a transaction using [apm.startTransaction](https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html#apm-start-transaction) before making the query, and end the transaction after the query has completed.

---

_[View the full topic](https://discuss.elastic.co/t/nodejs-apm-does-not-report-postgres-queries/208984)._
