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

Distributed Tracing #1270

Merged
merged 19 commits into from
May 14, 2020
Merged

Conversation

TsuyoshiUshio
Copy link
Collaborator

@TsuyoshiUshio TsuyoshiUshio commented Mar 11, 2020

The Distributed Tracing Implementation

I create this PR for share/review/discuss the architecture.
This branch includes references for non-published NuGet package (DurableTask correlation branch:https://github.com/Azure/durabletask/tree/correlation), so DO NOT MERGE
Also, I need to resolve conflict against the correlation branch.
image

Overview

Supported

  • End to End Tracing of Orchestration, SubOrchestration, Activity, and Exception, Retry, Fan-Out-Fan-In, ContinueAsNew

Not Supported yet

  • Durable Entity Tracing
  • Http Activity
  • JavaScript

TODO

  • Telemetry Suppression (Currently, Durable Functions and Azure Functions Host send duplicate telemetry with different Id.)

Related Issue:

#939

@amdeel
Copy link
Contributor

amdeel commented Mar 13, 2020

/AzurePipelines run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@TsuyoshiUshio
Copy link
Collaborator Author

@amdeel Thank you for the trigger! I'm busy state until Monday, I'll fix the conflict after that, then ping you.

@TsuyoshiUshio
Copy link
Collaborator Author

The test fails, we need to push DurableTaskCore.Telemetry package first.

@TsuyoshiUshio
Copy link
Collaborator Author

Ready for review and merge. However, the CI fails because:

  • DurableTask.Core.Telemetry and DurableTask.AzureStrorage.Telemetry is reside on the myget.
  • TestV1 is not supported. (Distributed Tracing is V2 only feature)

Is there any good ways to run the appveyor CI under this situation?

@TsuyoshiUshio TsuyoshiUshio changed the title [Do Not Merge] Distributed Tracing Distributed Tracing Apr 8, 2020
@cgillum cgillum added this to the v2.3.0 milestone Apr 8, 2020
{
if (this.IsSuppressedTelemetry(telemetry))
{
this.SuppressTelemetry(telemetry);
Copy link
Member

Choose a reason for hiding this comment

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

This would suppress the telemetry within the durable task.
Additional work is required to communicate back to the host and suppress the telemetry there:

  1. Durable task puts the suppression flag in the payload before returning back to the Functions host.
  2. Once Functions host received the suppression flag, respect the flag and stop emitting telemetry events (context propagation is still required).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @reyang
Thank you for the notice! Very good point.

This issue might be related.
#593

Maybe this TelemetryInitializer might be the one fix on the functions host side.
https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Initializers/WebJobsTelemetryInitializer.cs

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using DurableTask.Core.Settings;
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR though, the namespace seems to be against the naming convention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean <Company>.<Technology>* rule?

Copy link
Collaborator Author

@TsuyoshiUshio TsuyoshiUshio Apr 24, 2020

Choose a reason for hiding this comment

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

Sure. Then it might be a problem of the DurableTask framework side. Thank you for pointing out.

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 overall, I've left my suggestions on how to make the experience work by suppressing telemetry events on both sides (durable function + functions host). I've also left some minor comments that are not specific about this PR.

Copy link
Contributor

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

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

There is a lot of conditional compilation I want to see cleaned up before we merge this I think. I think only compiling your new files in non-Functions V1 will substantially simplify a lot of our conditional compilation.

As mentioned in one of the comments, we should discuss how we want to handle Functions V1 for this release while it is it's own package. I think we should actively discourage Functions V1 customers from using this alternative package, since they won't get any benefit from this.

That being said, it may be lest to leave the net461 bits in there. I think we use net461 vs netstandard2.0 to diferentiate features that are only available in Functions V2+, and if we get rid of net461 bits, then Functions V1 customers who avoid our recommendation and use the custom package will use the netstandard2.0 bits, which will likely break their app.

src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.DurableTask/Options/TraceOptions.cs Outdated Show resolved Hide resolved
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.1.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I vaguely remember some weirdness here, where we had to use a specific version to avoid breaking a build. I'll see if I can dig up the issue.

@TsuyoshiUshio
Copy link
Collaborator Author

/AzurePipelines run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 1270 in repo Azure/azure-functions-durable-extension

@TsuyoshiUshio
Copy link
Collaborator Author

Hi @ConnorMcMahon

I fix all of the issue that you point out! Could you run the AzDO pipeline?
I seem don't have a permission.
Once it passed. Let's get merge this.

@TsuyoshiUshio
Copy link
Collaborator Author

According to the request of renaming from DistributedTracingDisabled to DistributedTracingEnabled, I change the PR. #1298

Copy link
Contributor

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

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

It's getting very close. Mainly a few nits remaining!

I think we can merge this once you address this last round of feedback.

/// 2. Avoid to be overriden when it is RequestTelemetry
/// Original Source is here https://github.com/microsoft/ApplicationInsights-dotnet-server/blob/2.8.0/Src/Common/W3C/W3COperationCorrelationTelemetryInitializer.cs.
/// </summary>
[Obsolete("Not ready for public consumption.")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we are marking this as obsolete? In general, since this is internal, I don't see much benefit to this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you may want to mark the interface ITelemetryInitializer with this attribute, as that is public. I wish it didn't have to be, but I haven't found a good way to have non-public interfaces be injected via dependency injection yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I remove the Obsolute attribute. The reason it was there is, I took this code from https://github.com/microsoft/ApplicationInsights-dotnet-server/blob/2.8.0/Src/Common/W3C/W3COperationCorrelationTelemetryInitializer.cs as I leave the comment on it. After that I modify it. So the first time, I just keep the same structure, however, since I modify it, it means nothing. I removed it and remove warning suppression at the TelemetryActivator.

src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.DurableTask/Options/TraceOptions.cs Outdated Show resolved Hide resolved
@TsuyoshiUshio
Copy link
Collaborator Author

TsuyoshiUshio commented May 8, 2020

@ConnorMcMahon I've done the all fix. I appreciate your review! I learned a lot!

Copy link
Contributor

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

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

LGTM!

@ConnorMcMahon ConnorMcMahon merged commit 49aac11 into Azure:correlation May 14, 2020
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

5 participants