# APM for external plugin

**URL:** https://discuss.elastic.co/t/apm-for-external-plugin/338217
**Category:** APM
**Tags:** rum, server
**Created:** [July 12, 2023, 12:38pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217 "2023-07-12T12:38:07Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [July 12, 2023, 12:38pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/1 "2023-07-12T12:38:07Z")

</div>

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](https://discuss.elastic.co/t/apm-agent-for-react-application/304330)). 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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5ecad7cf89f1cc7f9961dfec4a88d68c987a5405.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fb7270584b69e2f7e7566e3145a2b1c890fa336f.png)

And this is how I am initializing within plugin.

In plugin.ts file

```auto
// 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

---

<div class="post-metadata">

### Author: ![Alberto\_Delgado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alberto_delgado/32/98488_2.png) [@Alberto\_Delgado](https://discuss.elastic.co/u/Alberto_Delgado)
#### Post date: [July 12, 2023, 1:36pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/2 "2023-07-12T13:36:37Z")

</div>

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?

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](https://0.0.0.0:8200) in a different tab? What are you seeing?

4. What does happen if you execute `fetch('https://0.0.0.0:8200')` directly from the console tab? Any error?

Thanks,  
Alberto

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [July 12, 2023, 1:51pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/3 "2023-07-12T13:51:27Z")

</div>

Hi,

Thanks for the reply 😃

\*\*1. Yes - works properly \*\*

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/6/360308ce3cc915a792d442ee4e7e4a5ee652e9b2.png)

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

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

```

  

**4. Returns a promise, with failed state**

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b69929fd477000565f09f56dbe70ddecc56ff1fa.png)

Thanks

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/2/02bfb4d2e55fa7cb262adf9d75495375b0250ac7.png)

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.**

---

<div class="post-metadata">

### Author: ![Alberto\_Delgado](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alberto_delgado/32/98488_2.png) [@Alberto\_Delgado](https://discuss.elastic.co/u/Alberto_Delgado)
#### Post date: [July 12, 2023, 2:23pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/4 "2023-07-12T14:23:18Z")

</div>

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](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?

 ![section_higlights](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85d71b8a34a89bc72390f2de2b53b691e56e719d.png)

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

Have you checked this page? [Common problems | APM User Guide [8.8] | Elastic](https://www.elastic.co/guide/en/apm/guide/current/common-problems.html#no-data-indexed)

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

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [July 12, 2023, 2:36pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/5 "2023-07-12T14:36:42Z")

</div>

> [@Alberto\_Delgado](#):
>
> fetch('[https://0.0.0.0:8200](https://0.0.0.0:8200)')

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/0/70165e0ac50b0d03080d711da33aa3bc75a4a52d.png)

I see the following error in logs (elastic\_agent.apm\_server dataset)

```auto
[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.

```

---

<div class="post-metadata">

### Author: ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)
#### Post date: [July 12, 2023, 3:01pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/6 "2023-07-12T15:01:38Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [July 12, 2023, 3:03pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/7 "2023-07-12T15:03:16Z")

</div>

Kibana is already 8.8.1

Agent is also 8.8.1

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/64ee96237dd7b27a83aec11a6826f23fe0e70c5e.png)

---

<div class="post-metadata">

### Author: ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)
#### Post date: [July 12, 2023, 3:38pm UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/8 "2023-07-12T15:38:09Z")

</div>

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.

 ![Screenshot 2023-07-12 at 17.36.28](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e791e1c0a87f2642c576de1c8a58a5230bcd4856.png)

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [July 13, 2023, 9:43am UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/9 "2023-07-13T09:43:27Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/2/c/2c12c633ac9bdfd7e09cff436e398dca570f2fad.png)

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 10, 2023, 9:43am UTC](https://discuss.elastic.co/t/apm-for-external-plugin/338217/10 "2023-08-10T09:43:31Z")

</div>

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