Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable SDK to create package for auto-instrumentation#2365

Merged
rajkumar-rangaraj merged 12 commits into
developfrom
rajrang/redfield
Aug 18, 2021
Merged

Enable SDK to create package for auto-instrumentation#2365
rajkumar-rangaraj merged 12 commits into
developfrom
rajrang/redfield

Conversation

@rajkumar-rangaraj

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

Copy link
Copy Markdown
Member

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

Comment thread Directory.Build.props Outdated
@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
Comment thread .props/_GlobalStaticVersion.props Outdated
Comment thread BASE/src/Microsoft.ApplicationInsights/Microsoft.ApplicationInsights.csproj Outdated

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

LGTM with some suggestions.

@cijothomas

Copy link
Copy Markdown
Contributor

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

Comment thread Directory.Build.props
@rajkumar-rangaraj

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

Comment thread .github/workflows/redfield-sanity-check.yml
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
Copy Markdown
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
Copy Markdown

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.

{
try
{
#if REDFIELD

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.

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

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

/// <summary>
/// ETW EventSource tracing class.
/// </summary>
#if REDFIELD

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.

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

@cijothomas

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

6 participants