driplineorg / dripline-python

python implementation of project8/dripline
Apache License 2.0
3 stars 6 forks source link

The error message for specifying an invalid broker should be more clear #148

Open alindman opened 1 year ago

alindman commented 1 year ago

A typical set command (DL2 syntax) is dragonfly set endpoint 1.0 -b rabbit_broker. However, it's very easy to type rabbit-broker and not notice. The error that appears is a generic Name or service not known. broker_error I suggest changing the error message to explicitly call out the possibility that the broker name is wrong. Perhaps something like Unable to reach broker <{specified broker}>. Is that the right broker?

nsoblath commented 1 year ago

Fortunately we've improved this situation in Dripline 3. Here's an example where I just started up a dripline-python:latest container and ran a test get command (no other setup, so it was bound to fail):

root@8a7512eea50c:/# dl-agent get test -b some-broker
2023-02-13 19:35:21 [ PROG] i/application.cc(134): Final configuration:

{
    dripline : 
    {
        alerts-exchange : alerts
        broker : some-broker
        heartbeat-interval-s : 60
        heartbeat-routing-key : heartbeat
        loop-timeout-ms : 1000
        max-payload-size : 10000
        message-wait-ms : 1000
        requests-exchange : requests
    }

    rk : test
    timeout : 10
}

2023-02-13 19:35:21 [ PROG] i/application.cc(135): Ordered args:

[
]

2023-02-13 19:35:21 [ERROR] /library/core.cc(369): AMQP Library Exception caught while creating channel: (-5) hostname lookup failed
2023-02-13 19:35:21 [ERROR] library/agent.cc(194): Unable to connect to the broker:
Unable to open channel to send message
Broker: some-broker
Port: 5672
Routing Key: test

Please let me know if that seems sufficiently clear. It's great to have this sort of feedback.

nsoblath commented 4 months ago

@alindman Could we get your feedback on the above change?

nsoblath commented 2 days ago

Here's an example where the broker hadn't finished starting up yet. It's missing the info about the broker that's printed in the above example. Need to check why it's not present here. Presumably the problem's being caught in a slightly different place.

key-value-store-1  | 2024-09-03 23:38:39 [ INFO] (tid 139724945894272) /library/core.cc(281): Opening AMQP connection and creating channel to rabbit-broker:5672
key-value-store-1  | 2024-09-03 23:38:39 [DEBUG] (tid 139724945894272) /library/core.cc(282): Using broker authentication: dripline:dripline
key-value-store-1  | 2024-09-03 23:38:39 [ERROR] (tid 139724945894272) /library/core.cc(302): AMQP Library Exception caught while creating channel: (-9) a socket error occurred
key-value-store-1  | 2024-09-03 23:38:39 [ERROR] (tid 139724945894272) /library/core.cc(305): This error means the client could not connect to the broker.
key-value-store-1  |    Check that you have the address and port correct, and that the broker is running.