committed by
GitHub
70 changed files with 753 additions and 793 deletions
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,24 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
||||
|
<AssemblyName>LINGYUN.Abp.Telemetry.APM</AssemblyName> |
||||
|
<PackageId>LINGYUN.Abp.Telemetry.APM</PackageId> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Core" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Elastic.Apm.NetCoreAll" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Telemetry.APM; |
||||
|
|
||||
|
public class AbpTelemetryAPMModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAllElasticApm(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,32 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
||||
|
<AssemblyName>LINGYUN.Abp.Telemetry.OpenTelemetry</AssemblyName> |
||||
|
<PackageId>LINGYUN.Abp.Telemetry.OpenTelemetry</PackageId> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Core" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="DotNetCore.CAP.OpenTelemetry" /> |
||||
|
<PackageReference Include="OpenTelemetry.Extensions.Hosting" /> |
||||
|
<PackageReference Include="OpenTelemetry.Exporter.Console" /> |
||||
|
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" /> |
||||
|
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" /> |
||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" /> |
||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Http" /> |
||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" /> |
||||
|
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,106 @@ |
|||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using OpenTelemetry; |
||||
|
using OpenTelemetry.Metrics; |
||||
|
using OpenTelemetry.Resources; |
||||
|
using OpenTelemetry.Trace; |
||||
|
using System; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Telemetry.OpenTelemetry; |
||||
|
|
||||
|
public class AbpTelemetryOpenTelemetryModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
var applicationName = context.Services.GetApplicationName(); |
||||
|
|
||||
|
var openTelmetrySetup = context.Services.GetPreConfigureActions<OpenTelemetryBuilder>(); |
||||
|
|
||||
|
var openTelemetryEnabled = configuration["OpenTelemetry:IsEnabled"]; |
||||
|
if (openTelemetryEnabled.IsNullOrEmpty() || bool.Parse(openTelemetryEnabled)) |
||||
|
{ |
||||
|
var openTelmetryBuilder = context.Services.AddOpenTelemetry() |
||||
|
.ConfigureResource(resource => |
||||
|
{ |
||||
|
resource.AddService(applicationName); |
||||
|
}) |
||||
|
.WithTracing(tracing => |
||||
|
{ |
||||
|
tracing.AddSource(applicationName); |
||||
|
ConfigureTracing(tracing, configuration); |
||||
|
}) |
||||
|
.WithMetrics(metrics => |
||||
|
{ |
||||
|
ConfigureMetrics(metrics, configuration); |
||||
|
}); |
||||
|
|
||||
|
openTelmetrySetup.Configure(openTelmetryBuilder); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static void ConfigureTracing(TracerProviderBuilder tracing, IConfiguration configuration) |
||||
|
{ |
||||
|
tracing.AddHttpClientInstrumentation(); |
||||
|
tracing.AddAspNetCoreInstrumentation(); |
||||
|
tracing.AddCapInstrumentation(); |
||||
|
tracing.AddEntityFrameworkCoreInstrumentation(efcore => |
||||
|
{ |
||||
|
efcore.SetDbStatementForText = configuration.GetValue( |
||||
|
"OpenTelemetry:EntityFrameworkCore:SetDbStatementForText", |
||||
|
efcore.SetDbStatementForText); |
||||
|
|
||||
|
efcore.SetDbStatementForStoredProcedure = configuration.GetValue( |
||||
|
"OpenTelemetry:EntityFrameworkCore:SetDbStatementForStoredProcedure", |
||||
|
efcore.SetDbStatementForStoredProcedure); |
||||
|
}); |
||||
|
|
||||
|
if (configuration.GetValue("OpenTelemetry:Console:IsEnabled", false)) |
||||
|
{ |
||||
|
tracing.AddConsoleExporter(); |
||||
|
} |
||||
|
|
||||
|
var tracingOtlpEndpoint = configuration["OpenTelemetry:Otlp:Endpoint"]; |
||||
|
if (!tracingOtlpEndpoint.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
tracing.AddOtlpExporter(otlpOptions => |
||||
|
{ |
||||
|
otlpOptions.Endpoint = new Uri(tracingOtlpEndpoint); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var zipkinEndpoint = configuration["OpenTelemetry:ZipKin:Endpoint"]; |
||||
|
if (!zipkinEndpoint.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
tracing.AddZipkinExporter(zipKinOptions => |
||||
|
{ |
||||
|
zipKinOptions.Endpoint = new Uri(zipkinEndpoint); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static void ConfigureMetrics(MeterProviderBuilder metrics, IConfiguration configuration) |
||||
|
{ |
||||
|
metrics.AddRuntimeInstrumentation(); |
||||
|
metrics.AddHttpClientInstrumentation(); |
||||
|
metrics.AddAspNetCoreInstrumentation(); |
||||
|
|
||||
|
if (configuration.GetValue("OpenTelemetry:Console:IsEnabled", false)) |
||||
|
{ |
||||
|
metrics.AddConsoleExporter(); |
||||
|
} |
||||
|
|
||||
|
var tracingOtlpEndpoint = configuration["OpenTelemetry:Otlp:Endpoint"]; |
||||
|
if (!tracingOtlpEndpoint.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
metrics.AddOtlpExporter(otlpOptions => |
||||
|
{ |
||||
|
otlpOptions.Endpoint = new Uri(tracingOtlpEndpoint); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
|
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
|
</Weavers> |
||||
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
|
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
|
<xs:element name="Weavers"> |
||||
|
<xs:complexType> |
||||
|
<xs:all> |
||||
|
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
|
<xs:complexType> |
||||
|
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:all> |
||||
|
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
|
<xs:annotation> |
||||
|
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
|
</xs:annotation> |
||||
|
</xs:attribute> |
||||
|
</xs:complexType> |
||||
|
</xs:element> |
||||
|
</xs:schema> |
||||
@ -0,0 +1,26 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<Import Project="..\..\..\..\configureawait.props" /> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
||||
|
<AssemblyName>LINGYUN.Abp.Telemetry.SkyWalking</AssemblyName> |
||||
|
<PackageId>LINGYUN.Abp.Telemetry.SkyWalking</PackageId> |
||||
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.Core" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="SkyAPM.Agent.Hosting" /> |
||||
|
<PackageReference Include="SkyAPM.Diagnostics.AspNetCore" /> |
||||
|
<PackageReference Include="SkyAPM.Diagnostics.CAP" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,44 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using SkyApm.AspNetCore.Diagnostics; |
||||
|
using SkyApm.Diagnostics.CAP; |
||||
|
using SkyApm.Utilities.DependencyInjection; |
||||
|
using System; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Telemetry.SkyWalking; |
||||
|
|
||||
|
public class AbpTelemetrySkyWalkingModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
var isSkywalkingEnabled = configuration["SkyWalking:Enable"]; |
||||
|
if (isSkywalkingEnabled.IsNullOrWhiteSpace() || "false".Equals(isSkywalkingEnabled.ToLower())) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var applicationName = configuration["SkyWalking:ServiceName"]; |
||||
|
if (applicationName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
applicationName = context.Services.GetApplicationName(); |
||||
|
} |
||||
|
|
||||
|
if (applicationName.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
Environment.SetEnvironmentVariable("SKYWALKING__SERVICENAME", applicationName); |
||||
|
|
||||
|
var skywalkingSetup = context.Services.GetPreConfigureActions<SkyApmExtensions>(); |
||||
|
|
||||
|
context.Services.AddSkyWalking(setup => |
||||
|
{ |
||||
|
setup.AddAspNetCoreHosting(); |
||||
|
setup.AddCap(); |
||||
|
|
||||
|
skywalkingSetup.Configure(setup); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using SkyApm; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Telemetry.SkyWalking.Hosting; |
||||
|
|
||||
|
internal class HostingEnvironmentProvider : IEnvironmentProvider |
||||
|
{ |
||||
|
public string EnvironmentName { get; } |
||||
|
|
||||
|
public HostingEnvironmentProvider(IHostEnvironment hostingEnvironment) |
||||
|
{ |
||||
|
EnvironmentName = hostingEnvironment.EnvironmentName; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using SkyApm; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace LINGYUN.Abp.Telemetry.SkyWalking.Hosting; |
||||
|
|
||||
|
internal class InstrumentationHostedService : IHostedService |
||||
|
{ |
||||
|
private readonly IInstrumentStartup _startup; |
||||
|
|
||||
|
public InstrumentationHostedService(IInstrumentStartup startup) |
||||
|
{ |
||||
|
_startup = startup; |
||||
|
} |
||||
|
|
||||
|
public Task StartAsync(CancellationToken cancellationToken) |
||||
|
{ |
||||
|
return _startup.StartAsync(cancellationToken); |
||||
|
} |
||||
|
|
||||
|
public Task StopAsync(CancellationToken cancellationToken) |
||||
|
{ |
||||
|
return _startup.StopAsync(cancellationToken); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,118 @@ |
|||||
|
using LINGYUN.Abp.Telemetry.SkyWalking.Hosting; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using SkyApm; |
||||
|
using SkyApm.Config; |
||||
|
using SkyApm.Diagnostics; |
||||
|
using SkyApm.Diagnostics.EntityFrameworkCore; |
||||
|
using SkyApm.Diagnostics.Grpc; |
||||
|
using SkyApm.Diagnostics.Grpc.Net.Client; |
||||
|
using SkyApm.Diagnostics.HttpClient; |
||||
|
using SkyApm.Diagnostics.MSLogging; |
||||
|
using SkyApm.Diagnostics.SqlClient; |
||||
|
using SkyApm.Logging; |
||||
|
using SkyApm.PeerFormatters.MySqlConnector; |
||||
|
using SkyApm.PeerFormatters.SqlClient; |
||||
|
using SkyApm.Sampling; |
||||
|
using SkyApm.Service; |
||||
|
using SkyApm.Tracing; |
||||
|
using SkyApm.Transport; |
||||
|
using SkyApm.Transport.Grpc; |
||||
|
using SkyApm.Utilities.Configuration; |
||||
|
using SkyApm.Utilities.DependencyInjection; |
||||
|
using SkyApm.Utilities.Logging; |
||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace Microsoft.Extensions.DependencyInjection; |
||||
|
|
||||
|
internal static class SkyWalkingServiceCollectionExtensions |
||||
|
{ |
||||
|
public static IServiceCollection AddSkyWalking(this IServiceCollection services, Action<SkyApmExtensions> extensionsSetup = null) |
||||
|
{ |
||||
|
Check.NotNull(extensionsSetup, nameof(extensionsSetup)); |
||||
|
|
||||
|
services.AddSingleton<ISegmentDispatcher, AsyncQueueSegmentDispatcher>(); |
||||
|
services.AddSingleton<IExecutionService, RegisterService>(); |
||||
|
services.AddSingleton<IExecutionService, LogReportService>(); |
||||
|
services.AddSingleton<IExecutionService, PingService>(); |
||||
|
services.AddSingleton<IExecutionService, SegmentReportService>(); |
||||
|
services.AddSingleton<IExecutionService, CLRStatsService>(); |
||||
|
services.AddSingleton<IInstrumentStartup, InstrumentStartup>(); |
||||
|
services.AddSingleton(RuntimeEnvironment.Instance); |
||||
|
services.AddSingleton<TracingDiagnosticProcessorObserver>(); |
||||
|
services.AddSingleton<IConfigAccessor, ConfigAccessor>(); |
||||
|
services.AddSingleton<IConfigurationFactory, ConfigurationFactory>(); |
||||
|
services.AddSingleton<IHostedService, InstrumentationHostedService>(); |
||||
|
services.AddSingleton<IEnvironmentProvider, HostingEnvironmentProvider>(); |
||||
|
services.AddSingleton<ISkyApmLogDispatcher, AsyncQueueSkyApmLogDispatcher>(); |
||||
|
services.AddSingleton<IPeerFormatter, PeerFormatter>(); |
||||
|
|
||||
|
services.AddTracing() |
||||
|
.AddSampling() |
||||
|
.AddGrpcTransport() |
||||
|
.AddSkyApmLogging(); |
||||
|
|
||||
|
var skyWalking = services |
||||
|
.AddSkyApmExtensions() |
||||
|
.AddHttpClient() |
||||
|
.AddGrpcClient() |
||||
|
.AddSqlClient() |
||||
|
.AddGrpc() |
||||
|
.AddEntityFrameworkCore(delegate (DatabaseProviderBuilder c) |
||||
|
{ |
||||
|
c.AddPomeloMysql().AddNpgsql().AddSqlite(); |
||||
|
}) |
||||
|
.AddMSLogging() |
||||
|
.AddSqlClientPeerFormatter() |
||||
|
.AddMySqlConnectorPeerFormatter(); |
||||
|
|
||||
|
extensionsSetup?.Invoke(skyWalking); |
||||
|
|
||||
|
return services; |
||||
|
} |
||||
|
|
||||
|
private static IServiceCollection AddTracing(this IServiceCollection services) |
||||
|
{ |
||||
|
services.AddSingleton<ITracingContext, TracingContext>(); |
||||
|
services.AddSingleton<ICarrierPropagator, CarrierPropagator>(); |
||||
|
services.AddSingleton<ICarrierFormatter, Sw8CarrierFormatter>(); |
||||
|
services.AddSingleton<ISegmentContextFactory, SegmentContextFactory>(); |
||||
|
services.AddSingleton<IEntrySegmentContextAccessor, EntrySegmentContextAccessor>(); |
||||
|
services.AddSingleton<ILocalSegmentContextAccessor, LocalSegmentContextAccessor>(); |
||||
|
services.AddSingleton<IExitSegmentContextAccessor, ExitSegmentContextAccessor>(); |
||||
|
services.AddSingleton<ISegmentContextAccessor, SegmentContextAccessor>(); |
||||
|
services.AddSingleton<ISamplerChainBuilder, SamplerChainBuilder>(); |
||||
|
services.AddSingleton<IUniqueIdGenerator, UniqueIdGenerator>(); |
||||
|
services.AddSingleton<ISegmentContextMapper, SegmentContextMapper>(); |
||||
|
services.AddSingleton<IBase64Formatter, Base64Formatter>(); |
||||
|
return services; |
||||
|
} |
||||
|
|
||||
|
private static IServiceCollection AddSampling(this IServiceCollection services) |
||||
|
{ |
||||
|
services.AddSingleton<SimpleCountSamplingInterceptor>(); |
||||
|
services.AddSingleton((Func<IServiceProvider, ISamplingInterceptor>)((IServiceProvider p) => p.GetService<SimpleCountSamplingInterceptor>())); |
||||
|
services.AddSingleton((Func<IServiceProvider, IExecutionService>)((IServiceProvider p) => p.GetService<SimpleCountSamplingInterceptor>())); |
||||
|
services.AddSingleton<ISamplingInterceptor, RandomSamplingInterceptor>(); |
||||
|
services.AddSingleton<ISamplingInterceptor, IgnorePathSamplingInterceptor>(); |
||||
|
return services; |
||||
|
} |
||||
|
|
||||
|
private static IServiceCollection AddGrpcTransport(this IServiceCollection services) |
||||
|
{ |
||||
|
services.AddSingleton<ISegmentReporter, SegmentReporter>(); |
||||
|
services.AddSingleton<ILogReporter, LogReporter>(); |
||||
|
services.AddSingleton<ICLRStatsReporter, CLRStatsReporter>(); |
||||
|
services.AddSingleton<ConnectionManager>(); |
||||
|
services.AddSingleton<IPingCaller, PingCaller>(); |
||||
|
services.AddSingleton<IServiceRegister, ServiceRegister>(); |
||||
|
services.AddSingleton<IExecutionService, ConnectService>(); |
||||
|
return services; |
||||
|
} |
||||
|
|
||||
|
private static IServiceCollection AddSkyApmLogging(this IServiceCollection services) |
||||
|
{ |
||||
|
services.AddSingleton<ILoggerFactory, DefaultLoggerFactory>(); |
||||
|
return services; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
# LINGYUN.Abp.Telemetry.SkyWalking |
||||
|
|
||||
|
分布式追踪系统 `SkyWalking` 集成 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpTelemetrySkyWalkingModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```shell |
||||
|
|
||||
|
# 切换到主程序目录 |
||||
|
cd my-host-project-path |
||||
|
|
||||
|
# 安装 skyapm 命令行工具 |
||||
|
dotnet tool install -g SkyAPM.DotNet.CLI |
||||
|
|
||||
|
# 生成 SkyWalking 配置文件, localhost:11800 为你运行的SkyWalking实例暴露的Grpc端口 |
||||
|
dotnet skyapm config auth_server localhost:11800 |
||||
|
``` |
||||
|
|
||||
|
```csharp |
||||
|
|
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<SkyApmExtensions>(skyapm => |
||||
|
{ |
||||
|
skyapm.AddCap(); |
||||
|
|
||||
|
// other... |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
``` |
||||
|
|
||||
|
## 更多文档 |
||||
|
|
||||
|
* [SkyWalking](https://skywalking.apache.org/) |
||||
|
* [SkyWalking .NET](https://github.com/SkyAPM/SkyAPM-dotnet) |
||||
Binary file not shown.
Loading…
Reference in new issue