Skip to content

Conversation

@CodeBlanch
Copy link
Member

Changes

You can now set options.EnableConnectionLevelAttributes = true when configuring Sql Instrumentation to send connection-level attributes. I went with the option because it does come with a slight perf hit, looking up cached values and then setting tags.

Checklist

  • I ran Unit Tests locally.

For significant contributions please make sure you have completed the following items:

  • Design discussion via Gitter with @cijothomas.
  • Changes in public API reviewed

@CodeBlanch CodeBlanch requested a review from a team July 8, 2020 03:19
@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #782 into master will increase coverage by 0.07%.
The diff coverage is 77.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #782      +/-   ##
==========================================
+ Coverage   71.09%   71.16%   +0.07%     
==========================================
  Files         223      223              
  Lines        7009     7061      +52     
  Branches     1180     1191      +11     
==========================================
+ Hits         4983     5025      +42     
- Misses       1710     1722      +12     
+ Partials      316      314       -2     
Impacted Files Coverage Δ
...on.Dependencies/SqlClientInstrumentationOptions.cs 67.30% <66.00%> (-32.70%) ⬇️
....Jaeger/Implementation/JaegerActivityExtensions.cs 89.07% <100.00%> (+0.09%) ⬆️
...aeger/Implementation/JaegerConversionExtensions.cs 87.05% <100.00%> (+0.09%) ⬆️
...plementation/ZipkinActivityConversionExtensions.cs 74.19% <100.00%> (+0.28%) ⬆️
...ipkin/Implementation/ZipkinConversionExtensions.cs 70.96% <100.00%> (+0.31%) ⬆️
...cies/Implementation/SqlClientDiagnosticListener.cs 78.00% <100.00%> (ø)
...elemetry/Trace/Export/BatchingActivityProcessor.cs 75.30% <0.00%> (+1.23%) ⬆️
...ngeRedis/StackExchangeRedisCallsInstrumentation.cs 69.23% <0.00%> (+3.84%) ⬆️
...penTelemetry/Trace/Export/BatchingSpanProcessor.cs 72.36% <0.00%> (+5.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f0cf0b...549d490. Read the comment docs.

{
[SpanAttributeConstants.PeerServiceKey] = 0, // peer.service primary.
["net.peer.name"] = 1, // peer.service first alternative.
[SpanAttributeConstants.NetPeerName] = 1, // peer.service first alternative.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one first and three second alternatives =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah ok yes, the comments suck. It's more like tiers. I was trying to have the official named attributes called out in the spec be taken first, in case multiple matches are found on a span. Spec PR (open-telemetry/opentelemetry-specification#534) never gained much traction.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comments.

}
internal const string MicrosoftSqlServerDatabaseInstanceName = "db.mssql.instance_name";

private static readonly Regex DataSourceRegex = new Regex("^(.*?)(?:[\\\\,]|$)\\s*(.*?)(?:,|$)\\s*(.*)$", RegexOptions.Compiled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be handy to have an example of a string in a comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// </remarks>
public bool EnableConnectionLevelAttributes { get; set; } = false;

internal static SqlConnectionDetails ParseDataSource(string dataSource)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: I'd prefer to move this logic to common helper class and keep options class simple.

@cijothomas cijothomas merged commit 049f72c into open-telemetry:master Jul 8, 2020
@CodeBlanch CodeBlanch deleted the sql-instrumentation-connection-level-attributes branch July 8, 2020 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants