Baldinof / roadrunner-bundle

A RoadRunner worker integrated in your Symfony app
MIT License
266 stars 47 forks source link

Metrics initializes four times #65

Open InboxViktorV opened 2 years ago

InboxViktorV commented 2 years ago

Hi everyone. Is it a bug, or expected behaviour? The roadrunner initialize kernel four times -> metrics also initializes four times -> as a result system throws errors:

weather    | 2021/12/15 05:38:42    INFO    metrics         declaring new metric    {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    INFO    metrics         metric successfully added   {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    INFO    metrics         declaring new metric    {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    ERROR   metrics         metric with provided name already exist {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    INFO    metrics         declaring new metric    {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    ERROR   metrics         metric with provided name already exist {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    INFO    metrics         declaring new metric    {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}
weather    | 2021/12/15 05:38:42    ERROR   metrics         metric with provided name already exist {"name": "metno_provider_req_duration", "type": "histogram", "namespace": ""}

How to avoid those errors? Or somehow fix them?

Baldinof commented 2 years ago

Hi!

I don't know if it's expected but it's an upstream issue.

If you folllow the documentation here you get the same logs. Despite the messages, everything work well.

eightfourseventwo commented 1 year ago

I'm guessing your CPU has 4 cores? I have the amount of workers set to 10 and I get the error 10 times. I suppose that is to be expected because each RR worker runs in isolation so it starts your app again for each worker.

You can get around this by defining the metrics in rr.yaml instead of the bundle configuration.

I suppose there is no way to fix this. It could perhaps just be a README update.