-
Notifications
You must be signed in to change notification settings - Fork 115
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip collecting logs and events on failure via env var #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is worth trying, but we should leave it undocumented for now. Making it an env var seems okay... it's kinda a similar setting to log levels, which use env vars too. Naming is tricky though, since the most obvious choices sound like they could be talking about the gem's logging. DISABLE_FETCHING_DEBUG_INFO=1
, DISABLE_KUBE_DEBUG_INFO=1
, FETCH_EVENTS_AND_LOGS_ON_FAILURE=0
?
I'm also wondering if we should make the logs and events switches separate. For huge deployments like the ones that are running into problems, events are significantly more useful than logs... but at a guess they're more likely the culprits of the fetch slowness.
def test_debug_message_with_no_debug_info | ||
ENV['NO_DEBUG_INFO'] = 'true' | ||
dummy = DummyResource.new | ||
dummy.expects(:deploy_failed?).returns(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a stub, let's make this settable the same way we have done for deploy_succeeded?
(add an attribute and a write for that attribute)
dummy = DummyResource.new | ||
dummy.expects(:deploy_failed?).returns(true) | ||
|
||
assert_match dummy.debug_message, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also refute that it matches - Logs
or - Events
@@ -12,6 +12,7 @@ class KubernetesResource | |||
TIMEOUT = 5.minutes | |||
LOG_LINE_COUNT = 250 | |||
|
|||
NO_DEBUG_INFO_MESSAGE = "Event and log collection is disabled by the NO_DEBUG_INFO env var." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's make the env var string itself a constant too, since it's used in three places.
This is ready for a second look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentation issue and then 🎩 with test_deploy_result_logging_for_mixed_result_deploy
to confirm that it looks right. Other than that, looks good to me!
@@ -169,12 +173,16 @@ def debug_message | |||
@events.each do |identifier, event_hashes| | |||
event_hashes.each { |event| helpful_info << " [#{identifier}]\t#{event}" } | |||
end | |||
elsif ENV[DISABLE_FETCHING_EVENT_INFO] | |||
helpful_info << DISABLED_EVENT_INFO_MESSAGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a bunch (~10) of deployments fail, there can be a 5+ minute delay between the polling loop completing and the statsd metric for completion being emitted. #238 sped this up by collecting logs and events in parallel. This PR goes one more step and provides a way to skip this altogether.
Open question: Should this be an env var?