Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] remove noisy logs #2715

Merged
merged 1 commit into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def main():
return Agent.info(verbose=options.verbose)

elif 'foreground' == command:
logging.info('Running in foreground')
if autorestart:
# Set-up the supervisor callbacks and fork it.
logging.info('Running Agent with auto-restart ON')
Expand Down
10 changes: 1 addition & 9 deletions daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

log = logging.getLogger(__name__)


class AgentSupervisor(object):
''' A simple supervisor to keep a restart a child on expected auto-restarts
'''
Expand Down Expand Up @@ -152,7 +153,6 @@ def daemonize(self):

log.info("Daemon started")


def start(self, foreground=False):
log.info("Starting")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this line, it lets you search easily in the logs for when the component started.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it works for both the collector and dogstatsd, I'm going to let this one and remove the duplicate in the collector (Running in foreground).

pid = self.pid()
Expand All @@ -168,13 +168,11 @@ def start(self, foreground=False):
log.warn("pidfile doesn't contain the pid of an agent process."
' Starting normally')

log.info("Pidfile: %s" % self.pidfile)
if not foreground:
self.daemonize()
self.write_pidfile()
self.run()


def stop(self):
log.info("Stopping daemon")
pid = self.pid()
Expand Down Expand Up @@ -211,13 +209,11 @@ def stop(self):

return # Not an error in a restart


def restart(self):
"Restart the daemon"
self.stop()
self.start()


def run(self):
"""
You should override this method when you subclass Daemon. It will be called after the process has been
Expand All @@ -233,7 +229,6 @@ def info(cls):
"""
raise NotImplementedError


def status(self):
"""
Get the status of the daemon. Exits with 0 if running, 1 if not.
Expand Down Expand Up @@ -268,7 +263,6 @@ def status(self):
sys.stdout.write(message + "\n")
sys.exit(exit_code)


def pid(self):
# Get the pid from the pidfile
try:
Expand All @@ -281,7 +275,6 @@ def pid(self):
except ValueError:
return None


def write_pidfile(self):
# Write pidfile
atexit.register(self.delpid) # Make sure pid file is removed if we quit
Expand All @@ -297,7 +290,6 @@ def write_pidfile(self):
sys.stderr.write(msg + "\n")
sys.exit(1)


def delpid(self):
try:
os.remove(self.pidfile)
Expand Down
2 changes: 0 additions & 2 deletions dogstatsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,6 @@ def init(config_path=None, use_watchdog=False, use_forwarder=False, args=None):
sleep(4)
sys.exit(0)

log.debug("Configuring dogstatsd")

port = c['dogstatsd_port']
interval = DOGSTATSD_FLUSH_INTERVAL
api_key = c['api_key']
Expand Down
6 changes: 2 additions & 4 deletions utils/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_proxy(agentConfig):
proxy_settings['user'] = agentConfig.get('proxy_user')
proxy_settings['password'] = agentConfig.get('proxy_password')
log.debug("Proxy Settings: %s:*****@%s:%s", proxy_settings['user'],
proxy_settings['host'], proxy_settings['port'])
proxy_settings['host'], proxy_settings['port'])
return proxy_settings

# If no proxy configuration was specified in datadog.conf
Expand All @@ -62,13 +62,11 @@ def get_proxy(agentConfig):
proxy_settings['password'] = parse.password

log.debug("Proxy Settings: %s:*****@%s:%s", proxy_settings['user'],
proxy_settings['host'], proxy_settings['port'])
proxy_settings['host'], proxy_settings['port'])
return proxy_settings

except Exception as e:
log.debug("Error while trying to fetch proxy settings using urllib %s."
"Proxy is probably not set", str(e))

log.debug("No proxy configured")

return None