Skip to content

Commit

Permalink
Remove unused values from State.Data.
Browse files Browse the repository at this point in the history
  • Loading branch information
houseofcat committed Apr 29, 2024
1 parent 1b69235 commit 6c70429
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 18 deletions.
11 changes: 1 addition & 10 deletions src/HouseofCat.Dataflows/Extensions/WorkStateExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public static void StartWorkflowSpan(
{
if (state is null) return;

state.Data[DefaultWorkflowNameKey] = workflowName;

var attributes = new SpanAttributes();
attributes.Add(DefaultWorkflowNameKey, workflowName);

Expand Down Expand Up @@ -107,8 +105,6 @@ public static TelemetrySpan CreateActiveSpan(
SpanKind spanKind = SpanKind.Internal,
IEnumerable<KeyValuePair<string, string>> suppliedAttributes = null)
{
if (state?.Data is null) return null;

var attributes = new SpanAttributes();
if (suppliedAttributes is not null)
{
Expand Down Expand Up @@ -139,19 +135,14 @@ public static TelemetrySpan CreateActiveSpan(
public static TelemetrySpan CreateActiveChildSpan(
this IWorkState state,
string spanName,
SpanContext spanContext,
SpanKind spanKind = SpanKind.Internal,
SpanAttributes attributes = null)
{
if (state?.Data is null) return null;

state.Data.TryGetValue(DefaultWorkflowNameKey, out var workflowName);

return OpenTelemetryHelpers
.StartActiveSpan(
spanName,
spanKind,
spanContext,
state.WorkflowSpan.Context,
attributes: attributes);
}

Expand Down
6 changes: 3 additions & 3 deletions src/HouseofCat.RabbitMQ/Dataflows/ConsumerDataflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public TransformBlock<TState, TState> GetByteManipulationTransformBlock(
{
TState WrapAction(TState state)
{
using var childSpan = state.CreateActiveChildSpan(spanName, state.WorkflowSpan.Context, SpanKind.Internal);
using var childSpan = state.CreateActiveChildSpan(spanName, SpanKind.Internal);
try
{
if (outbound)
Expand Down Expand Up @@ -630,7 +630,7 @@ public TransformBlock<TState, TState> GetByteManipulationTransformBlock(
{
async Task<TState> WrapActionAsync(TState state)
{
using var childSpan = state.CreateActiveChildSpan(spanName, state.WorkflowSpan.Context, SpanKind.Internal);
using var childSpan = state.CreateActiveChildSpan(spanName, SpanKind.Internal);
try
{

Expand Down Expand Up @@ -676,7 +676,7 @@ public TransformBlock<TState, TState> GetWrappedSendTransformBlock(
{
async Task<TState> WrapPublishAsync(TState state)
{
using var childSpan = state.CreateActiveChildSpan(SendStepIdentifier, state.WorkflowSpan.Context, SpanKind.Producer);
using var childSpan = state.CreateActiveChildSpan(SendStepIdentifier, SpanKind.Producer);
try
{
await service.Publisher.PublishAsync(state.SendMessage, true, true).ConfigureAwait(false);
Expand Down
4 changes: 2 additions & 2 deletions tests/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="ReportGenerator" Version="5.2.5" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions version.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>4.1.0</Version>
<AssemblyVersion>4.1.0</AssemblyVersion>
<FileVersion>4.1.0</FileVersion>
<Version>4.1.1</Version>
<AssemblyVersion>4.1.1</AssemblyVersion>
<FileVersion>4.1.1</FileVersion>
</PropertyGroup>
</Project>

0 comments on commit 6c70429

Please sign in to comment.