Skip to content

Commit 15e1ddd

Browse files
chojomokandrewlockbouwkastzacharycmontoya
authored
[tracing] add OTEL quartz autoinstrumentation (#7192)
## Summary of changes * Added a new `QuartzDiagnosticObserver` to enable OTEL instrumentation from Quartz. * v3 uses a Diagnostic Observer to make Activities. * v4 uses ActivitySource. * v4 snapshot generated from version `4.0.0-preview-20250718-1741` of the library * Integration is supported for `v3.1` of Quartz. * Requires `DD_TRACE_OTEL_ENABLED=true` for tracing to work. * Currently not available for .NET framework due to our DiagnosticObserver infrastructure not being compatible with .NET Framework. Will look into expanding support in the future. * Changes to Activity5 * Added setters to the following properties * `DisplayName` * `Kind` - this is private but with bytecode we are able to call the setter. ## Reason for change This change enables Datadog APM to trace Quartz.NET job scheduling and execution events, providing observability for background job processing. It expands instrumentation coverage for .NET applications using Quartz, addressing a gap in our supported integrations. ## Implementation details * We create an Diagnostic Observer to listen on "Quartz" so the built in OTEL Instrumentation can be used and transformed into a Datadog Span. ## Test coverage * Tests from v3.1 of Quartz to the latest version * Tests for upcoming v4 from the prerelease is available and tested on locally. ## Other details ### Activity Kind Setter * We used the same implementation as the `opentelemetry-dotnet-contrib` repo which can be found in this [code snippet](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/d22fdd94a54d64b311620c4c8e8f49e652f790b2/src/Shared/ActivityInstrumentationHelper.cs#L10) * since we don't have access to the classes as the contrib repo, we used bytecode to avoid casting issues. <!-- ⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. --> --------- Co-authored-by: Andrew Lock <[email protected]> Co-authored-by: Steven Bouwkamp <[email protected]> Co-authored-by: Zach Montoya <[email protected]>
1 parent 23911c1 commit 15e1ddd

35 files changed

+2150
-11
lines changed

Datadog.Trace.Samples.g.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AWS.S3", "tracer\te
437437
EndProject
438438
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.GoogleProtobuf", "tracer\test\test-applications\integrations\Samples.GoogleProtobuf\Samples.GoogleProtobuf.csproj", "{EF8C4CCE-E79C-4D78-BF31-222A11E198B9}"
439439
EndProject
440+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Quartz", "tracer\test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj", "{CF69BC17-1527-425A-9B02-8E223BC31DB8}"
441+
EndProject
440442
Global
441443
GlobalSection(SolutionConfigurationPlatforms) = preSolution
442444
Debug|Any CPU = Debug|Any CPU
@@ -1051,6 +1053,10 @@ Global
10511053
{EF8C4CCE-E79C-4D78-BF31-222A11E198B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
10521054
{EF8C4CCE-E79C-4D78-BF31-222A11E198B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
10531055
{EF8C4CCE-E79C-4D78-BF31-222A11E198B9}.Release|Any CPU.Build.0 = Release|Any CPU
1056+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1057+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
1058+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
1059+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Release|Any CPU.Build.0 = Release|Any CPU
10541060
EndGlobalSection
10551061
GlobalSection(NestedProjects) = preSolution
10561062
{9518425A-36A5-4B8F-B0B8-6137DB88441D} = {8CEC2042-F11C-49F5-A674-2355793B600A}
@@ -1225,5 +1231,6 @@ Global
12251231
{E2EDDD17-B5E6-4240-9EF8-34F2D274AA19} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
12261232
{0C0578CB-3B67-4F95-8547-206CD2A560CD} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
12271233
{EF8C4CCE-E79C-4D78-BF31-222A11E198B9} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
1234+
{CF69BC17-1527-425A-9B02-8E223BC31DB8} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
12281235
EndGlobalSection
12291236
EndGlobal

Datadog.Trace.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks.OpenTelemetry.In
615615
EndProject
616616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Datadog.AzureFunctions", "tracer\src\Datadog.AzureFunctions\Datadog.AzureFunctions.csproj", "{BB073E40-F46D-E52B-662E-395EED834111}"
617617
EndProject
618+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Quartz", "tracer\test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj", "{CF69BC17-1527-425A-9B02-8E223BC31DB8}"
619+
EndProject
618620
Global
619621
GlobalSection(SolutionConfigurationPlatforms) = preSolution
620622
Debug|Any CPU = Debug|Any CPU
@@ -1483,6 +1485,10 @@ Global
14831485
{BB073E40-F46D-E52B-662E-395EED834111}.Debug|Any CPU.Build.0 = Debug|Any CPU
14841486
{BB073E40-F46D-E52B-662E-395EED834111}.Release|Any CPU.ActiveCfg = Release|Any CPU
14851487
{BB073E40-F46D-E52B-662E-395EED834111}.Release|Any CPU.Build.0 = Release|Any CPU
1488+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1489+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
1490+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
1491+
{CF69BC17-1527-425A-9B02-8E223BC31DB8}.Release|Any CPU.Build.0 = Release|Any CPU
14861492
EndGlobalSection
14871493
GlobalSection(SolutionProperties) = preSolution
14881494
HideSolutionNode = FALSE
@@ -1724,6 +1730,7 @@ Global
17241730
{501AD343-1951-FF43-0C7F-3FE3FDF5A660} = {E5439139-6F94-44FA-9590-C32FCC1C7A93}
17251731
{BD7ADF79-C948-5CC7-6BE8-A7FF8DF882C3} = {E5439139-6F94-44FA-9590-C32FCC1C7A93}
17261732
{BB073E40-F46D-E52B-662E-395EED834111} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB}
1733+
{CF69BC17-1527-425A-9B02-8E223BC31DB8} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
17271734
EndGlobalSection
17281735
GlobalSection(ExtensibilityGlobals) = postSolution
17291736
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}

tracer/build/PackageVersionsGeneratorDefinitions.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
[
2+
{
3+
"IntegrationName": "Quartz",
4+
"SampleProjectName": "Samples.Quartz",
5+
"NugetPackageSearchName": "Quartz",
6+
"MinVersion": "3.1.0",
7+
"MaxVersionExclusive": "4.0.0",
8+
"SpecificVersions": [
9+
"3.*.*"
10+
],
11+
"VersionConditions": [{
12+
"MinVersion": "4.0.0",
13+
"IncludeOnlyTargetFrameworks": ["net8.0","net9.0", "net10.0"]
14+
}]
15+
},
216
{
317
"IntegrationName": "AwsSdk",
418
"SampleProjectName": "Samples.AWS.DynamoDBv2",

tracer/build/PackageVersionsLatestMajors.g.props

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,54 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely
1212
-->
1313
<Project>
1414
<ItemGroup>
15+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
16+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
17+
<TargetFramework>netcoreapp2.1</TargetFramework>
18+
<RequiresDockerDependency>None</RequiresDockerDependency>
19+
<SampleName>Samples.Quartz</SampleName>
20+
</PackageVersionSample>
21+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
22+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
23+
<TargetFramework>netcoreapp3.0</TargetFramework>
24+
<RequiresDockerDependency>None</RequiresDockerDependency>
25+
<SampleName>Samples.Quartz</SampleName>
26+
</PackageVersionSample>
27+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
28+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
29+
<TargetFramework>netcoreapp3.1</TargetFramework>
30+
<RequiresDockerDependency>None</RequiresDockerDependency>
31+
<SampleName>Samples.Quartz</SampleName>
32+
</PackageVersionSample>
33+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
34+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
35+
<TargetFramework>net5.0</TargetFramework>
36+
<RequiresDockerDependency>None</RequiresDockerDependency>
37+
<SampleName>Samples.Quartz</SampleName>
38+
</PackageVersionSample>
39+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
40+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
41+
<TargetFramework>net6.0</TargetFramework>
42+
<RequiresDockerDependency>None</RequiresDockerDependency>
43+
<SampleName>Samples.Quartz</SampleName>
44+
</PackageVersionSample>
45+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
46+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
47+
<TargetFramework>net7.0</TargetFramework>
48+
<RequiresDockerDependency>None</RequiresDockerDependency>
49+
<SampleName>Samples.Quartz</SampleName>
50+
</PackageVersionSample>
51+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
52+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
53+
<TargetFramework>net8.0</TargetFramework>
54+
<RequiresDockerDependency>None</RequiresDockerDependency>
55+
<SampleName>Samples.Quartz</SampleName>
56+
</PackageVersionSample>
57+
<PackageVersionSample Include="test\test-applications\integrations\Samples.Quartz\Samples.Quartz.csproj">
58+
<Properties>ApiVersion=3.15.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
59+
<TargetFramework>net9.0</TargetFramework>
60+
<RequiresDockerDependency>None</RequiresDockerDependency>
61+
<SampleName>Samples.Quartz</SampleName>
62+
</PackageVersionSample>
1563
<PackageVersionSample Include="test\test-applications\integrations\Samples.AWS.DynamoDBv2\Samples.AWS.DynamoDBv2.csproj">
1664
<Properties>ApiVersion=3.7.500.14;RestoreRecursive=false;BuildProjectReferences=false</Properties>
1765
<TargetFramework>net48</TargetFramework>

0 commit comments

Comments
 (0)