We are using SQLBulkCopy.Write ToServerAsync method to write data to tables but these operations are not captured by APM agent.
Agent is subscribed to SqlClientDiagnosticSubscriber
Tried with adding package Elastic.Apm.EntitiyFrameworkcore but didn’t work
This will need a little investigation. The agent listens to events from SqlClient and reports based on those. It's possible that those events are not triggered by the SqlBulkCopy, and we need to listen to other ones.
Which library are you using - System.Data.SqlClient or Microsoft.Data.SqlClient and which version of .NET and the Agent are you running?
I've taken a brief look with a repro app; indeed, calling WriteToServerAsync isn't captured with the current tracing. I've opened a new issue to track this. It's possible that the SqlBulkCopy methods are simply not instrumented. If they are, then we may need to enhance the agent to listen to some new events. That will need some investigation on our end.
A workaround, for now, would be to look at using our public API to manually instrument your own code around calls to the SqlBulkCopy methods.
Thanks @stevejgordon for the investigation.
Since there are lot of SQLBulkCopy operation calls in our application, hence it won't be suitable to manually instrument this piece. We will be looking forward for this fix to happen soon.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.