Skip to content

Commit 8ca4f2e

Browse files
committed
Various telemetry updates
1 parent 5e3ab1d commit 8ca4f2e

File tree

7 files changed

+54
-14
lines changed

7 files changed

+54
-14
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1717
<ReferenceFoundatioSource>false</ReferenceFoundatioSource>
1818
<ReferenceFoundatioRepositoriesSource>false</ReferenceFoundatioRepositoriesSource>
19-
<FoundatioVersion>11.0.5</FoundatioVersion>
19+
<FoundatioVersion>11.0.6-alpha.0.18</FoundatioVersion>
2020
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
2121
</PropertyGroup>
2222

src/Exceptionless.Insulation/Exceptionless.Insulation.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<ItemGroup>
33
<PackageReference Include="Geocoding.Google" Version="4.0.1" />
44
<PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
5-
<PackageReference Include="Foundatio.Aliyun" Version="$(FoundatioVersion)" />
6-
<PackageReference Include="Foundatio.AWS" Version="$(FoundatioVersion)" />
7-
<PackageReference Include="Foundatio.AzureStorage" Version="$(FoundatioVersion)" />
8-
<PackageReference Include="Foundatio.Minio" Version="$(FoundatioVersion)" />
9-
<PackageReference Include="Foundatio.RabbitMQ" Version="$(FoundatioVersion)" />
10-
<PackageReference Include="Foundatio.Redis" Version="$(FoundatioVersion)" />
5+
<PackageReference Include="Foundatio.Aliyun" Version="11.0.5" />
6+
<PackageReference Include="Foundatio.AWS" Version="11.0.5" />
7+
<PackageReference Include="Foundatio.AzureStorage" Version="11.0.5" />
8+
<PackageReference Include="Foundatio.Minio" Version="11.0.5" />
9+
<PackageReference Include="Foundatio.RabbitMQ" Version="11.0.5" />
10+
<PackageReference Include="Foundatio.Redis" Version="11.0.5" />
1111
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0-rc.2.24473.5" />
1212
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0-rc.2.24473.5" />
1313
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0-rc.2.24473.5" />

src/Exceptionless.Job/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public static IHostBuilder CreateHostBuilder(string[] args)
6262
var options = AppOptions.ReadFromConfiguration(config);
6363
var apmConfig = new ApmConfig(config, $"job-{jobOptions.JobName.ToLowerUnderscoredWords('-')}", options.InformationalVersion, options.CacheOptions.Provider == "redis");
6464

65-
var configDictionary = config.ToDictionary("Serilog");
66-
Log.Information("Bootstrapping Exceptionless {JobName} job(s) in {AppMode} mode ({InformationalVersion}) on {MachineName} with settings {@Settings}", jobOptions.JobName ?? "All", environment, options.InformationalVersion, Environment.MachineName, configDictionary);
65+
Log.Information("Bootstrapping Exceptionless {JobName} job(s) in {AppMode} mode ({InformationalVersion}) on {MachineName} with options {@Options}", jobOptions.JobName ?? "All", environment, options.InformationalVersion, Environment.MachineName, options);
6766

6867
var builder = Host.CreateDefaultBuilder()
6968
.UseEnvironment(environment)

src/Exceptionless.Job/appsettings.Development.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BaseURL: 'http://localhost:9001/#!'
1313

1414
Serilog:
1515
MinimumLevel:
16-
Default: Debug
16+
Default: Information
1717

1818
Apm:
1919
EnableLogs: false

