scalyr/scalyr-agent-2

global name 'WrappedRawGenerator' is not defined

dfredell opened this issue · 2 comments

I'm trying to setup scalyr-agent-2 to forward all of my docker container logs hosted on Rancher to Scalyr.
The 'not defined' error message makes it up to Scalyr, so I know that part is working. It just seems to be the log_mode=docker_api on module=scalyr_agent.builtin_monitors.docker_monitor part.

I'm running
the scalyr/scalyr-docker-agent:latest docker image
volume mapped the docker.sock
Rancher 1.6.17 with

docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.4
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:16:31 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:16:31 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Config and error message

root@5f9de8dba8d2:/# cat /etc/scalyr-agent-2/agent.json 
// Configuration for the Scalyr Agent while running on Docker. For help:
// 
// https://www.scalyr.com/help/scalyr-agent-2

{
  // Note:  It is assumed that another file such as `agent.d/api-key.json`
  // will contain the api key for the user's Scalyr account.

  // No need for system and agent monitors.  The docker plugin will gather
  // metrics on the container running the agent.
  implicit_metric_monitor: false,
  implicit_agent_process_metrics_monitor: false,
}
root@5f9de8dba8d2:/# cat /etc/scalyr-agent-2/agent.d/docker.json 
// Configures the agent to run the syslog-based Docker integration.
// This means the container running the Scalyr Agent will run a syslog
// server that the other local containers can connect to to push their
// logs into Scalyr.  Additionally, the Scalyr Agent will collect metrics
// on all running containers.
{
 monitors: [
   {
    module: "scalyr_agent.builtin_monitors.syslog_monitor",
    mode: "docker"
   }, {
    module: "scalyr_agent.builtin_monitors.docker_monitor",
    //log_mode: "syslog"
   }
  ]
}
root@5f9de8dba8d2:/var/log/scalyr-agent-2# cat agent.log
....
2018-12-04 21:20:27.253Z WARNING [monitor:docker_monitor] [docker_monitor.py:806] Unhandled exception in DockerLogger.process_request for r-build-build-slave-2-2cda2fce:
        global name 'WrappedRawGenerator' is not defined
...

I even tried pulling the code to figure out where WrappedRawGenerator is defined, but I couldn't find it.

imron commented

Thanks for reporting this. This error appears to be the result of a small typo.

I should have a fix for it checked in the main repo in the next day or two.

In the meantime, if you are up for modifying the code, where def _stream_raw_result is returning a WrappedRawGenerator it should actually be returning a WrappedRawResponse. Likewise def _stream_helper should be returning a WrappedStreamResponse.

This was fixed in #128 I tested and can confirm this.