0

I have a .net project. I am trying to add Elastic APM Configuration in it. Below are the configurations I have added:

Program.cs:

CreateWebHostBuilder(args).UseAllElasticApm().Build().Run();

Startup.cs:

app.UseElasticApm(Config); (Config is of type IConfiguration)

I have added the spans in my controller as below:

        [HttpGet("filterValues")]
        public async Task<ActionResult> GetReportFilterTenant()
        {
            var span = _tracer.CurrentTransaction?.StartSpan("predictive-reporting", "ControllerA", "GetFilter","Getting Filter");

            try
            {
                var filterValues = _dataAccess.GetFilters();
                return Ok(filterValues);
            }
            catch (Exception e)
            {
                span?.CaptureException(e);
                Console.WriteLine(e);

            }
            finally
            {
                span?.End();
            }

            return null;
        }

I have added the below nuget package in my csproj:

 <PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.22.0" />

But, the APM service is not coming up and I am not able to see the logs as well. Also, I am getting the exception below:

Elastic.Apm[0]
      {PayloadSenderV2} Failed sending events. Following events were not transferred successfully to the server (http://apm-server.cie-elastic.svc.cluster.loc
al:8200/):
          Error{Id: 0d86aaef35318bf5e34edb4aae779001, TraceId: null, ParentId: null, TransactionId: null}
      System.Net.Http.HttpRequestException: No such host is known. (apm-server.cie-elastic.svc.cluster.local:8200)
       ---> System.Net.Sockets.SocketException (11001): No such host is known.
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
         at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, Cancell
ationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationTo
ken cancellationToken)
         --- End of inner exception stack trace ---
         at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationTo
ken cancellationToken)
         at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
         at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, Cancell
ationToken cancellationToken)
         at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, Boolean async, ICredentials credentials, Boolean p
reAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
         at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts,
 Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
         at Elastic.Apm.Report.PayloadSenderV2.ProcessQueueItems(Object[] queueItems)
dbug: Elastic.Apm[0]
      {HttpDiagnosticListenerCoreImpl} No current transaction, skip creating span for outgoing HTTP request
dbug: Elastic.Apm[0]
      {HttpDiagnosticListenerCoreImpl} ProcessStopEvent called with no active current transaction, url: https://dc.services.visualstudio.com/v2/track - skippi
ng event

Can I please get help on this? Thanks.

Jason
  • 27
  • 4

0 Answers0