OP and Logging to Elasticsearch
This commit is contained in:
		| @@ -1,27 +1,22 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| using Microsoft.AspNetCore.Builder; | ||||
| using Microsoft.AspNetCore.Hosting; | ||||
| using Microsoft.AspNetCore.HttpsPolicy; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using Microsoft.Extensions.DependencyInjection; | ||||
| using Microsoft.Extensions.Hosting; | ||||
| using Microsoft.Extensions.Logging; | ||||
| using Repositories; | ||||
| using Repositories.Interfaces; | ||||
|  | ||||
| using BusinessLogic.LookupLogic; | ||||
| using BusinessLogic.LookupLogic.Interfaces; | ||||
| using SearchLogic; | ||||
| using OpenTelemetry.Exporter; | ||||
| using OpenTelemetry.Instrumentation.AspNetCore; | ||||
|  | ||||
| using OpenTelemetry.Resources; | ||||
| using OpenTelemetry.Trace; | ||||
| using Elastic.Apm.AspNetCore; | ||||
| using Elastic.Apm.EntityFrameworkCore; | ||||
| using Elastic.Apm; | ||||
|  | ||||
| using Repositories; | ||||
| using Repositories.Interfaces; | ||||
|  | ||||
| using SearchLogic; | ||||
|  | ||||
| namespace FwSearchApi | ||||
| { | ||||
| @@ -50,13 +45,12 @@ namespace FwSearchApi | ||||
|             services.AddTransient<IFwMariaSearchRepo, FwMariaSearchRepo>(); | ||||
|             services.AddTransient<ISearchLogic, SearchLogic.SearchLogic>(); | ||||
|             services.AddSwaggerGen(); | ||||
|  | ||||
|         	AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);  //needed if no Security is used when calling APM Server | ||||
|             services.AddOpenTelemetryTracing((builder) => builder | ||||
|                         //.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("TxSearchApi")) | ||||
|                         .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("TxSearchApi")) | ||||
|                         .AddAspNetCoreInstrumentation() | ||||
|                         .AddHttpClientInstrumentation() | ||||
|                         .AddEntityFrameworkCoreInstrumentation() | ||||
|                         .AddConsoleExporter() | ||||
|                         .AddEntityFrameworkCoreInstrumentation(o => o.SetDbStatementForText = true) //logging of Statement as Span | ||||
|                         .AddOtlpExporter(otlpOptions => { | ||||
|                             otlpOptions.Endpoint = new Uri("http://192.168.178.44:8200"); | ||||
|                         })); | ||||
| @@ -75,8 +69,6 @@ namespace FwSearchApi | ||||
|  | ||||
|             app.UseSwagger(); | ||||
|  | ||||
|             //app.UseElasticApm(_configuration, new EfCoreDiagnosticsSubscriber()); | ||||
|  | ||||
|             app.UseSwaggerUI(c => | ||||
|             { | ||||
|                 c.SwaggerEndpoint("/swagger/v1/swagger.json", "FeatureWerk Search API V1"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user