-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
End-to-end trace correlation support in DT.Core and DT.AzureStorage (#…
…422)
- Loading branch information
Showing
74 changed files
with
5,424 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,7 @@ Icon? | |
ehthumbs.db | ||
Thumbs.db | ||
.vs/ | ||
|
||
# Publish Web output # | ||
###################### | ||
PublishProfiles/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
namespace Correlation.Samples | ||
{ | ||
using System; | ||
using System.Runtime.Serialization; | ||
using System.Threading.Tasks; | ||
using DurableTask.Core; | ||
|
||
[KnownType(typeof(HelloActivity))] | ||
internal class ContinueAsNewOrchestration : TaskOrchestration<string, string> | ||
{ | ||
static int counter = 0; | ||
|
||
public override async Task<string> RunTask(OrchestrationContext context, string input) | ||
{ | ||
string result = await context.ScheduleTask<string>(typeof(HelloActivity), input); | ||
result = input + ":" + result; | ||
if (counter < 3) | ||
{ | ||
counter++; | ||
context.ContinueAsNew(result); | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
|
||
internal class HelloActivity : TaskActivity<string, string> | ||
{ | ||
protected override string Execute(TaskContext context, string input) | ||
{ | ||
if (string.IsNullOrEmpty(input)) | ||
{ | ||
throw new ArgumentNullException(nameof(input)); | ||
} | ||
|
||
Console.WriteLine($"Activity: Hello {input}"); | ||
return $"Hello, {input}!"; | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
samples/Correlation.Samples/CorrelatedExceptionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
namespace Correlation.Samples | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using DurableTask.Core; | ||
using Microsoft.ApplicationInsights.DataContracts; | ||
|
||
public static class CorrelatedExceptionExtensions | ||
{ | ||
public static ExceptionTelemetry CreateExceptionTelemetry(this CorrelatedExceptionDetails e) | ||
{ | ||
var exceptionTelemetry = new ExceptionTelemetry(e.Exception); | ||
exceptionTelemetry.Context.Operation.Id = e.OperationId; | ||
exceptionTelemetry.Context.Operation.ParentId = e.ParentId; | ||
return exceptionTelemetry; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\DurableTask.AzureStorage\DurableTask.AzureStorage.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="System.Configuration" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="appsettings.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.