Skip to content
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

update HttpSemanticConventions for Instrumentation.SqlClient #4644

Merged
merged 23 commits into from
Jul 13, 2023
Merged

update HttpSemanticConventions for Instrumentation.SqlClient #4644

merged 23 commits into from
Jul 13, 2023

Conversation

TimothyMothra
Copy link
Contributor

@TimothyMothra TimothyMothra commented Jul 7, 2023

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
Copy link

codecov bot commented Jul 7, 2023

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

TimothyMothra and others added 2 commits July 7, 2023 16:22
Co-authored-by: Vishwesh Bankwar <vishweshbankwar@users.noreply.github.com>
Copy link
Member

@vishweshbankwar vishweshbankwar left a comment

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
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.

Copy link
Contributor

@utpilla utpilla left a comment

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
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
Contributor 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.

@@ -2,6 +2,12 @@

## Unreleased

* Updated [Semantic Conventions](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/trace/semantic_conventions/database.md).
Copy link
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
Contributor 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
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
Contributor 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
Contributor 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.

Copy link
Member

@reyang reyang Jul 13, 2023

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
Copy link
Member

@reyang reyang left a comment

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
Contributor 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