Skip to content

Conversation

@Kami
Copy link
Member

@Kami Kami commented Jan 24, 2019

This pull request fixes an issue with statsd debug log messages ending up in st2sensorcontainer log even when debug mode was disabled.

Background

#4441 fixes that for majority of the services and scripts, but not for st2sensorcontainer. Sensor container is a bit special because it spawns sensors in a dedicated child processes which means we need to perform that monkey patching again in the child process to avoid those log messages.

Before:

2019-01-24 12:35:23,747 DEBUG [-] Using Python: 2.7.12 (/opt/stackstorm/st2/bin/python)
2019-01-24 12:35:23,747 DEBUG [-] Using config files: /etc/st2/st2.conf
2019-01-24 12:35:23,747 DEBUG [-] Using logging config: /etc/st2/logging.sensorcontainer.conf
2019-01-24 12:35:23,753 INFO [-] Connecting to database "st2" @ "127.0.0.1:27017" as user "None".
2019-01-24 12:35:23,755 INFO [-] Successfully connected to database "st2" @ "127.0.0.1:27017" as user "None".
2019-01-24 12:35:23,868 INFO [-] Running in single sensor mode, using a single sensor partitioner...
2019-01-24 12:35:23,870 INFO [-] Setting up container to run 1 sensors.
2019-01-24 12:35:23,870 INFO [-] 	Sensors list - [u'fixtures.TestPollingSensor'].
2019-01-24 12:35:23,870 INFO [-] (PID:19859) SensorContainer started.
2019-01-24 12:35:23,870 INFO [-] Running sensor fixtures.TestPollingSensor
2019-01-24 12:35:23,877 AUDIT [-] Access granted to "sensors_container" with the token set to expire at "2019-01-25T12:35:23.876977Z". (username='sensors_container',token_expiration='2019-01-25T12:35:23.876977Z')
2019-01-24 12:35:23,878 WARNING [-] "auth.api_url" configuration option is not configured
2019-01-24 12:35:23,887 INFO [-] Connected to amqp://guest:**@127.0.0.1:5672//
2019-01-24 12:35:23,889 INFO [-] Sensor fixtures.TestPollingSensor started
2019-01-24 12:35:24,394 INFO [-] Found config for sensor "TestPollingSensor"
2019-01-24 12:35:24,394 INFO [-] Watcher started
2019-01-24 12:35:24,395 INFO [-] Running sensor initialization code
2019-01-24 12:35:24,395 INFO [-] Running sensor in active mode (poll interval=5s)
2019-01-24 12:35:24,408 INFO [-] Connected to amqp://guest:**@127.0.0.1:5672//
KeyboardInterrupt
2019-01-24 12:20:09,096 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 3.09700000ms
2019-01-24 12:20:09,096 INFO [-] st2.cicd.amqp.publish.update: 3.36700000ms
2019-01-24 12:20:09,101 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 1.33500000ms
2019-01-24 12:20:09,101 INFO [-] st2.cicd.amqp.publish.update: 1.56800000ms
2019-01-24 12:20:09,121 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 1.43900000ms
2019-01-24 12:20:09,121 INFO [-] st2.cicd.amqp.publish.update: 1.67300000ms
2019-01-24 12:20:09,126 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 1.22700000ms
2019-01-24 12:20:09,126 INFO [-] st2.cicd.amqp.publish.update: 1.45500000ms
2019-01-24 12:20:09,146 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 2.19000000ms
2019-01-24 12:20:09,147 INFO [-] st2.cicd.amqp.publish.update: 2.45200000ms
2019-01-24 12:20:09,152 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 1.19100000ms
2019-01-24 12:20:09,152 INFO [-] st2.cicd.amqp.publish.update: 1.42900000ms
2019-01-24 12:20:09,173 INFO [-] st2.cicd.amqp.pool_publisher.publish_with_retries.st2.trigger: 2.04800000ms
...

After:

/opt/stackstorm/st2/bin/st2sensorcontainer --sensor-ref=fixtures.TestPollingSensor --single-sensor-mode --debug
2019-01-24 12:35:23,747 DEBUG [-] Using Python: 2.7.12 (/opt/stackstorm/st2/bin/python)
2019-01-24 12:35:23,747 DEBUG [-] Using config files: /etc/st2/st2.conf
2019-01-24 12:35:23,747 DEBUG [-] Using logging config: /etc/st2/logging.sensorcontainer.conf
aaaa
2019-01-24 12:35:23,753 INFO [-] Connecting to database "st2" @ "127.0.0.1:27017" as user "None".
2019-01-24 12:35:23,755 INFO [-] Successfully connected to database "st2" @ "127.0.0.1:27017" as user "None".
2019-01-24 12:35:23,868 INFO [-] Running in single sensor mode, using a single sensor partitioner...
2019-01-24 12:35:23,870 INFO [-] Setting up container to run 1 sensors.
2019-01-24 12:35:23,870 INFO [-] 	Sensors list - [u'fixtures.TestPollingSensor'].
2019-01-24 12:35:23,870 INFO [-] (PID:19859) SensorContainer started.
2019-01-24 12:35:23,870 INFO [-] Running sensor fixtures.TestPollingSensor
2019-01-24 12:35:23,877 AUDIT [-] Access granted to "sensors_container" with the token set to expire at "2019-01-25T12:35:23.876977Z". (username='sensors_container',token_expiration='2019-01-25T12:35:23.876977Z')
2019-01-24 12:35:23,878 WARNING [-] "auth.api_url" configuration option is not configured
2019-01-24 12:35:23,887 INFO [-] Connected to amqp://guest:**@127.0.0.1:5672//
2019-01-24 12:35:23,889 INFO [-] Sensor fixtures.TestPollingSensor started
2019-01-24 12:35:24,394 INFO [-] Found config for sensor "TestPollingSensor"
2019-01-24 12:35:24,394 INFO [-] Watcher started
2019-01-24 12:35:24,395 INFO [-] Running sensor initialization code
2019-01-24 12:35:24,395 INFO [-] Running sensor in active mode (poll interval=5s)
2019-01-24 12:35:24,408 INFO [-] Connected to amqp://guest:**@127.0.0.1:5672//

@Kami Kami added the bug label Jan 24, 2019
@Kami Kami added this to the 3.0.0 milestone Jan 24, 2019
@Kami Kami requested a review from lakshmi-kannan January 24, 2019 12:36
@Kami Kami modified the milestones: 3.0.0, 2.10.2 Jan 24, 2019
@Kami Kami merged commit 8b84ec7 into master Jan 25, 2019
@Kami Kami deleted the ignore_statsd_log_messages_in_wrapper_processes branch January 25, 2019 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants