Fix how monitoring proxy messages is handled #1276
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently JIMM's dashboards shows reasonable request durations for controller level calls. Model calls however show incorrect values and are missing labels.
Digging into this, the issue is how we were monitoring proxied messages in the model proxy. When a controller response is sent back to a client, we remove the client message from a map. In this function we were monitoring the duration of the request and applying labels to include the facade and method name. The error is that we were using the response from the Juju controller to record the labels but responses from Juju don't hold this information (responses are related to requests by a message ID) so instead, use the request's facade and method name which will be populated.
The same error applied to the message duration, the response does not have its
start
field set, only the request does so the duration of the request was default value oftime.Time
(0001-01-01 00:00:00 +0000 UTC) until now.I've modified the
removeMessage
function to accept a message ID rather than a whole message to make things clearer.Engineering checklist
Check only items that apply