This file contains hidden or 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
private static Outcome<T, string[]> Deserialize<T>(JObject obj) | |
{ | |
if (obj is null) | |
{ | |
throw new ArgumentNullException(nameof(obj)); | |
} | |
var serializer = new JsonSerializer | |
{ | |
NullValueHandling = NullValueHandling.Ignore, |
This file contains hidden or 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
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddServiceBusQueueMessagePump((ISecretProvider secretProvider) => secretProvider.GetRawSecretAsync("ServiceBus:Queue:ConnectionString")) | |
.WithServiceBusMessageHandler<OrdersMessageHandler, Order>(); | |
} |
This file contains hidden or 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
public class OrdersMessageHandler : IMessageHandler<Order> | |
{ | |
private readonly ILogger _logger; | |
public OrdersMessageHandler(ILogger<OrdersMessageHandler> logger) | |
{ | |
_logger = logger | |
} | |
public async Task ProcessMessageAsync( |
This file contains hidden or 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
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHealthChecks(); | |
services.AddAzureBlobStorage("UseDevelopmentStorage=true", "arcusblobs"); | |
services.AddTcpHealthProbes("Health:Tcp:Port"); | |
} |
This file contains hidden or 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
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddAutoInvalidateKeyVaultSecretBackgroundJob( | |
"MyServiceBusTopicPrefix", | |
"ServiceBus:Topic:ConnectionString"); | |
} |
This file contains hidden or 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
string connectionString = "Server=sample-server;Database=sample-database;User=admin;Password=123"; | |
using (var measurement = DependencyMeasurement.Start()) | |
{ | |
// Interact with database | |
var products = await _repository.GetProducts(); | |
_logger.LogSqlDependency(connectionString, "my-table", "get-products", isSuccessful: true, measurement: measurement); | |
// Output: "SQL Dependency sample-server for sample-database/my-table for operation get-products in 00:00:01.2396312 at 03/23/2020 09:32:02 +00:00 (Successful: True - Context: )" | |
} |
This file contains hidden or 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
public void Configure(IApplicationBuilder app, IWebHostEvironment env) | |
{ | |
app.UseRequestTracking(); | |
... | |
app.UseMvc(); | |
} |
This file contains hidden or 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
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
app.UseRequestTracking(options => | |
{ | |
// Whether or not the HTTP request body should be included in the request tracking logging emits. | |
// (default: `false`) | |
options.IncludeRequestBody = true; | |
// Whether or not the configured HTTP request headers should be included in the request tracking logging emits. | |
// (default: `true`) |
This file contains hidden or 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
ublic void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHttpCorrelation(); | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
app.UseHttpCorrelation(); | |
Log.Logger = new LoggerConfiguration() |