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

Minor perf improvements.. #1170

Merged
merged 5 commits into from
Jul 16, 2019
Merged

Minor perf improvements.. #1170

merged 5 commits into from
Jul 16, 2019

Conversation

cijothomas
Copy link
Contributor

Fix Issue # .

  • I ran Unit Tests locally.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #

  • Changes in public surface reviewed

  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue.

  • The PR will trigger build, unit tests, and functional tests automatically. If your PR was submitted from fork - mention one of committers to initiate the build for you.
    If you want to to re-run the build/tests, the easiest way is to simply Close and Re-Open this same PR. (Just click 'close pull request' followed by 'open pull request' buttons at the bottom of the PR)

  • Please follow [these] (https://github.com/Microsoft/ApplicationInsights-dotnet/blob/develop/.github/CONTRIBUTING.md) instructions to build and test locally.


if (string.IsNullOrEmpty(instrumentationKey))
{
instrumentationKey = this.configuration.InstrumentationKey;
Copy link
Member

Choose a reason for hiding this comment

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

I remember keeping this assignment outside to make sure that proactively sampled out item won't get "Invalid Ikey" or won't get dropped before it arrives to sampling for gain up calculation in Sampling Telemetry Processor. If we are sure that items make it all the way without IKey - this change is OK. There was a case where setting empty IKey prevented all telemetry from leaving SDK (I may have false memory here, though).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The lines i moved into the if block will not have helped with the issue. It just assigns ikey to a local variable, which is ONLY used inside the if block. I just moved the assignment closer to actual usage, in the same if block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/microsoft/ApplicationInsights-aspnetcore/blob/develop/src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HostingDiagnosticListener.cs#L513 This initialization is probably what you are referring to. That assignment is outside of any Sampling If-Else statements, and is correctly done so,

@cijothomas cijothomas closed this Jul 15, 2019
@cijothomas cijothomas reopened this Jul 15, 2019
@cijothomas cijothomas merged commit b5a2753 into develop Jul 16, 2019
@cijothomas cijothomas deleted the cithomas/minor1 branch July 16, 2019 04:13
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.

3 participants