Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikus1993 committed Apr 27, 2024
1 parent edd309b commit 4f5a913
Show file tree
Hide file tree
Showing 13 changed files with 205 additions and 48 deletions.
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Telemetry.Abstractions" Version="8.4.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.4.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="8.0.2" />
Expand Down
41 changes: 34 additions & 7 deletions src/Apps/Basket.Api/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@
"resolved": "6.0.3",
"contentHash": "/FkS66n3wJaUR+Grkg+dMMIyrfmfkEybNoyOhdBMURxavPx6Q1Kn7NY5Ho41s975gpXA9Pnw7WRJbxwICLFgbw=="
},
"Microsoft.Extensions.Compliance.Abstractions": {
"type": "Transitive",
"resolved": "8.4.0",
"contentHash": "WBPhQCz84/PFR5vm6lVPOYh4e7lcIQ2EyhYl84hVoZHC1vtvVAZsb4htEVx1LEPkLIiwnIdiLSzXxqS7+hkkDA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
Expand Down Expand Up @@ -237,8 +246,8 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg=="
"resolved": "8.0.1",
"contentHash": "fGLiCRLMYd00JYpClraLjJTNKLmMJPnqxMaiRzEBIIvevlzxz33mXy39Lkd48hu1G+N21S7QpaO5ZzKsI6FRuA=="
},
"Microsoft.Extensions.Diagnostics": {
"type": "Transitive",
Expand Down Expand Up @@ -321,10 +330,10 @@
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==",
"resolved": "8.0.1",
"contentHash": "RIFgaqoaINxkM2KTOw72dmilDmTrYA0ns2KW4lDz4gZ2+o6IQ894CzmdL3StM2oh7QQq44nCWiqKqc4qUI9Jmg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1"
}
},
"Microsoft.Extensions.Logging.Configuration": {
Expand Down Expand Up @@ -390,10 +399,15 @@
"System.Text.Json": "8.0.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "Transitive",
"resolved": "8.0.4",
"contentHash": "6FPHZ6lxtsrlFKE1LeHEco0BxevHSDdxngh37GxwGqiHm8zQz78ttM2OIevqQ8IAvtB01+5xEWBcYsjvSnhhoQ=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==",
"resolved": "8.0.2",
"contentHash": "dWGKvhFybsaZpGmzkGCbNNwBD1rVlWzrZKANLW/CcbFJpCEceMCGzT7zZwHOGBCbwM0SzBuceMj5HN1LKV1QqA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Primitives": "8.0.0"
Expand Down Expand Up @@ -950,6 +964,7 @@
"EasyNetQ.Serialization.SystemTextJson": "[7.8.0, )",
"Microsoft.Extensions.Configuration": "[8.0.0, )",
"Microsoft.Extensions.Hosting": "[8.0.0, )",
"Microsoft.Extensions.Telemetry.Abstractions": "[8.4.0, )",
"OneOf": "[3.0.263, )",
"OneOf.SourceGenerator": "[3.0.263, )",
"System.Linq.Async": "[6.0.1, )",
Expand Down Expand Up @@ -1077,6 +1092,18 @@
"Microsoft.Extensions.Options": "8.0.0"
}
},
"Microsoft.Extensions.Telemetry.Abstractions": {
"type": "CentralTransitive",
"requested": "[8.4.0, )",
"resolved": "8.4.0",
"contentHash": "jiv/2aoe2zkI0Atl+WXChwy6CbjHByxUBLnF6OihMAPELgmKaSywLqcJo5VcbRYA0EGhmQJM/RaGVH3J2TAkxw==",
"dependencies": {
"Microsoft.Extensions.Compliance.Abstractions": "8.4.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4",
"Microsoft.Extensions.Options": "8.0.2"
}
},
"Newtonsoft.Json": {
"type": "CentralTransitive",
"requested": "[13.0.3, )",
Expand Down
4 changes: 3 additions & 1 deletion src/BuildingBlocks/Messaging/Logging/SubscriberLogger.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using EasyNetQ;

using Microsoft.Extensions.Logging;

namespace Messaging.Logging;
Expand All @@ -9,7 +11,7 @@ internal static partial class SubscriberLogger
Level = LogLevel.Error,
Message = "Can't process message {Exchange} -> {RoutingKey} -> {Queue}")]
public static partial void LogCantProcessMessage(
this ILogger logger, Exception exception, string exchange, string routingKey, string queue);
this ILogger logger, Exception exception, string exchange, string routingKey, string queue, [LogProperties(SkipNullProperties = true)]MessageProperties properties);


