4

Kibana version : 7.6.2

Elasticsearch version : 7.6.2

APM Server version : 7.6.2

APM Agent language and version : @elastic/apm-rum-angular 1.1.1. Angular 9.1.0

Original install method : Used the Angular Integration instructions

While trying to Query Kibana for HTTP status code error, I see that these custom fields are not indexed and thus not filterable. It's weird that these even show up as custom at all, I would imagine that Elastic should know that these are HTTP errors and would match it accordingly to a field in Kibana.

See image, note error.custom.<name> (why are these being created?):

enter image description here

This is how I'm sending the error from Angular:

constructor(@Inject(ApmService) service: ApmService) {
    this.apmService = service.init({
      serviceName: 'frontend',
      serverUrl: 'http://localhost:8200/',
      serviceVersion: '1.0.0',
    });

    this.apmService.setUserContext({
      username: 'John',
      id: '001',
    });
  }

intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    return next.handle(req).pipe(
      retry(1),
      catchError((error: HttpErrorResponse) => {
        let errorMessage = '';
        if (error.error instanceof ErrorEvent) {
          // client-side error
          errorMessage = `Error: ${error.error.message}`;
        } else {
          // server-side error
          errorMessage = `Error: ${error.status} - ${error.message}`;
        }
        this.apmService.captureError(error, { response: error.status });
        return throwError(errorMessage);
      })
    );
  }

How do I send this error to APM so that Kibana correctly knows to fill this in with the correct fields it has?

Edgar Quintero
  • 4,223
  • 2
  • 34
  • 37

0 Answers0