APM for external plugin

Hi,

I am creating a custom plugin in Kibana 8.8.1 using React.

I want to implement APM for the same.

I have successfully set up fleet server and deployed agent.
My ES instance is and kibana is set up in dev mode in . So fleet server is configured on .

Referred to (APM agent for React application). I have also set up fleet crt and key.

Added APM integration with RUM enabled and also used the React-integration (since plugin in React).

But there is no data coming in.

APM integration

And this is how I am initializing within plugin.

In plugin.ts file

// Import libraries to set up APM for the plugin
import { init as initApm } from '@elastic/apm-rum';

export class Plugin  implements  Plugin {
  // Called when Kibana is being loaded on the browser
  public setup() {
    // Register an application into the side navigation menu
    core.application.register({ --- },
    });

    // Set up APM for the plugin
    const apm = initApm({

      // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)
      serviceName: 'plugin_APM',
    
      // Set custom APM Server URL (default: http://localhost:8200)
      serverUrl: 'https://0.0.0.0:8200',
    
      // Set service version (required for sourcemap feature)
      serviceVersion: 'v1',

    });

    return {};
  }

  // Called when the setup is complete for all the plugins
  public start() {
    ...
    return {};
  }

  public stop() { }
}

Thanks

Hi @Sheereen,

Thanks for the details!

But there is no data coming in.

Please, being in your application try to answer the following questions:

  1. Could you verify if the agent is sending beacons/events properly?

    You can check that in the network tab of your browser, for instance:

    the endpoint where the agent sends beacons to contains "intake/v2/rum/events" (or similar)

  2. Are you seeing any errors/warnings like "mixed content" in your console tab?

  3. What does happen if you open https://0.0.0.0:8200 in a different tab? What are you seeing?

    Anything similar to the JSON below?

    {
      "build_date": "2023-04-26T15:24:05Z",
      "build_sha": "ba37d51075252cb8dd8918212cd5f602b3a0bc74",
      "publish_ready": true,
      "version": "8.7.1"
    }
    
  4. What does happen if you execute fetch('https://0.0.0.0:8200') directly from the console tab? Any error?

Thanks,
Alberto

1 Like

Hi,

Thanks for the reply :smiley:

**1. Yes - works properly **

Initially I did get that error, but was fine once I gave the crt and key paths in APM agent

2. No


3. This site cannot be reached
But if I give https://:8200, I get the following

{
  "build_date": "2023-06-05T15:40:26Z",
  "build_sha": "3ab0687f8528141104250cd120bda1451d66e71a",
  "publish_ready": true,
  "version": "8.8.1"
}

4. Returns a promise, with failed state

Thanks

I changed the url to https://:8200 everywhere, and now for 4th question, I get the following error

I would also like to emphasize that I am running Kibana in dev mode, and want to have APM for an external plugin I am developing with Kibana 8.8.1 dev using React.

thanks for confirming every step!

The positive news is that from what I see in the first screenshot, beacons are being sent correctly.

I'm assuming that the full URL corresponding to each entry of "events" is something like https://0.0.0.0:8200/intake/v2/rum/events, is that right? (just wanna confirm that there is just one instance of RUM agent in your Kibana)

Thanks to all the input you just gave us, we can confirm that the issue doesn't seem related to the browser side.

No data is available in APM or User Experience, is that right?

Let's explore the APM side of all of this:

Have you checked this page? Common problems | APM User Guide [8.8] | Elastic

Sections like "no data indexed" or "Data is indexed but doesn’t appear in the APM app" for instance

Another thing that you could do is to check if there is anything in the APM logs.

If this doesn't help you to solve the issue, I'll try to contact colleagues that have more expertise on the APM side.

Thanks,
Alberto

1 Like

Yes... events from one IP only.

I did all the steps...as in documentations... but in Kibana, when I go to APM> services/traces/dependencies -> all are empty.... even User Experience Dashboard

I see the following error in logs (elastic_agent.apm_server dataset)

[elastic_agent.apm_server][error] failed to index document (fail_processor_exception): Document produced by APM Server v8.8.1, which is newer than the installed APM integration (v8.4.2). The APM integration must be upgraded.

Hi @Sheereen ,
this error that you see in the apm-server logs indicates that the apm package that you have installed is on version 8.4, where the ingesting apm-server is already on a newer version 8.8.1.
Is it possible for you to upgrade the Kibana version and with that the APM integration to 8.8.1? This should solve the error that you see.

1 Like

Kibana is already 8.8.1

Agent is also 8.8.1

The error indicates that the apm package has not been updated to 8.8.1. Please navigate to the apm integration settings page in Kibana and upgrade or reinstall the apm package.

How can I upgrade the same to 8.8.1?
Since my kibana version is 8.8.1, should I upgrade Elastic APM also to 8.8.1?

Thanks

Hi,

Thanks for the fix... it worked
Got to learn a lot as well

Upgraded Elastic APM to 8.4.2. It is of higher version than Kibana. But works. Hope it's fine.

Thanks @Alberto_Delgado @simitt

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.