Skip to content

update HttpSemanticConventions for Instrumentation.SqlClient - #4644

Merged
utpilla merged 23 commits into
open-telemetry:mainfrom
TimothyMothra:4484_sqlclient
Jul 13, 2023
Merged

update HttpSemanticConventions for Instrumentation.SqlClient#4644
utpilla merged 23 commits into
open-telemetry:mainfrom
TimothyMothra:4484_sqlclient

Conversation

@TimothyMothra

@TimothyMothra TimothyMothra commented Jul 7, 2023

Copy link
Copy Markdown

Design discussion issue #4484

Changes

  • update Instrumentation.SqlClient SqlClientInstrumentationOptions to emit new attributes.
    • net.peer.name -> server.address
    • net.peer.ip -> server.socket.address
    • net.peer.port ->server.port
  • Tests
    • Added new test method SqlClientInstrumentationOptions_EnableConnectionLevelAttributes_New()
      to test the new attributes.
      When this library is GA, this method will replace SqlClientInstrumentationOptions_EnableConnectionLevelAttributes()
    • Added new test method SqlClientInstrumentationOptions_EnableConnectionLevelAttributes_Dupe()
      to test the scenario when this library emits both new and old attributes.
      When this library is GA, this method can be removed.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@TimothyMothra
TimothyMothra requested a review from a team July 7, 2023 00:00
@codecov

codecov Bot commented Jul 7, 2023

Copy link
Copy Markdown

Codecov Report

Merging #4644 (faa952c) into main (d2b269a) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4644      +/-   ##
==========================================
+ Coverage   84.94%   84.98%   +0.04%     
==========================================
  Files         314      314              
  Lines       12689    12698       +9     
==========================================
+ Hits        10779    10792      +13     
+ Misses       1910     1906       -4     
Impacted Files Coverage Δ
...ation.SqlClient/SqlClientInstrumentationOptions.cs 98.87% <100.00%> (+0.12%) ⬆️

... and 3 files with indirect coverage changes

Comment thread src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md Outdated
Comment thread src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md Outdated
Comment thread src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
Timothy Mothra Lee and others added 2 commits July 7, 2023 16:22
Co-authored-by: Vishwesh Bankwar <vishweshbankwar@users.noreply.github.com>
Comment thread src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md Outdated

@vishweshbankwar vishweshbankwar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - Please add the tests as well

sqlActivity.SetTag(SemanticConventions.AttributeNetPeerName, connectionDetails.ServerHostName);
}
else
if (!string.IsNullOrEmpty(connectionDetails.InstanceName))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, but why is this method in the options class instead of the listener?

We should probably move this code to the listener. That would also make us consistent with other instrumentation libraries for how we read the environment variable.

@utpilla utpilla left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Made some suggestions to update the tests.

Assert.Equal(expectedPort, activity.GetTagValue(SemanticConventions.AttributeServerPort));
}

// Tests for newer HTTP v1.21.0 Semantic Conventions and older attributes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems we still have confusion here, what exactly is "HTTP v1.21.0 Semantic Conventions", @TimothyMothra could you put a concrete link?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Corrected this. New text:

// Tests for v1.21.0 Semantic Conventions for database client calls.
// see the spec https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/trace/semantic_conventions/database.md
// This test emits both the new and older attributes.
// This test method can be deleted when this library is GA.


## Unreleased

* Updated [Semantic Conventions](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/trace/semantic_conventions/database.md).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we're lacking clarity here, https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/CHANGELOG.md#v1210-2023-05-09 clearly called out that semconv got moved to a new repo so it doesn't seem to be part of v1.21.0 release, yet we're referring to 1.21.0 database link, what does that mean and what exactly are we trying to follow?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was already discussed. #4538 (comment)

The semantic-conventions repo doesn't have any versioned releases for me to link to.
@utpilla asked me to link to the former repo which does have versioned tags to link to.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me change the question, which exact semantic convention version do we want to implement in this PR? (I don't think the goal to implement the link that you put here)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We want to implement the breaking changes to the HTTP Semantic Conventions.
These changes are described in the v1.21.0 of the opentelemetry-specification.
https://github.com/open-telemetry/opentelemetry-specification/tree/v1.21.0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

FYI for all persons here.

Semantic-Conventions repo is readying their first release. The version will be v1.21.0. No ETA because they're building out the processes.
https://github.com/open-telemetry/semantic-conventions/blob/df8e53054147acf49918582bd446d0f524170071/CHANGELOG.md

Trask advised that we should link to "main" for now.

I need some time to update all the comments and links. Will need to create a new PR to correct everything that merged already.

@reyang reyang Jul 13, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No ETA because they're building out the processes.

FYI - open-telemetry/semantic-conventions#190

reyang
reyang previously requested changes Jul 12, 2023

@reyang reyang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@reyang
reyang dismissed their stale review July 13, 2023 15:27

Unblocking the PR, please follow up and bring clarity

@TimothyMothra

Copy link
Copy Markdown
Author

I've updated all the comments and changelog with the links to the correct spec (in the new repo).
Please re-review.

@utpilla
utpilla merged commit 5b725de into open-telemetry:main Jul 13, 2023
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.

4 participants