# Generate spans for org.postgresql.copy.CopyManager

**URL:** <https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394>\
**Category:** APM\
**Created:** [March 28, 2019, 4:52pm UTC](https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394 "2019-03-28T16:52:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OrangeDog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/orangedog/32/4630_2.png) [@OrangeDog](https://discuss.elastic.co/u/OrangeDog)\
**Post date:** [March 28, 2019, 4:52pm UTC](https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394/1 "2019-03-28T16:52:58Z")

</div>

You can add them with `trace_methods`, but that doesn't capture the SQL query for the `span.name` and `context.db.statement`.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [April 1, 2019, 7:34am UTC](https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394/2 "2019-04-01T07:34:26Z")

</div>

Hi and thanks for your question 🙂

So you basically need an option to capture parameters for the `trace_methods` config? We have an issue for that: [https://github.com/elastic/apm-agent-java/issues/427](https://github.com/elastic/apm-agent-java/issues/427). Feel free to upvote that which helps us prioritizing it.

Note that this would probably not add the query to `context.db.statement` but rather something like `context.arguments.0`, for example.

Or do you propose we should have dedicated support for `org.postgresql.copy.CopyManager`? I'm not really familiar with that class. Out of curiosity: what do you use it for and why don't you use the regular `javax.sql.Statement` API?

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![OrangeDog](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/orangedog/32/4630_2.png) [@OrangeDog](https://discuss.elastic.co/u/OrangeDog)\
**Post date:** [April 1, 2019, 9:30am UTC](https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394/3 "2019-04-01T09:30:56Z")

</div>

I was proposing dedicated support, to match the other DB spans and allow you to deal with the call nesting (e.g. `copyTo(*,*)` calls `copyTo(*,*,*)` and both get a span created when using `trace_methods`).

That class is necessary in order to use [`COPY ... STDIN/STDOUT` statements](https://www.postgresql.org/docs/10/sql-copy.html), because the JDBC API only supports attaching streams to individual fields, not the whole statement.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 22, 2019, 5:30am UTC](https://discuss.elastic.co/t/generate-spans-for-org-postgresql-copy-copymanager/174394/4 "2019-04-22T05:30:57Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
