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

Copy ParentTraceContext when cloning ExecutionStartedEvent #309

Merged
merged 13 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/Hello_Netherite_with_DotNetCore/HelloDF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.DurableTask.Netherite.AzureFunctions" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.8.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.12.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
</ItemGroup>
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/TokenCredentialDTFx/TokenCredentialDTFx.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.7.0" />
<PackageReference Include="Azure.Identity" Version="1.10.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.Netherite" Version="1.3.2" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.13.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.9.6" />
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.15.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.12.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp2.2' ">
Expand Down
7 changes: 4 additions & 3 deletions src/DurableTask.Netherite.AzureFunctions/NetheriteProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override bool TryGetScaleMonitor(
{
if (this.Service.TryGetScalingMonitor(out var monitor))
{
scaleMonitor = new ScaleMonitor(monitor);
scaleMonitor = new ScaleMonitor(monitor, $"{functionId}-{functionName}-{hubName}");
monitor.InformationTracer($"ScaleMonitor Constructed, Descriptor.Id={scaleMonitor.Descriptor.Id}");
return true;
}
Expand All @@ -142,10 +142,11 @@ class ScaleMonitor : IScaleMonitor<NetheriteScaleMetrics>
readonly DataContractSerializer serializer = new DataContractSerializer(typeof(ScalingMonitor.Metrics));
static Tuple<DateTime, NetheriteScaleMetrics> cachedMetrics;

public ScaleMonitor(ScalingMonitor scalingMonitor)
public ScaleMonitor(ScalingMonitor scalingMonitor, string uniqueIdentifier)
{
this.scalingMonitor = scalingMonitor;
this.descriptor = new ScaleMonitorDescriptor($"DurableTaskTrigger-Netherite-{this.scalingMonitor.TaskHubName}".ToLower());
string descriptorString = $"DurableTaskTrigger-Netherite-{uniqueIdentifier}".ToLower();
this.descriptor = new ScaleMonitorDescriptor(descriptorString);
}

public ScaleMonitorDescriptor Descriptor => this.descriptor;
Expand Down
2 changes: 1 addition & 1 deletion src/DurableTask.Netherite/DurableTask.Netherite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="Microsoft.FASTER.Core" Version="2.0.16" />
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.13.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.15.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="System.Threading.Channels" Version="4.7.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public override PartitionEvent Clone()

evt.TaskMessage = new TaskMessage()
{
// TODO: consider using Object.MemberwiseClone() to copy ExecutionStartedEvent
Event = new ExecutionStartedEvent(ee.EventId, ee.Input)
{
ParentInstance = ee.ParentInstance,
Expand All @@ -75,6 +76,7 @@ public override PartitionEvent Clone()
ExtensionData = ee.ExtensionData,
OrchestrationInstance = ee.OrchestrationInstance,
Timestamp = this.CreationTimestamp,
ParentTraceContext = ee.ParentTraceContext,
},
SequenceNumber = tm.SequenceNumber,
OrchestrationInstance = tm.OrchestrationInstance,
bachuv marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -89,4 +91,4 @@ public override void ApplyTo(TrackedObject trackedObject, EffectTracker effects)
trackedObject.Process(this, effects);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ public class NetheriteOrchestrationServiceSettings
/// </summary>
public string UseLocalDirectoryForPartitionStorage { get; set; } = null;

/// <summary>
/// Whether to use the alternate object store implementation.
/// </summary>
public bool UseAlternateObjectStore { get; set; } = false;

/// <summary>
/// Whether to keep an in-memory set of all instance ids in memory. This is required for supporting paged queries.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public PartitionErrorHandler(int partitionId, ILogger logger, LogLevel logLevelL
this.host = host;
}

public void HandleError(string context, string message, Exception exception, bool terminatePartition, bool isWarning)
public void HandleError(string context, string message, Exception? exception, bool terminatePartition, bool isWarning)
{
bool isFatal = exception != null && Utils.IsFatal(exception);

Expand Down Expand Up @@ -94,7 +94,7 @@ public void TerminateNormally()
}
}

void TraceError(bool isWarning, string context, string message, Exception exception, bool terminatePartition)
void TraceError(bool isWarning, string context, string message, Exception? exception, bool terminatePartition)
{
var logLevel = isWarning ? LogLevel.Warning : LogLevel.Error;
if (this.logLevelLimit <= logLevel)
Expand Down
3 changes: 0 additions & 3 deletions src/DurableTask.Netherite/PartitionState/DedupState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ class DedupState : TrackedObject
[DataMember]
public Dictionary<uint, (long Position, int SubPosition)> LastProcessed { get; set; } = new Dictionary<uint, (long,int)>();

[DataMember]
public (long, (long,int)) Positions; // used by FasterAlt to persist positions

[IgnoreDataMember]
public override TrackedObjectKey Key => new TrackedObjectKey(TrackedObjectKey.TrackedObjectType.Dedup);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public static string GetStorageFormat(NetheriteOrchestrationServiceSettings sett

return JsonConvert.SerializeObject(new StorageFormatSettings()
{
UseAlternateObjectStore = settings.UseAlternateObjectStore,
FormatVersion = StorageFormatVersion.Last(),
PageAndSegmentSizes = pageAndSegmentSizes,
MemorySizes = memorySizes,
Expand All @@ -194,9 +193,6 @@ class StorageFormatSettings

// the following can be changed between versions

[JsonProperty("UseAlternateObjectStore", DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool? UseAlternateObjectStore { get; set; }

[JsonProperty("PageAndSegmentSizes", DefaultValueHandling = DefaultValueHandling.Ignore)]
public int[] PageAndSegmentSizes { get; set; }

Expand All @@ -218,10 +214,6 @@ public static void LoadAndCheckStorageFormat(string format, NetheriteOrchestrati
{
var taskhubFormat = JsonConvert.DeserializeObject<StorageFormatSettings>(format, serializerSettings);

if (taskhubFormat.UseAlternateObjectStore != settings.UseAlternateObjectStore)
{
throw new NetheriteConfigurationException("The Netherite configuration setting 'UseAlternateObjectStore' is incompatible with the existing taskhub.");
}
if (taskhubFormat.FormatVersion != StorageFormatVersion.Last())
{
throw new NetheriteConfigurationException($"The current storage format version (={StorageFormatVersion.Last()}) is incompatible with the existing taskhub (={taskhubFormat.FormatVersion}).");
Expand Down
Loading