Log agent connections/disconnections. #7557

Merged
merged 2 commits into from Jun 29, 2017

Conversation

Projects
None yet
4 participants
Owner

howbazaar commented Jun 27, 2017

Description of change

While some information was logged before for connections and disconnections, it is often desirable to know which agents are connecting and disconnecting. This branch logs agent connections using a particular logging module, and at INFO level for ease of finding. This would help make it obvious if a particular agent was bouncing regularly.

Additional logging has been moved from INFO to DEBUG as it was a bit too verbose for an INFO logging controller.

QA steps

Bootstrap a controller, deploy some agents, then run this:

juju debug-log --include-module juju.apiserver.connection

Documentation changes

I'm not sure this warrents doc changes.

@howbazaar howbazaar changed the base branch from develop to 2.2 Jun 27, 2017

Owner

howbazaar commented Jun 27, 2017

!!retry!!

Owner

howbazaar commented Jun 27, 2017

$$merge$$

Contributor

jujubot commented Jun 27, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Jun 27, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/11211

+}
+
+func (n *RequestObserver) isAgent(entity names.Tag) bool {
+ switch entity.(type) {
@jameinel

jameinel Jun 27, 2017

Owner

Is it clearer to use entity.Kind() rather than entity.(type) ?

@@ -71,6 +93,9 @@ func (n *RequestObserver) Join(req *http.Request, connectionID uint64) {
// Leave implements Observer.
func (n *RequestObserver) Leave() {
+ if n.state.agent {
+ n.connLogger.Infof("agent disconnected: %s for %s", n.state.tag, n.state.model)
@jameinel

jameinel Jun 27, 2017

Owner

as a side note, I've seen some stuff that was using truncated model UUIds, and I wonder if we might want to do something standard about how to represent models that can be more human readable than a 36 character UUID. (Arguably model Name would be best, but truncated 10char UUID might be something more humane, though we'd want to do it consistently)

Owner

jameinel commented Jun 27, 2017

I was also wondering if we would want prometheus metrics for 'how many current agents' do we have/how many agent logins/disconnects have we had.
Being able to have the number of agents logged into each controller would probably be quite useful for monitoring HA

Owner

howbazaar commented Jun 27, 2017

$$try-again$$

Contributor

jujubot commented Jun 27, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Jun 27, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/11216

Owner

howbazaar commented Jun 28, 2017

$$again$$

Contributor

jujubot commented Jun 28, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Jun 28, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/11228

Owner

jameinel commented Jun 28, 2017

This failed because some of the log messages moved from INFO to debug:
found:
DEBUG finding agent binaries in stream "released"
DEBUG reading agent binaries with major version 1
...
expected:
INFO reading agent binaries with major version 1
INFO filtering agent binaries by version: \d+.\d+.\d+

Owner

howbazaar commented Jun 29, 2017

$$now$$

Contributor

jujubot commented Jun 29, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 0bc578d into juju:2.2 Jun 29, 2017

1 check failed

github-check-merge-juju Ran tests against PR. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details

@howbazaar howbazaar deleted the howbazaar:2.2-logging-tweaks branch Jun 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment