-
Notifications
You must be signed in to change notification settings - Fork 891
SqlClient instrumentation to support Microsoft.Data.SqlClient EventSource #1599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3cc6571
Listen to MDS EvenSource as well
mbakalov af46235
Use SqlEventSourceListener on NETFRAMEWORK only
mbakalov 7437183
Better comments
mbakalov 2ef7a4d
CHANGELOG updates + minor code clarity
mbakalov 12b5c1e
Run EventSource tests for MDS source as well
mbakalov af7ca38
Default capture text to true
mbakalov 3ec91f2
Update readme for new SetStatementText behavior
mbakalov 4d90613
Minor md formatting fix
mbakalov db50f01
Merge branch 'master' into mds-netfx
mbakalov 1d0b911
Merge branch 'master' into mds-netfx
cijothomas fc73c50
Merge branch 'master' into mds-netfx
cijothomas c2e5e69
Default command text capture to false
mbakalov 6f5a2ac
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
mbakalov 4cb6823
Merge branch 'mds-netfx' of https://github.com/mbakalov/opentelemetry…
mbakalov 3735142
Markdown cleanup
mbakalov 9e975c8
Merge branch 'master' into mds-netfx
cijothomas 6511d3b
Merge branch 'master' into mds-netfx
cijothomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlActivitySourceHelper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // <copyright file="SqlActivitySourceHelper.cs" company="OpenTelemetry Authors"> | ||
| // Copyright The OpenTelemetry Authors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // </copyright> | ||
| using System; | ||
| using System.Diagnostics; | ||
|
|
||
| namespace OpenTelemetry.Instrumentation.SqlClient.Implementation | ||
| { | ||
| /// <summary> | ||
| /// Helper class to hold common properties used by both SqlClientDiagnosticListener on .NET Core | ||
| /// and SqlEventSourceListener on .NET Framework. | ||
| /// </summary> | ||
| internal class SqlActivitySourceHelper | ||
| { | ||
| public const string ActivitySourceName = "OpenTelemetry.SqlClient"; | ||
| public const string ActivityName = ActivitySourceName + ".Execute"; | ||
|
|
||
| public const string MicrosoftSqlServerDatabaseSystemName = "mssql"; | ||
|
|
||
| private static readonly Version Version = typeof(SqlActivitySourceHelper).Assembly.GetName().Version; | ||
| #pragma warning disable SA1202 // Elements should be ordered by access <- In this case, Version MUST come before ActivitySource otherwise null ref exception is thrown. | ||
| internal static readonly ActivitySource ActivitySource = new ActivitySource(ActivitySourceName, Version.ToString()); | ||
| #pragma warning restore SA1202 // Elements should be ordered by access | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Might be better to move this definition to semantic conventions, that's where it came from (https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/database.md#connection-level-attributes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll update this! Other things ("db.statement") are being pulled from semantic conventions so better to be consistent.