diff --git a/.github/ISSUE_TEMPLATE/comp_instrumentation_sqlclient.md b/.github/ISSUE_TEMPLATE/comp_instrumentation_sqlclient.md
new file mode 100644
index 0000000000..c74e59ca99
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/comp_instrumentation_sqlclient.md
@@ -0,0 +1,41 @@
+---
+name: OpenTelemetry.Instrumentation.SqlClient
+about: Issue with OpenTelemetry.Instrumentation.SqlClient
+labels: comp:instrumentation.sqlclient
+---
+
+# Issue with OpenTelemetry.Instrumentation.SqlClient
+
+List of [all OpenTelemetry NuGet
+packages](https://www.nuget.org/profiles/OpenTelemetry) and version that you are
+using (e.g. `OpenTelemetry 1.3.2`):
+
+* TBD
+
+Runtime version (e.g. `net462`, `net48`, `net6.0`, `net7.0` etc. You can
+find this information from the `*.csproj` file):
+
+* TBD
+
+**Is this a feature request or a bug?**
+
+* [ ] Feature Request
+* [ ] Bug
+
+**What is the expected behavior?**
+
+What do you expect to see?
+
+**What is the actual behavior?**
+
+What did you see instead? If you are reporting a bug, create a self-contained
+project using the template of your choice and apply the minimum required code to
+result in the issue you're observing. We will close this issue if:
+
+* The repro project you share with us is complex. We can't investigate custom
+ projects, so don't point us to such, please.
+* If we can not reproduce the behavior you're reporting.
+
+## Additional Context
+
+Add any other context about the feature request here.
diff --git a/.github/codecov.yml b/.github/codecov.yml
index 74701f6a61..c38a11945c 100644
--- a/.github/codecov.yml
+++ b/.github/codecov.yml
@@ -78,12 +78,17 @@ flags:
paths:
- src/OpenTelemetry.Instrumentation.Runtime
+ unittests-Instrumentation.SqlClient:
+ carryforward: true
+ paths:
+ - src/OpenTelemetry.Instrumentation.SqlClient
+
unittests-Instrumentation.StackExchangeRedis:
carryforward: true
paths:
- src/OpenTelemetry.Instrumentation.StackExchangeRedis
- unittests-Instrumentation.Wcf:
+ unittests-Instrumentation.Wcf:
carryforward: true
paths:
- src/OpenTelemetry.Instrumentation.Wcf
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 150c7017dc..417259c488 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,6 +39,7 @@ jobs:
redis: ['*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**', 'examples/redis/**', '!**/*.md']
resourcedetectors: ['*/OpenTelemetry.ResourceDetectors.*/**', '!**/*.md']
runtime: ['*/OpenTelemetry.Instrumentation.Runtime*/**', 'examples/runtime-instrumentation/**', '!**/*.md']
+ sqlclient: ['*/OpenTelemetry.Instrumentation.SqlClient*/**', '!**/*.md']
wcf: ['*/OpenTelemetry.Instrumentation.Wcf*/**', 'examples/wcf/**', '!**/*.md']
solution: [
'src/**',
@@ -64,6 +65,7 @@ jobs:
'!*/OpenTelemetry.PersistentStorage*/**',
'!*/OpenTelemetry.Instrumentation.Process*/**',
'!examples/process-instrumentation/**',
+ '!*/OpenTelemetry.Instrumentation.SqlClient*/**',
'!*/OpenTelemetry.Instrumentation.StackExchangeRedis*/**',
'!examples/redis/**',
'!*/OpenTelemetry.Instrumentation.Runtime*/**',
@@ -254,6 +256,17 @@ jobs:
project-name: OpenTelemetry.Instrumentation.Runtime
code-cov-name: Instrumentation.Runtime
+ build-test-sqlclient:
+ needs: detect-changes
+ if: |
+ contains(needs.detect-changes.outputs.changes, 'sqlclient')
+ || contains(needs.detect-changes.outputs.changes, 'build')
+ || contains(needs.detect-changes.outputs.changes, 'shared')
+ uses: ./.github/workflows/Component.BuildTest.yml
+ with:
+ project-name: OpenTelemetry.Instrumentation.SqlClient
+ code-cov-name: Instrumentation.SqlClient
+
build-test-wcf:
needs: detect-changes
if: |
@@ -303,6 +316,7 @@ jobs:
OpenTelemetry.Instrumentation.Owin.Tests.csproj,
OpenTelemetry.Instrumentation.Process.Tests.csproj,
OpenTelemetry.Instrumentation.Runtime.Tests.csproj,
+ OpenTelemetry.Instrumentation.SqlClient.Tests.csproj,
OpenTelemetry.Instrumentation.StackExchangeRedis.Tests.csproj,
OpenTelemetry.Instrumentation.Wcf.Tests.csproj,
OpenTelemetry.PersistentStorage.FileSystem.Tests.csproj,
@@ -365,6 +379,7 @@ jobs:
|| contains(needs.detect-changes.outputs.changes, 'geneva')
|| contains(needs.detect-changes.outputs.changes, 'onecollector')
|| contains(needs.detect-changes.outputs.changes, 'redis')
+ || contains(needs.detect-changes.outputs.changes, 'sqlclient')
|| contains(needs.detect-changes.outputs.changes, 'shared')
uses: ./.github/workflows/verifyaotcompat.yml
@@ -389,6 +404,7 @@ jobs:
build-test-redis,
build-test-redis-integration,
build-test-runtime,
+ build-test-sqlclient,
build-test-wcf,
build-test-solution,
verify-aot-compat
diff --git a/.github/workflows/package-Instrumentation.SqlClient.yml b/.github/workflows/package-Instrumentation.SqlClient.yml
new file mode 100644
index 0000000000..1226183035
--- /dev/null
+++ b/.github/workflows/package-Instrumentation.SqlClient.yml
@@ -0,0 +1,21 @@
+name: Pack OpenTelemetry.Instrumentation.SqlClient
+
+on:
+ workflow_dispatch:
+ inputs:
+ logLevel:
+ description: 'Log level'
+ required: true
+ default: 'warning'
+ push:
+ tags:
+ - 'Instrumentation.SqlClient-*' # trigger when we create a tag with prefix "Instrumentation.SqlClient-"
+
+jobs:
+ call-build-test-pack:
+ permissions:
+ contents: write
+ uses: ./.github/workflows/Component.Package.yml
+ with:
+ project-name: OpenTelemetry.Instrumentation.SqlClient
+ secrets: inherit
diff --git a/build/Common.props b/build/Common.props
index 358fe0ba41..343b061a6a 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -33,6 +33,7 @@
[8.0.1,)
[2.1.0,5.0)
[3.1.0,)
+ 8.0.0
[1.0.3,2.0)
[4.2.2,5.0)
[3.11.0-beta1.23525.2]
diff --git a/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj b/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj
new file mode 100644
index 0000000000..3cde77cdda
--- /dev/null
+++ b/build/Projects/OpenTelemetry.Instrumentation.SqlClient.proj
@@ -0,0 +1,32 @@
+
+
+
+ $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.Parent.FullName)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln
index e2de239aec..6d755deb10 100644
--- a/opentelemetry-dotnet-contrib.sln
+++ b/opentelemetry-dotnet-contrib.sln
@@ -42,9 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\package-Exporter.OneCollector.yml = .github\workflows\package-Exporter.OneCollector.yml
.github\workflows\package-Exporter.Stackdriver.yml = .github\workflows\package-Exporter.Stackdriver.yml
.github\workflows\package-Extensions.AWS.yml = .github\workflows\package-Extensions.AWS.yml
- .github\workflows\package-Extensions.AWSXRay.yml = .github\workflows\package-Extensions.AWSXRay.yml
- .github\workflows\package-Extensions.AzureMonitor.yml = .github\workflows\package-Extensions.AzureMonitor.yml
- .github\workflows\package-Extensions.Docker.yml = .github\workflows\package-Extensions.Docker.yml
.github\workflows\package-Extensions.Enrichment.yml = .github\workflows\package-Extensions.Enrichment.yml
.github\workflows\package-Extensions.yml = .github\workflows\package-Extensions.yml
.github\workflows\package-Instrumentation.AspNet.yml = .github\workflows\package-Instrumentation.AspNet.yml
@@ -61,6 +58,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\package-Instrumentation.Process.yml = .github\workflows\package-Instrumentation.Process.yml
.github\workflows\package-Instrumentation.Quartz.yml = .github\workflows\package-Instrumentation.Quartz.yml
.github\workflows\package-Instrumentation.Runtime.yml = .github\workflows\package-Instrumentation.Runtime.yml
+ .github\workflows\package-Instrumentation.SqlClient.yml = .github\workflows\package-Instrumentation.SqlClient.yml
.github\workflows\package-Instrumentation.StackExchangeRedis.yml = .github\workflows\package-Instrumentation.StackExchangeRedis.yml
.github\workflows\package-Instrumentation.Wcf.yml = .github\workflows\package-Instrumentation.Wcf.yml
.github\workflows\package-PersistentStorage.yml = .github\workflows\package-PersistentStorage.yml
@@ -324,6 +322,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{04
build\Projects\OpenTelemetry.Instrumentation.Owin.proj = build\Projects\OpenTelemetry.Instrumentation.Owin.proj
build\Projects\OpenTelemetry.Instrumentation.Process.proj = build\Projects\OpenTelemetry.Instrumentation.Process.proj
build\Projects\OpenTelemetry.Instrumentation.Runtime.proj = build\Projects\OpenTelemetry.Instrumentation.Runtime.proj
+ build\Projects\OpenTelemetry.Instrumentation.SqlClient.proj = build\Projects\OpenTelemetry.Instrumentation.SqlClient.proj
build\Projects\OpenTelemetry.Instrumentation.StackExchangeRedis.proj = build\Projects\OpenTelemetry.Instrumentation.StackExchangeRedis.proj
build\Projects\OpenTelemetry.Instrumentation.Wcf.proj = build\Projects\OpenTelemetry.Instrumentation.Wcf.proj
build\Projects\OpenTelemetry.PersistentStorage.proj = build\Projects\OpenTelemetry.PersistentStorage.proj
@@ -347,6 +346,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.ResourceDetec
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.PersistentStorage.Abstractions.Tests", "test\OpenTelemetry.PersistentStorage.Abstractions.Tests\OpenTelemetry.PersistentStorage.Abstractions.Tests.csproj", "{7AD707F9-DC6D-430A-8834-D5DCD517BF6E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Instrumentation.SqlClient", "src\OpenTelemetry.Instrumentation.SqlClient\OpenTelemetry.Instrumentation.SqlClient.csproj", "{737D1A9E-5A1A-4F4F-830B-E98ED100994C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Instrumentation.SqlClient.Tests", "test\OpenTelemetry.Instrumentation.SqlClient.Tests\OpenTelemetry.Instrumentation.SqlClient.Tests.csproj", "{9C996130-74D7-4FB7-8277-2EE6EBA2BFA6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -693,6 +696,14 @@ Global
{7AD707F9-DC6D-430A-8834-D5DCD517BF6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7AD707F9-DC6D-430A-8834-D5DCD517BF6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AD707F9-DC6D-430A-8834-D5DCD517BF6E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {737D1A9E-5A1A-4F4F-830B-E98ED100994C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {737D1A9E-5A1A-4F4F-830B-E98ED100994C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {737D1A9E-5A1A-4F4F-830B-E98ED100994C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {737D1A9E-5A1A-4F4F-830B-E98ED100994C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9C996130-74D7-4FB7-8277-2EE6EBA2BFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9C996130-74D7-4FB7-8277-2EE6EBA2BFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9C996130-74D7-4FB7-8277-2EE6EBA2BFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9C996130-74D7-4FB7-8277-2EE6EBA2BFA6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -796,6 +807,8 @@ Global
{033CA8D4-1529-413A-B244-07958D5F9A48} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63}
{36271347-2055-438E-9659-B71542A17A73} = {2097345F-4DD3-477D-BC54-A922F9B2B402}
{7AD707F9-DC6D-430A-8834-D5DCD517BF6E} = {2097345F-4DD3-477D-BC54-A922F9B2B402}
+ {737D1A9E-5A1A-4F4F-830B-E98ED100994C} = {22DF5DC0-1290-4E83-A9D8-6BB7DE3B3E63}
+ {9C996130-74D7-4FB7-8277-2EE6EBA2BFA6} = {2097345F-4DD3-477D-BC54-A922F9B2B402}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B0816796-CDB3-47D7-8C3C-946434DE3B66}
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Instrumentation.SqlClient/.publicApi/PublicAPI.Shipped.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.SqlClient/.publicApi/PublicAPI.Unshipped.txt
new file mode 100644
index 0000000000..82f785235c
--- /dev/null
+++ b/src/OpenTelemetry.Instrumentation.SqlClient/.publicApi/PublicAPI.Unshipped.txt
@@ -0,0 +1,18 @@
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.EnableConnectionLevelAttributes.get -> bool
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.EnableConnectionLevelAttributes.set -> void
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.Enrich.get -> System.Action
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.Enrich.set -> void
+OpenTelemetry.Instrumentation.SqlClient.SqlClientTraceInstrumentationOptions.Filter.get -> System.Func