src/Exceptionless.Web/ApmExtensions.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static IHostBuilder AddApm(this IHostBuilder builder, ApmConfig config)
2828
builder.ConfigureServices(services =>
2929
{
3030
services.AddSingleton(config);
31-
services.AddHostedService(sp => new SelfDiagnosticsLoggingHostedService(sp.GetRequiredService<ILoggerFactory>(), config.Debug ? EventLevel.Verbose : null));
31+
//services.AddHostedService(sp => new SelfDiagnosticsLoggingHostedService(sp.GetRequiredService<ILoggerFactory>(), config.Debug ? EventLevel.Verbose : null));
3232

3333
services.AddOpenTelemetry().WithTracing(b =>
3434
{
@@ -41,6 +41,9 @@ public static IHostBuilder AddApm(this IHostBuilder builder, ApmConfig config)
4141
if (context.Request.Path.StartsWithSegments("/api/v2/push", StringComparison.OrdinalIgnoreCase))
4242
return false;
4343

44+
if (context.Request.Path.StartsWithSegments("/health", StringComparison.OrdinalIgnoreCase))
45+
return false;
46+
4447
if (context.Request.Headers.UserAgent.ToString().Contains("HealthChecker"))
4548
return false;
4649

@@ -84,7 +87,30 @@ public static IHostBuilder AddApm(this IHostBuilder builder, ApmConfig config)
8487
b.AddConsoleExporter();
8588

8689
if (config.EnableExporter)
90+
{
91+
b.AddProcessor(new FilteringProcessor(activity =>
92+
{
93+
// filter out insignificant activities
94+
if (config.MinDurationMs > 0 && activity.Duration < TimeSpan.FromMilliseconds(config.MinDurationMs))
95+
return false;
96+
97+
if (activity is { DisplayName: "LLEN", Parent: null })
98+
return false;
99+
100+
if (activity.DisplayName == "Elasticsearch HEAD")
101+
return false;
102+
103+
if (activity.GetTagItem("db.statement") is not string statement)
104+
return true;
105+
106+
if (statement.EndsWith("__PING__"))
107+
return false;
108+
109+
return true;
110+
}));
111+
87112
b.AddOtlpExporter();
113+
}
88114
});
89115

90116
services.AddOpenTelemetry().WithMetrics(b =>
@@ -174,3 +200,19 @@ public ApmConfig(IConfigurationRoot config, string processName, string? serviceV
174200
public bool Debug => _apmConfig.GetValue("Debug", false);
175201
public bool Console => _apmConfig.GetValue("Console", false);
176202
}
203+
204+
public class FilteringProcessor : BaseProcessor<Activity>
205+
{
206+
private readonly Func<Activity, bool> _filter;
207+
208+
public FilteringProcessor(Func<Activity, bool> filter)
209+
{
210+
_filter = filter ?? throw new ArgumentNullException(nameof(filter));
211+
}
212+
213+
public override void OnEnd(Activity activity)
214+
{
215+
if (!_filter(activity))
216+
activity.ActivityTraceFlags &= ~ActivityTraceFlags.Recorded;
217+
}
218+
}

src/Exceptionless.Web/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public static IHostBuilder CreateHostBuilder(IConfigurationRoot config, string e
6363
var options = AppOptions.ReadFromConfiguration(config);
6464
var apmConfig = new ApmConfig(config, "web", options.InformationalVersion, options.CacheOptions.Provider == "redis");
6565

66-
var configDictionary = config.ToDictionary("Serilog");
67-
Log.Information("Bootstrapping Exceptionless Web in {AppMode} mode ({InformationalVersion}) on {MachineName} with settings {@Settings}", environment, options.InformationalVersion, Environment.MachineName, configDictionary);
66+
Log.Information("Bootstrapping Exceptionless Web in {AppMode} mode ({InformationalVersion}) on {MachineName} with options {@Options}", environment, options.InformationalVersion, Environment.MachineName, options);
6867

6968
SetClientEnvironmentVariablesInDevelopmentMode(options);
7069

src/Exceptionless.Web/appsettings.Development.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RunJobsInProcess: true
2121

2222
Serilog:
2323
MinimumLevel:
24-
Default: Debug
24+
Default: Information
2525

2626
Apm:
2727
EnableLogs: true

0 commit comments

Comments
 (0)