question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add automatic instrumentation for Devart.Data.PostgreSql

See original GitHub issue

This issue is related to this one, which I created yesterday (closed): https://github.com/DataDog/dd-trace-dotnet/issues/1747

Describe the bug Ado.net synchronous read is not traced:

2021-09-08 11:40:28.666 +00:00 [DBG] Span closed: [s_id: 4795863080939472323, p_id: null, t_id: 5308954005560448074] for (Service: fxk_api-recette, Resource: GET /api/welcome/offer, Operation: aspnet.request, Tags: [cookie (tag):_ga=GA1.2.1714330434.1623414683; _fbp=fb.1.1623414683102.364088884; _hjid=59f54b48-e10a-4b68-882f-bc8d990dbf31; ABTasty=uid=xnd6xmyhcg1xc3e8&fst=1623414682945&pst=1629739966096&cst=1629981578042&ns=9&pvt=11&pvis=11&th=,_dd.rule_psr (metric):1env (tag):recette,version (tag):0.0.1,span.kind (tag):server,http.status_code (tag):200,http.method (tag):GET,http.request.headers.host (tag):api-recette.finexkap.com,http.url (tag):/api/welcome/offer,language (tag):dotnet,_dd.limit_psr (metric):1,_sampling_priority_v1 (metric):1,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:29.483 +00:00 [DBG] Flushing 2 spans across 1 traces
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:29.483 +00:00 [DBG] Sending 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:29.485 +00:00 [DBG] Successfully sent 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.200 +00:00 [DBG] Span started: [s_id: 3290184982944983613, p_id: null, t_id: 658751263522035331]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.200 +00:00 [DBG] Using the global sampling rate: 1
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.200 +00:00 [DBG] Matched on rule global-rate-rule. Applying rate of 1 to trace id 658751263522035331
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.217 +00:00 [DBG] Span started: [s_id: 1736127367945471736, p_id: 3290184982944983613, t_id: 658751263522035331]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.254 +00:00 [DBG] Span closed: [s_id: 1736127367945471736, p_id: 3290184982944983613, t_id: 658751263522035331] for (Service: fxk_api-recette-http-client, Resource: POST logs.finexkap.com:9200/_bulk, Operation: http.request, Tags: [env (tag):recette,span.kind (tag):client,http.status_code (tag):200,http.method (tag):POST,http.url (tag):http://logs.finexkap.com:9200/_bulk,component (tag):WebRequest,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.255 +00:00 [DBG] Span closed: [s_id: 3290184982944983613, p_id: null, t_id: 658751263522035331] for (Service: fxk_api-recette-elasticsearch, Resource: _bulk, Operation: elasticsearch.query, Tags: [_dd.rule_psr (metric):1env (tag):recette,span.kind (tag):client,component (tag):elasticsearch-net,elasticsearch.method (tag):POST,elasticsearch.url (tag):http://logs.finexkap.com:9200/_bulk,_dd.limit_psr (metric):1,_sampling_priority_v1 (metric):1,_dd.tracer_kr (metric):0,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.497 +00:00 [DBG] Flushing 2 spans across 1 traces
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.497 +00:00 [DBG] Sending 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:40:30.498 +00:00 [DBG] Successfully sent 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }


When it comes to async DB read:


2021-09-08 11:33:21.206 +00:00 [DBG] Span closed: [s_id: 8188927558140152582, p_id: 8610132926320069806, t_id: 1263911677603922833] for (Service: fxk_api-recette, Resource: GET api/welcome/offer-async, Operation: aspnet-webapi.request, Tags: [env (tag):recette,version (tag):0.0.1,span.kind (tag):server,http.status_code (tag):200,http.method (tag):GET,http.request.headers.host (tag):api-recette.finexkap.com,http.url (tag):https://api-recette.finexkap.com/api/welcome/offer-async,language (tag):dotnet,aspnet.route (tag):api/welcome/offer-async,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:21.207 +00:00 [DBG] Span closed: [s_id: 8610132926320069806, p_id: null, t_id: 1263911677603922833] for (Service: fxk_api-recette, Resource: GET /api/welcome/offer-async, Operation: aspnet.request, Tags: [cookie (tag):_ga=GA1.2.1714330434.1623414683; _fbp=fb.1.1623414683102.364088884; _hjid=59f54b48-e10a-4b68-882f-bc8d990dbf31; ABTasty=uid=xnd6xmyhcg1xc3e8&fst=1623414682945&pst=1629739966096&cst=1629981578042&ns=9&pvt=11&pvis=11&th=,_dd.rule_psr (metric):1env (tag):recette,version (tag):0.0.1,span.kind (tag):server,http.status_code (tag):200,http.method (tag):GET,http.request.headers.host (tag):api-recette.finexkap.com,http.url (tag):/api/welcome/offer-async,language (tag):dotnet,_dd.limit_psr (metric):1,_sampling_priority_v1 (metric):1,_dd.tracer_kr (metric):0,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:21.218 +00:00 [DBG] Flushing 3 spans across 1 traces
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:21.218 +00:00 [DBG] Sending 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:21.219 +00:00 [DBG] Successfully sent 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:22.997 +00:00 [DBG] Span started: [s_id: 4851137280635997827, p_id: null, t_id: 1404588826423968475]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:22.997 +00:00 [DBG] Using the global sampling rate: 1
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:22.997 +00:00 [DBG] Matched on rule global-rate-rule. Applying rate of 1 to trace id 1404588826423968475
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:22.997 +00:00 [DBG] Span started: [s_id: 7040358332828582181, p_id: 4851137280635997827, t_id: 1404588826423968475]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:23.026 +00:00 [DBG] Span closed: [s_id: 7040358332828582181, p_id: 4851137280635997827, t_id: 1404588826423968475] for (Service: fxk_api-recette-http-client, Resource: POST logs.finexkap.com:9200/_bulk, Operation: http.request, Tags: [env (tag):recette,span.kind (tag):client,http.status_code (tag):200,http.method (tag):POST,http.url (tag):http://logs.finexkap.com:9200/_bulk,component (tag):WebRequest,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:23.027 +00:00 [DBG] Span closed: [s_id: 4851137280635997827, p_id: null, t_id: 1404588826423968475] for (Service: fxk_api-recette-elasticsearch, Resource: _bulk, Operation: elasticsearch.query, Tags: [_dd.rule_psr (metric):1env (tag):recette,span.kind (tag):client,component (tag):elasticsearch-net,elasticsearch.method (tag):POST,elasticsearch.url (tag):http://logs.finexkap.com:9200/_bulk,_dd.limit_psr (metric):1,_sampling_priority_v1 (metric):1,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:23.232 +00:00 [DBG] Flushing 2 spans across 1 traces
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:23.232 +00:00 [DBG] Sending 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:23.233 +00:00 [DBG] Successfully sent 1 traces to the DD agent
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:24.990 +00:00 [DBG] Span started: [s_id: 7953054863255300442, p_id: null, t_id: 8467535130495667707]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:24.990 +00:00 [DBG] Using the global sampling rate: 1
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:24.990 +00:00 [DBG] Matched on rule global-rate-rule. Applying rate of 1 to trace id 8467535130495667707
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:24.994 +00:00 [DBG] Span started: [s_id: 3062152272391297166, p_id: 7953054863255300442, t_id: 8467535130495667707]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.006 +00:00 [DBG] Span started: [s_id: 9164475541797025064, p_id: 3062152272391297166, t_id: 8467535130495667707]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.028 +00:00 [DBG] Span started: [s_id: 5325864157869574303, p_id: null, t_id: 7896450098186979059]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.028 +00:00 [DBG] Using the global sampling rate: 1
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.028 +00:00 [DBG] Matched on rule global-rate-rule. Applying rate of 1 to trace id 7896450098186979059
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.028 +00:00 [DBG] Span started: [s_id: 5900521685181668491, p_id: 5325864157869574303, t_id: 7896450098186979059]
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }
2021-09-08 11:33:25.028 +00:00 [DBG] Span closed: [s_id: 9164475541797025064, p_id: 3062152272391297166, t_id: 8467535130495667707] for (Service: fxk_api-recette-s, Resource: SELECT 
"Limit1"."BuyingStatus",
"Limit1"."Id",
"Limit1"."InvestmentFund",
"Limit1"."CurrencyCode",
"Limit1"."SellerAssignmentId",
"Limit1"."ProductConfigurationId",
"Limit1"."ProposedAt",
"Limit1"."CancelledAt",
"Limit1"."RefusedByFinexkapAt",
"Limit1"."AcceptedByCreditComiteeAt",
"Limit1"."AcceptedByInvestmentCommitteeAt",
"Limit1"."BuyBackAt",
"Limit1"."TreatedAt",
"Limit1".old_funding_request_id,
"Limit1"."TreatedByUserId",
"Limit1"."CreditCommitteeVoteAsked",
"Limit1"."CreditCommitteeVoteAskedAt",
"Limit1"."CreditCommitteeVoteAskedByUserId",
"Limit1"."CreatedAt",
"Limit1"."UpdatedAt",
"Limit1"."LastModifier",
"Limit1"."Intent",
"Limit1"."Seller_Id"
FROM ( SELECT 
	"Extent1"."Id",
	"Extent1"."BuyingStatus",
	"Extent1"."InvestmentFund",
	"Extent1"."CurrencyCode",
	"Extent1"."SellerAssignmentId",
	"Extent1"."ProductConfigurationId",
	"Extent1"."ProposedAt",
	"Extent1"."CancelledAt",
	"Extent1"."RefusedByFinexkapAt",
	"Extent1"."AcceptedByCreditComiteeAt",
	"Extent1"."AcceptedByInvestmentCommitteeAt",
	"Extent1"."BuyBackAt",
	"Extent1"."TreatedAt",
	"Extent1".old_funding_request_id,
	"Extent1"."TreatedByUserId",
	"Extent1"."CreditCommitteeVoteAsked",
	"Extent1"."CreditCommitteeVoteAskedAt",
	"Extent1"."CreditCommitteeVoteAskedByUserId",
	"Extent1"."CreatedAt",
	"Extent1"."UpdatedAt",
	"Extent1"."LastModifier",
	"Extent1"."Intent",
	"Extent1"."Seller_Id"
	FROM "Offer" AS "Extent1"
	WHERE "Extent1"."Id" = :p__linq__0
	LIMIT 2 
)  AS "Limit1", Operation: s.query, Tags: [env (tag):recette,span.kind (tag):client,db.type (tag):s,component (tag):AdoNet,db.name (tag):db_finexkap_recette,db.user (tag):finexkap_recette,out.host (tag):db-recette.finexkap.com,])
{ MachineName: ".", Process: "[17020 w3wp]", AppDomain: "[3 /LM/W3SVC/503/ROOT-2-132755742821154640]", TracerVersion: "1.28.4.0" }

The code is quite simple, just using an entity framework DB read call:


    public Offer GetById(OfferId offerId)
        {
            return _context.Offers.Single(o => o.Id == offerId.Value);
        }

        public async Task<Offer> GetByIdAsync(OfferId offerId)
        {
            return await _context.Offers.SingleAsync(o => o.Id == offerId.Value);
        }

Used packages:

<package id="Devart.Data" version="5.0.2262" targetFramework="net48" />
  <package id="Devart.Data.Linq" version="4.9.1807" targetFramework="net48" />
  <package id="Devart.Data.PostgreSql" version="7.14.1470" targetFramework="net48" />
  <package id="Devart.Data.PostgreSql.Linq" version="4.9.1807" targetFramework="net48" />
  <package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net48" />
  <package id="EntityFramework" version="6.2.0" targetFramework="net48" />
  <package id="EntityFramework.CodeFirstStoreFunctions" version="1.1.0" targetFramework="net48" />

result in datadog apm traces, sync VS async: Sync => image

Async => image

Our version of Datadog.Tracer: 1.28.4

The integration.json not modified after have installed the agent.

Can you please suggest?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewlockcommented, Dec 22, 2021

@yhan In the next version of the tracer (not yet released, will be the version after 2.0.1) we will instrument the DbCommand base class, which should resolve this issue and should mean the Devart.Data.* providers work correctly. Do let us know if this isn’t the case. Thanks.

1reaction
yhancommented, Sep 8, 2021

Hi @andrewlock just the PostgreSQL

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Windows Management Instrumentation (WMI) ...
In this article, I'll show you how to manage and query data in C# using WMI. Pre-requisites. You'll need the following tools to...
Read more >
Workflow Tracking Support - Documentation - Devart
Add the following line to your code: "using Devart.Data.PostgreSql.ActivitiesTracking". Create a TrackingProfile instance. Add tracking queries to the profile.
Read more >
Database Tools for Development and Management | dbForge
dbForge database tools for development and management were designed by Devart for fast and effective work with SQL Server, MySQL, PostgreSQL, and Oracle ......
Read more >
dotConnect for PostgreSQL - Compatibility
Ultimate solution for developing data-related .NET applications. dotConnect for PostgreSQL. Fast; •; Flexible; •; Comprehensive. Feature-rich ADO.
Read more >
dotConnect for PostgreSQL Entity Framework Tutorial
A tutorial on how to create a simple application, connecting to PostgreSQL database and powered by ADO.NET Entity Framework, using Visual Studio 2010....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found