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

[Instrumentation.AWS, Extensions.AWSXRay] Add net6.0 target, replace net452 target with net462 #1093

Closed

Conversation

wjrogers
Copy link
Contributor

Fixes #1078.

Changes

Add a net6.0 target to OpenTelemetry.Contrib.Instrumentation.AWS and OpenTelemetry.Contrib.Extensions.AWSXRay. Also, update the former's out-of-support net452 target to net462, i.e. NetFrameworkMinimumSupportedVersion. I combined the updates to these two projects into one PR because the latter is a dependency of the former.

  • Update conditional compilation symbols in tests project(s) from NET452 to NETFRAMEWORK.
  • Add a net7.0 test target to Instrumentation.AWS.Tests to match Extensions.AWSXRay.Tests.
  • Add a netcoreapp3.1 test target to Extensions.AWSXRay to exercise the library's netstandard2.0 target.
  • In tests projects, suppress the build warning generated by System.Diagnostics.DiagnosticSource 7.0.0 when targeting out-of-support frameworks. (See Discussion: netstandard2.0 packages don't compile for out-of-support runtimes opentelemetry-dotnet#3448 for discussion.)
  • Fix warnings from analyzers enabled by the new target. I tried to minimize the necessary code changes and add tests where I needed to make a non-trivial change.
  • Remove now-unnecessary reference to System.Net.Http.

Add a .NET 6.0 target to improve the dependency graph combined with
Extensions.AWSXRay when consumers target modern .NET runtimes.

* .NET Framework 4.5.2 is no longer supported. Replace it with the
  oldest supported version, 4.6.2, and update conditional compilation
  symbols in the tests project.

* Add a net7.0 test target to match Extensions.AWSXRay.Tests.

* Keep the netcoreapp3.1 test target to exercise the library's
  netstandard2.0 build.

* In the tests project, suppress the build warning generated by
  System.Diagnostics.DiagnosticSource 7.0.0 when targeting
  out-of-support frameworks.

* Remove the tests' now-unnecessary reference to System.Net.Http.
Add a .NET 6.0 build target to improve the transitive dependency graph
for consumers targeting newer runtimes.

* Add a netcoreapp3.1 test target to exercise the library's
  netstandard2.0 build.

* In the tests project, suppress the build warning generated by
  System.Diagnostics.DiagnosticSource 7.0.0 when targeting
  out-of-support frameworks.
* Previously, constructing the Resource in AWSLambdaResourceDetector
  would throw should any of the environment variables be null. Make
  that condition explicit by pro-actively throwing a descriptive
  exception.

* Change the type of ValidationCallback to match HttpClientHandler's
  callback delegate type, which clarifies that the certificate is an
  instance of X509Certificate2.

* Check that 'cert' and 'chain' are non-null before performing
  validation steps that require them.
@wjrogers wjrogers requested a review from a team March 18, 2023 22:48
@vishweshbankwar
Copy link
Member

@wjrogers We are working towards removing un-supported versions(#1031) from the repo including unit test. netcoreapp3.1 is out of support. Is there any specific reason you want to add netcoreapp3.1?

@wjrogers
Copy link
Contributor Author

@vishweshbankwar I noticed that no tests were run for the netstandard2.0 target and that Instrumentation.AWS.Tests already had a netcoreapp3.1 test target, so I added the same target to Extensions.AWSXRay.Tests so that the tests would run against the netstandard2.0 library assembly. There is some context in the issue I linked about the difficulty of keeping netstandard2.0 targets when every supported runtime will bind to a more-specific target (in this case, net6.0+ to net6.0 and net462+ to net462). I am happy to remove it if you prefer, but that will mean the netstandard2.0 build is untested.

Personally, given the fact there are no more supported runtimes that need it, I think it makes more sense to remove the netstandard2.0 target from the library and provide only more-specific builds (net6.0 and net462), but I didn't want to make that decision for you!

@cijothomas
Copy link
Member

@wjrogers Can you describe the reason why you are adding net6.0 target? Are you leveraging any new APIs/Features from net6.0?

@wjrogers
Copy link
Contributor Author

@cijothomas Sure. This PR is meant to combine with #1092 to remove a dependency when targeting net6.0 or newer. My hope is to avoid taking a dependency on Newtonsoft.Json when I use this package in my own work. net6.0 is the oldest supported runtime that includes System.Text.Json.

It's not strictly required to target net6.0 — the reference to System.Text.Json would be enough — but I find it helpful when installing packages to see the minimal list of dependencies for each supported target framework. If that's not enough justification, I'd be happy to prepare a new PR that just bumps the minimum framework version for Instrumentation.AWS.

@Kielek Kielek added comp:instrumentation.aws Things related to OpenTelemetry.Instrumentation.AWS comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS labels Mar 20, 2023
@cijothomas
Copy link
Member

@wjrogers Thanks for the explanation. Could you update the PR description so its easy to why is this needed. And also I'd suggest to make the net452->net462 into a separate PR of its own.

@wjrogers
Copy link
Contributor Author

I'd suggest to make the net452->net462 into a separate PR of its own.

Have now done so as #1095. I will refresh this PR to isolate the net6.0 addition later tonight or tomorrow. Thanks for the feedback!

@wjrogers
Copy link
Contributor Author

I am closing this PR so I can push a new branch that affects only Extensions.AWSXRay, with a more interesting justification. I will follow up on Instrumentation.AWS if/when my other PRs are accepted.

@wjrogers wjrogers closed this Mar 21, 2023
@wjrogers
Copy link
Contributor Author

continued in #1096

@wjrogers wjrogers deleted the instrumentation-aws-update-tfms branch May 9, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS comp:instrumentation.aws Things related to OpenTelemetry.Instrumentation.AWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider removing net452 target from the package
5 participants