# HTTP 502 into APM service metrics

**URL:** <https://discuss.elastic.co/t/http-502-into-apm-service-metrics/356015>\
**Category:** Kibana\
**Tags:** docker\
**Created:** [March 22, 2024, 6:03pm UTC](https://discuss.elastic.co/t/http-502-into-apm-service-metrics/356015 "2024-03-22T18:03:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miguel.longo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel.longo/32/119522_2.png) [@miguel.longo](https://discuss.elastic.co/u/miguel.longo)\
**Post date:** [March 22, 2024, 6:03pm UTC](https://discuss.elastic.co/t/http-502-into-apm-service-metrics/356015/1 "2024-03-22T18:03:51Z")

</div>

Hello guys.

I have an elastic apm implemented in my environment. When I try to get metrics on service with time range, like one week, after waiting time, I got a 502 error on kibana.

This error don't happen in time range like 15 minutes or 1 hour.

I'm trying to understand why or where this error is coming from. I have a storage without performance, like low IOPS. I believe this may be part of the problem.

I'm running all stack over containers in one server and I have a traefik with my load balancer in another server.

I was some changes to try to fix this error like:

- Traefik with 24 hours of timeout
- Search Timeout on Kibana with 15000000

Even with these changes, error 502 still occurs. It's strange to me, it's this behavior isn't the same. I'm mean, I got this error after 4 minutes, but I got success about 15 minutes waiting.

I saw in all logs and all resources and I don't had any errors like OOM, but I constantly get iowait when I try to get data with long time range.

You can see in images below:

 ![kibana-apm-2](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1b5ab162018a29ae967c618d005f74c9b0db7f3d.png)

 ![kibana-apm](https://us1.discourse-cdn.com/elastic/original/3X/e/9/e96b26a7f66d94555fad09cc1620d02c9229b491.png)

That's my log into traefik:

```auto
1.2.3.4 - - [21/Mar/2024:15:03:30 +0000] "GET /internal/apm/services/api-edited/dependencies?start=2024-02-21T15%3A03%3A30.186Z&end=2024-03-21T15%3A03%3A30.186Z&environment=ENVIRONMENT_ALL&numBuckets=20&offset=2505600000ms HTTP/2.0" 502 11 "-" "-" 471045555 "kibana-https-apm-edited-master@docker" "http://10.0.9.20:5601" 240004ms
1.2.3.4 - - [21/Mar/2024:15:03:32 +0000] "GET /internal/apm/services/api-edited/transactions/charts/latency?environment=ENVIRONMENT_ALL&kuery=&start=2024-02-21T15%3A03%3A30.153Z&end=2024-03-21T15%3A03%3A30.153Z&transactionType=request&latencyAggregationType=avg&offset=2505600000ms HTTP/2.0" 502 11 "-" "-" 471045782 "kibana-https-apm-edited-master@docker" "http://10.0.9.20:5601" 240007ms
1.2.3.4 - - [21/Mar/2024:15:03:32 +0000] "GET /internal/apm/services/api-edited/service_overview_instances/main_statistics?environment=ENVIRONMENT_ALL&kuery=&latencyAggregationType=avg&start=2024-02-21T15%3A03%3A30.191Z&end=2024-03-21T15%3A03%3A30.192Z&transactionType=request&offset=2505600000ms HTTP/2.0" 502 11 "-" "-" 471045785 "kibana-https-apm-edited-master@docker" "http://10.0.9.20:5601" 240015ms
1.2.3.4 - - [21/Mar/2024:15:03:32 +0000] "GET /internal/apm/services/api-edited/transactions/charts/error_rate?environment=ENVIRONMENT_ALL&kuery=&start=2024-02-21T15%3A03%3A30.172Z&end=2024-03-21T15%3A03%3A30.172Z&transactionType=request&offset=2505600000ms HTTP/2.0" 502 11 "-" "-" 471045786 "kibana-https-apm-edited-master@docker" "http://10.0.9.20:5601" 240016ms

```

How can I do to get all data without 502 error, running this stack on non-performative environment? What configuration can I change to have more time to wait without 502 error?

About elasticsearch, what do you think about running elasticsearch with more data nodes? Can I get more performance running with more data nodes (obviously, segmenting shards)?

Thank you.

---

<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:** [April 19, 2024, 6:04pm UTC](https://discuss.elastic.co/t/http-502-into-apm-service-metrics/356015/2 "2024-04-19T18:04:41Z")

</div>

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