[LoggerMessage(
Expand Down
1 change: 1 addition & 0 deletions src/BuildingBlocks/Messaging/Messaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="EasyNetQ.Serialization.SystemTextJson" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Telemetry.Abstractions" />
<PackageReference Include="OneOf" />
<PackageReference Include="OneOf.SourceGenerator" />
<PackageReference Include="System.Linq.Async" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
var queue = await _advancedBus.QueueDeclareAsync(_subscriptionConfiguration.Queue, configuration =>
{
configuration.AsDurable(true);
configuration.WithExpires(TimeSpan.FromDays(5));
configuration.WithMessageTtl(TimeSpan.FromHours(5));
configuration.WithMaxLength(1000);
configuration.WithMaxLength(10000);
}, stoppingToken);

_ = await _advancedBus.BindAsync(exchange, queue, _subscriptionConfiguration.Topic, cancellationToken: stoppingToken);
Expand All @@ -74,6 +73,9 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
activity.SetTag("messaging.rabbitmq.routing_key", info.RoutingKey);
activity.SetTag("messaging.exchange", info.Exchange);
activity.SetTag("messaging.destination", info.Queue);
activity.SetTag("messaging.timestamp", properties.Timestamp);
activity.SetTag("messaging.message_id", properties.MessageId);
activity.SetTag("messaging.message_type", properties.Type);
activity.SetTag("messaging.system", "rabbitmq");
activity.SetTag("messaging.destination_kind", "queue");
activity.SetTag("messaging.protocol", "AMQP");
Expand All @@ -91,7 +93,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
var result = await subscriber.Handle(message, ct);
if (!result.IsSuccess)
{
logger.LogCantProcessMessage(result.ErrorValue, info.Exchange, info.RoutingKey, info.Queue);
logger.LogCantProcessMessage(result.ErrorValue, info.Exchange, info.RoutingKey, info.Queue, properties);
activity?.RecordException(result.ErrorValue);
return _subscriptionConfiguration.AckStrategy;
}
Expand All @@ -100,7 +102,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
}
catch (Exception exc)
{
logger.LogCantProcessMessage(exc, info.Exchange, info.RoutingKey, info.Queue);
logger.LogCantProcessMessage(exc, info.Exchange, info.RoutingKey, info.Queue, properties);
activity?.RecordException(exc);
return _subscriptionConfiguration.AckStrategy;
}
Expand Down
40 changes: 33 additions & 7 deletions src/BuildingBlocks/Messaging/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@
"Microsoft.Extensions.Options": "8.0.0"
}
},
"Microsoft.Extensions.Telemetry.Abstractions": {
"type": "Direct",
"requested": "[8.4.0, )",
"resolved": "8.4.0",
"contentHash": "jiv/2aoe2zkI0Atl+WXChwy6CbjHByxUBLnF6OihMAPELgmKaSywLqcJo5VcbRYA0EGhmQJM/RaGVH3J2TAkxw==",
"dependencies": {
"Microsoft.Extensions.Compliance.Abstractions": "8.4.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4",
"Microsoft.Extensions.Options": "8.0.2"
}
},
"OneOf": {
"type": "Direct",
"requested": "[3.0.263, )",
Expand Down Expand Up @@ -136,6 +148,15 @@
"resolved": "6.0.0",
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
},
"Microsoft.Extensions.Compliance.Abstractions": {
"type": "Transitive",
"resolved": "8.4.0",
"contentHash": "WBPhQCz84/PFR5vm6lVPOYh4e7lcIQ2EyhYl84hVoZHC1vtvVAZsb4htEVx1LEPkLIiwnIdiLSzXxqS7+hkkDA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
Expand Down Expand Up @@ -215,8 +236,8 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg=="
"resolved": "8.0.1",
"contentHash": "fGLiCRLMYd00JYpClraLjJTNKLmMJPnqxMaiRzEBIIvevlzxz33mXy39Lkd48hu1G+N21S7QpaO5ZzKsI6FRuA=="
},
"Microsoft.Extensions.Diagnostics": {
"type": "Transitive",
Expand Down Expand Up @@ -275,10 +296,10 @@
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==",
"resolved": "8.0.1",
"contentHash": "RIFgaqoaINxkM2KTOw72dmilDmTrYA0ns2KW4lDz4gZ2+o6IQ894CzmdL3StM2oh7QQq44nCWiqKqc4qUI9Jmg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1"
}
},
"Microsoft.Extensions.Logging.Configuration": {
Expand Down Expand Up @@ -344,10 +365,15 @@
"System.Text.Json": "8.0.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "Transitive",
"resolved": "8.0.4",
"contentHash": "6FPHZ6lxtsrlFKE1LeHEco0BxevHSDdxngh37GxwGqiHm8zQz78ttM2OIevqQ8IAvtB01+5xEWBcYsjvSnhhoQ=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==",
"resolved": "8.0.2",
"contentHash": "dWGKvhFybsaZpGmzkGCbNNwBD1rVlWzrZKANLW/CcbFJpCEceMCGzT7zZwHOGBCbwM0SzBuceMj5HN1LKV1QqA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Primitives": "8.0.0"
Expand Down
41 changes: 34 additions & 7 deletions src/Modules/Basket/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@
"resolved": "6.0.0",
"contentHash": "UcSjPsst+DfAdJGVDsu346FX0ci0ah+lw3WRtn18NUwEqRt70HaOQ7lI72vy3+1LxtqI3T5GWwV39rQSrCzAeg=="
},
"Microsoft.Extensions.Compliance.Abstractions": {
"type": "Transitive",
"resolved": "8.4.0",
"contentHash": "WBPhQCz84/PFR5vm6lVPOYh4e7lcIQ2EyhYl84hVoZHC1vtvVAZsb4htEVx1LEPkLIiwnIdiLSzXxqS7+hkkDA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
Expand Down Expand Up @@ -216,8 +225,8 @@
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg=="
"resolved": "8.0.1",
"contentHash": "fGLiCRLMYd00JYpClraLjJTNKLmMJPnqxMaiRzEBIIvevlzxz33mXy39Lkd48hu1G+N21S7QpaO5ZzKsI6FRuA=="
},
"Microsoft.Extensions.Diagnostics": {
"type": "Transitive",
Expand Down Expand Up @@ -276,10 +285,10 @@
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==",
"resolved": "8.0.1",
"contentHash": "RIFgaqoaINxkM2KTOw72dmilDmTrYA0ns2KW4lDz4gZ2+o6IQ894CzmdL3StM2oh7QQq44nCWiqKqc4qUI9Jmg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0"
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.1"
}
},
"Microsoft.Extensions.Logging.Configuration": {
Expand Down Expand Up @@ -345,10 +354,15 @@
"System.Text.Json": "8.0.0"
}
},
"Microsoft.Extensions.ObjectPool": {
"type": "Transitive",
"resolved": "8.0.4",
"contentHash": "6FPHZ6lxtsrlFKE1LeHEco0BxevHSDdxngh37GxwGqiHm8zQz78ttM2OIevqQ8IAvtB01+5xEWBcYsjvSnhhoQ=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==",
"resolved": "8.0.2",
"contentHash": "dWGKvhFybsaZpGmzkGCbNNwBD1rVlWzrZKANLW/CcbFJpCEceMCGzT7zZwHOGBCbwM0SzBuceMj5HN1LKV1QqA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Primitives": "8.0.0"
Expand Down Expand Up @@ -457,6 +471,7 @@
"EasyNetQ.Serialization.SystemTextJson": "[7.8.0, )",
"Microsoft.Extensions.Configuration": "[8.0.0, )",
"Microsoft.Extensions.Hosting": "[8.0.0, )",
"Microsoft.Extensions.Telemetry.Abstractions": "[8.4.0, )",
"OneOf": "[3.0.263, )",
"OneOf.SourceGenerator": "[3.0.263, )",
"System.Linq.Async": "[6.0.1, )",
Expand Down Expand Up @@ -524,6 +539,18 @@
"Microsoft.Extensions.Options": "8.0.0"
}
},
"Microsoft.Extensions.Telemetry.Abstractions": {
"type": "CentralTransitive",
"requested": "[8.4.0, )",
"resolved": "8.4.0",
"contentHash": "jiv/2aoe2zkI0Atl+WXChwy6CbjHByxUBLnF6OihMAPELgmKaSywLqcJo5VcbRYA0EGhmQJM/RaGVH3J2TAkxw==",
"dependencies": {
"Microsoft.Extensions.Compliance.Abstractions": "8.4.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.1",
"Microsoft.Extensions.ObjectPool": "8.0.4",
"Microsoft.Extensions.Options": "8.0.2"
}
},
"OpenTelemetry.Exporter.Console": {
"type": "CentralTransitive",
"requested": "[1.8.1, )",
Expand Down
Loading

0 comments on commit 4f5a913

Please sign in to comment.