-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d3391a
commit 5c4408c
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
backend/extensions/Squidex.Extensions/APM/Zipkin/ZipkinPlugin.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,44 @@ | ||
// ========================================================================== | ||
// Squidex Headless CMS | ||
// ========================================================================== | ||
// Copyright (c) Squidex UG (haftungsbeschraenkt) | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using OpenTelemetry.Trace; | ||
using Squidex.Infrastructure; | ||
using Squidex.Infrastructure.Plugins; | ||
|
||
namespace Squidex.Extensions.APM.Zipkin; | ||
|
||
public sealed class ZipkinPlugin : IPlugin | ||
{ | ||
private sealed class Configurator : ITelemetryConfigurator | ||
{ | ||
private readonly IConfiguration config; | ||
|
||
public Configurator(IConfiguration config) | ||
{ | ||
this.config = config; | ||
} | ||
|
||
public void Configure(TracerProviderBuilder builder) | ||
{ | ||
builder.AddZipkinExporter(options => | ||
{ | ||
config.GetSection("logging:zipkin").Bind(options); | ||
}); | ||
} | ||
} | ||
|
||
public void ConfigureServices(IServiceCollection services, IConfiguration config) | ||
{ | ||
if (config.GetValue<bool>("logging:zipkin:enabled")) | ||
{ | ||
services.AddSingleton<ITelemetryConfigurator, | ||
Configurator>(); | ||
} | ||
} | ||
} |
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