Код: Выделить всё
{
"version": "2.0",
// By default these new logging filters are filtered out by the function logs. You need to modify the host.json file
// to opt-in for additional filters and categories.
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true
},
"enableDependencyTracking": false
},
"logLevel": {
"Witness.Io": "Information"
}
},
"extensions": {
"queues": {
"maxPollingInterval": "00:00:10.000",
"batchSize": 1 // The number of queue messages that the Functions runtime retrieves simultaneously and processes in parallel.
}
},
// Set functionTimeout to 10 minutes
"functionTimeout": "00:10:00"
}
{
var host = new HostBuilder()
.ConfigureFunctionsWebApplication(config =>
{
config.UseNewtonsoftJson();
})
.ConfigureServices(services =>
{
// Disable dependency tracking - based on approach detailed here - https://github.com/RohitRanjanMS/Applic ... ocessor.cs.
services.AddApplicationInsightsTelemetryProcessor();
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
var keyVaultService = new KeyVaultService(new Uri(Environment.GetEnvironmentVariable("KEY_VAULT_URI") ?? throw new InvalidOperationException($"Missing environment variable: '{"KEY_VAULT_URI"}'.")));
services.AddKeyVaultService(keyVaultService);
services.AddTransient();
services.AddTransient();
services.AddConfigRepository();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
LogConfiguration(keyVaultService);
})
.ConfigureLogging(logging =>
{
// Allow all Information-level App Insights logs through (this defaults to Warning).
RemoveApplicationInsightsFilter(logging.Services);
})
.Build();
host.Run();
}
< /code>
Процессор выглядит следующим образом: < /p>
///
/// Dependency tracking processor.
///
/// This is used to filter out the dependency tracking logs that we don't want.
public class DependencyTrackingProcessor : ITelemetryProcessor
{
///
/// Initializes a new instance of the class. Link processors to each other in the chain.
///
/// The next telemetry processor.
public DependencyTrackingProcessor(ITelemetryProcessor nextProcessor)
{
NextProcessor = nextProcessor;
}
private ITelemetryProcessor NextProcessor { get; }
///
public void Process(ITelemetry item)
{
if (item is DependencyTelemetry)
{
// Do not send telemetry for dependency tracking.
return;
}
// Call the next processor in the chain.
NextProcessor.Process(item);
}
}
< /code>
Ничего из этого не оказывает никакого влияния. Кто -нибудь может сказать мне, что я делаю не так?>
Подробнее здесь: https://stackoverflow.com/questions/796 ... d-v4-net-9
Мобильная версия