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

Enable SDK to create package for auto-instrumentation #2365

Merged
merged 12 commits into from Aug 18, 2021

Conversation

rajkumar-rangaraj
Copy link
Member

@rajkumar-rangaraj rajkumar-rangaraj commented Aug 13, 2021

Thanks @TimothyMothra for the PoC

To upgrade Application Insights SDK for .NET Core instrumentation following are the requirements and this PR propose the changes for it.

  1. Downgrade System.Diagnostics.DiagnosticSource package reference to 4.7.0 from 5.0.0.
  2. Rename event source names to support side-by-side load from both Nuget and auto-instrumentation AI SDK.
  3. Build the package from AI SDK’s official release pipeline

Changes

(Please provide a brief description of the changes here.)

  • Downgraded DiagnosticSource
  • Added conditional compilation field REDFIELD which is used as preprocessor to decide the event source name
  • Enabled redfield compilation switch to build and generate package for auto-instrumentation

@rajkumar-rangaraj rajkumar-rangaraj changed the title [Draft] Enable SDK to be aware of auto-instrumentation Enable SDK to create package for auto-instrumentation Aug 13, 2021
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.

LGTM with some suggestions.

@cijothomas
Copy link
Contributor

Note: Won't be able to support https://github.com/microsoft/ApplicationInsights-dotnet/pull/2185/files with this change

@rajkumar-rangaraj
Copy link
Member Author

Note: Won't be able to support https://github.com/microsoft/ApplicationInsights-dotnet/pull/2185/files with this change

We added a redfied sanity check in GitHub actions. This ensures builds are not broken with new changes.

This is a temporary workaround until we resolve the DiagnosticSource versioning issue. We will remove these changes once the DiagnosticSource issue is resolved.

run: dotnet restore ./BASE/Microsoft.ApplicationInsights.sln

- name: Build
run: dotnet build -p:Redfield=True ./BASE/Microsoft.ApplicationInsights.sln --configuration Release --no-restore
Copy link
Contributor

Choose a reason for hiding this comment

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

only building Base sdk?

Copy link
Member

Choose a reason for hiding this comment

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

Running our full test suite here will fail.
We have too many flaky tests and Github Actions does not have a mechanism for retries.
(I'm investigating this in #2345)
If we want to run more test projects here, we must filter those tests.

@@ -52,7 +52,11 @@ private static bool Initialize()
{
try
{
#if REDFIELD
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you open an issue to completely remove this class. it should not be required.

Copy link
Member Author

Choose a reason for hiding this comment

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

Investigated a little and found methods from this class is called in several places.
For example Tryrun is called in OperationCorrelationTelemetryInitializer.cs.

Did I understand your comment incorrectly?

Copy link
Contributor

Choose a reason for hiding this comment

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

yea all the places where this ActivityExtensions is used can be modified to directly use Activity API, instead of doing it via this class.

@@ -7,7 +7,11 @@
/// <summary>
/// ETW EventSource tracing class.
/// </summary>
#if REDFIELD
Copy link
Contributor

Choose a reason for hiding this comment

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

for a separate PR , this file seems doing nothing and could be removed!

@cijothomas
Copy link
Contributor

Note: Won't be able to support https://github.com/microsoft/ApplicationInsights-dotnet/pull/2185/files with this change

We added a redfied sanity check in GitHub actions. This ensures builds are not broken with new changes.

This is a temporary workaround until we resolve the DiagnosticSource versioning issue. We will remove these changes once the DiagnosticSource issue is resolved.

I think we can support PRs like the above, by doing it inside IF !REDFIELD check, as we'll have 5.0.0 of DS when not-redfield.

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