Skip to content

Getting status if device not responsive #249

Description

@xuther

This is a two fold thing

  1. If a device isn't responsive, we need to make sure that device is at least present in the return body, maybe with some indicator that we can't get a response (maybe a response code?)
  2. We need to include the microservice response in the error we report.

For example, if I query the state of a pjlink device with an incorrect address I get the following log trace from the AV-API:

2017/05/24 03:07:41 Sending requqest to http://localhost:8012/0.0.0.0/power/status
2017/05/24 03:07:41 Microservice returned: "error dialing address : dial tcp 0.0.0.0:53595: getsockopt: connection refused"
2017/05/24 03:07:41 Error unmarshalling response from D1
2017/05/24 03:07:41 Sending requqest to http://localhost:8012/0.0.0.0/volume/mute/status
2017/05/24 03:07:41 Microservice returned: "error dialing address : dial tcp 0.0.0.0:53595: getsockopt: connection refused"
2017/05/24 03:07:41 Error unmarshalling response from D1
2017/05/24 03:07:41 Sending requqest to http://localhost:8005/0.0.0.0/input/current
2017/05/24 03:07:41 Microservice returned: "failed to establish a connection with pjlink device. error msg: dial tcp 0.0.0.0:4352: getsockopt: connection refused"
2017/05/24 03:07:41 Error unmarshalling response from D1
2017/05/24 03:07:41 Sending requqest to http://localhost:8012/0.0.0.0/volume/level
2017/05/24 03:07:41 Microservice returned: "error dialing address : dial tcp 0.0.0.0:53595: getsockopt: connection refused"
2017/05/24 03:07:41 Error unmarshalling response from D1
2017/05/24 03:07:41 Writing output to channel...
2017/05/24 03:07:41 outputs from device ITB-1006-D1
2017/05/24 03:07:41 outputs from device ITB-1006-D1
2017/05/24 03:07:41 outputs from device ITB-1006-D1
2017/05/24 03:07:41 outputs from device ITB-1006-D1
2017/05/24 03:07:41 Done acquiring statuses from  ITB-1006-D1
2017/05/24 03:07:41 Done. Closing channel...
2017/05/24 03:07:41 Error querying status with destination: D1
2017/05/24 03:07:41 Publishing event: {"hostname":"ITB-1101-CP3","timestamp":"2017-05-24T03:07:41Z","localEnvironment":true,"event":{"type":0,"eventCause":3,"device":"CP3","eventInfoKey":"Error String","eventInfoValue":"Error querying status for destinationD1:json: cannot unmarshal string into Go value of type map[string]interface {}"},"building":"ITB","room":"1101"}
2017/05/24 03:07:41 Appending results of D1 to output
2017/05/24 03:07:41 Error querying status with destination: D1
2017/05/24 03:07:41 Publishing event: {"hostname":"ITB-1101-CP3","timestamp":"2017-05-24T03:07:41Z","localEnvironment":true,"event":{"type":0,"eventCause":3,"device":"CP3","eventInfoKey":"Error String","eventInfoValue":"Error querying status for destinationD1:json: cannot unmarshal string into Go value of type map[string]interface {}"},"building":"ITB","room":"1101"}
2017/05/24 03:07:41 Appending results of D1 to output
2017/05/24 03:07:41 Error querying status with destination: D1
2017/05/24 03:07:41 Publishing event: {"hostname":"ITB-1101-CP3","timestamp":"2017-05-24T03:07:41Z","localEnvironment":true,"event":{"type":0,"eventCause":3,"device":"CP3","eventInfoKey":"Error String","eventInfoValue":"Error querying status for destinationD1:json: cannot unmarshal string into Go value of type map[string]interface {}"},"building":"ITB","room":"1101"}
2017/05/24 03:07:41 Appending results of D1 to output
2017/05/24 03:07:41 Error querying status with destination: D1
2017/05/24 03:07:41 Publishing event: {"hostname":"ITB-1101-CP3","timestamp":"2017-05-24T03:07:41Z","localEnvironment":true,"event":{"type":0,"eventCause":3,"device":"CP3","eventInfoKey":"Error String","eventInfoValue":"Error querying status for destinationD1:json: cannot unmarshal string into Go value of type map[string]interface {}"},"building":"ITB","room":"1101"}
2017/05/24 03:07:41 Appending results of D1 to output
2017/05/24 03:07:41 Evaluating responses...

You'll notice that we get a good error here:

Microservice returned: "failed to establish a connection with pjlink device. error msg: dial tcp 0.0.0.0:4352: getsockopt: connection refused"

But in the error that is published doesn't include this information it includes a much more generic error:
"Error String","eventInfoValue":"Error querying status for destinationD1:json: cannot unmarshal string into Go value of type map[string]interface {}"}

We need to find a way to report the error that the microservice returned in the event.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions