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

[1.3.0 patch] Fix enumerator reflection when using DS7 version #3605

Merged
merged 5 commits into from Aug 31, 2022

Conversation

CodeBlanch
Copy link
Member

Fixes #3593

Changes

[Note: This PR is merging into "main-1.3.0" which I created off the 1.3.0 tag. The idea is to release this as a patch 1.3.1(?)]

Patches the 1.3.0 enumerator reflection code to work with .NET7 version of DS.

@cijothomas
Copy link
Member

CI wont run unless we modify the workflows too in this PR..

@alanwest
Copy link
Member

The red removed lines from the workflow yaml files in this PR https://github.com/open-telemetry/opentelemetry-dotnet/pull/3531/files might help identify the necessary CI changes

@CodeBlanch CodeBlanch marked this pull request as ready for review August 26, 2022 23:14
@CodeBlanch CodeBlanch requested a review from a team as a code owner August 26, 2022 23:14

static ActivityTagsEnumeratorFactory()
{
var activityEventTagsField = typeof(ActivityEvent).GetField("_tags", BindingFlags.Instance | BindingFlags.NonPublic);
Copy link
Member

Choose a reason for hiding this comment

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

Since we're going through with a patch release, I think it makes sense to implement the ultimate fallback in the event things change beyond DS 7. Also could put the defense in for Activity tags as well if ever that were to change.

Copy link
Member

Choose a reason for hiding this comment

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

Here's another area in the OTLP exporter that might risk a similar 💥 in the future

private static Action<RepeatedField<Span>, int> CreateRepeatedFieldOfSpanSetCountAction()

We actually ran into this once before #1854...

Copy link
Member

Choose a reason for hiding this comment

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

Since we're going through with a patch release, I think it makes sense to implement the ultimate fallback in the event things change beyond DS 7. Also could put the defense in for Activity tags as well if ever that were to change.

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

Here's another area in the OTLP exporter that might risk a similar 💥 in the future

I actually pinged the protobuf team the other day about if they would accept a contribution to make that OTLP hack/feature part of the public API. I don't want to link it here because it is kind of off topic but the response seemed like a maybe? I was going to throw a PR up but then @reyang pointed out to me there is an alternative thing protobuf-net which seems to use built-in List<T> for its codegen. Might make more sense to switch libs completely. Needs a bit of investigation so I tabled it for now.

Copy link
Member

@alanwest alanwest Aug 29, 2022

Choose a reason for hiding this comment

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

Needs a bit of investigation so I tabled it for now.

I think this is fine, but before pushing out the patch release I think we should decide what our strategy is here. The protobuf hack is not a problem today, but could be tomorrow.

So question is: Do we want to mitigate for this in the 1.3.1 patch release?

I think the answer is yes.

If other agree, then sounds like options include:

  1. Provide a fallback in the event the reflection fails.
  2. Investigate protobuf-net and consider using it.
  3. Wait for protobuf team to release real support for OTLP hack.

I'd be content with option 1. It requires no further investigation and sufficiently guards users of 1.3.1 from any surprise application crashes when upgrading their protobuf/gRPC dependencies in the future.

Copy link
Member

Choose a reason for hiding this comment

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

switching to protobuf-net, if we do it, should be part of regular minor version bump, not ".1" patch for addressing bug fix.

A fallback would be the best option here.

Copy link
Member

@alanwest alanwest left a comment

Choose a reason for hiding this comment

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

LGTM

Mitigation for the protobuf hack (or not) can be a different PR. See: #3605 (comment)

@@ -2,6 +2,10 @@

## Unreleased

* Added support for the .NET7 version of the
Copy link
Member

Choose a reason for hiding this comment

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

might be better to call this just 7.0 of DS.

Copy link
Member

Choose a reason for hiding this comment

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

merging now. Will need to update the changelog to indicate what this hotfix is for.

Comment on lines +24 to +30
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '3.1.x'

- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can simplify this if desired:

Suggested change
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '3.1.x'
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- uses: actions/setup-dotnet@v2
with:
dotnet-version: |
3.1.x
6.0.x

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.

None yet

6 participants