Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring - Fixed influxdb write on sentMessageStats #712

Merged
merged 2 commits into from
Jan 4, 2019

Conversation

uro
Copy link
Contributor

@uro uro commented Jan 2, 2019

I deep dive into one bug on monitoring package, I found that message statistics are not accepted by influxdb (even by 1 year old revision), we always receive message

{"error":"unable to parse 'sent-messages,destination=example_topic,command=example_command 1546449295702': invalid field format"}

Which means that it's not passing influxdb requirements - LINK. I checked it and yes, we can send empty value, but only if we have some additional fields. In our case we don't have any fields and no value (which is field as well).

Steps to reproduce:

  1. Try to send request to influxdb with current state:
    curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'sent-messages,destination=example_topic,command=example_command 1546449295702'
    code: 400, response: {"error":"unable to parse 'sent-messages,destination=example_topic,command=example_command 1546449295702': invalid field format"}

  2. Try to add field, for example value:
    curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'sent-messages,destination=example_topic,command=example_command value=1 1546449295702'
    code: 204, no content 👍

Instead of value we can send something else, but we have to send something.

Could you help with this @ASKozienko?

@uro
Copy link
Contributor Author

uro commented Jan 3, 2019

Additionally message from consoleLogger:

10:14:48 ERROR     [app] [ClientMonitoringExtension] Push to storage failed: HTTP Code 400 {"error":"unable to parse 'sent-messages,destination=my_queue,topic=my_topic  1546510487996': invalid field format"}

@makasim
Copy link
Member

makasim commented Jan 3, 2019

@uro is this fix working for you? Is there something you want to add or it is ready to be merged?

@uro
Copy link
Contributor Author

uro commented Jan 4, 2019

@makasim Yes it works now 👍

The problem is that we need to have some "fields". I put value=1 as the simplest solution which is not changing anything.
Technically I can replace it with any of these https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/monitoring/SentMessageStats.php attributes or add more. As I don't need them I didn't do any changes which are not required.

If you like me to add them (to make it better) I can do that, otherwise it's ready for merge

@makasim makasim merged commit 969fc86 into php-enqueue:master Jan 4, 2019
@makasim
Copy link
Member

makasim commented Jan 4, 2019

thanks @uro

@uro uro deleted the hotfix/fix-invalid-write-format branch January 4, 2019 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants