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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[events/service checks] Allow Integer date_happened / timestamp option #115

Merged
merged 3 commits into from
Jul 8, 2019

Conversation

KSerrania
Copy link
Contributor

@KSerrania KSerrania commented Jul 4, 2019

What does this PR do?

When formatting events, we process all opts as if they're Strings,
but date_happened is actually an Integer timestamp.
Added logic and unit tests to handle this Integer option.

This fixes issue #100.

Additional notes

I'm not sure if it's better to log a warning and ignore the option, raise an exception or do nothing and add the option in the event string whatever the value of date_happened is.

Should we also type check the String options? That could break some non-conventional use cases (for example, right now passing an array in the hostname option won't crash the client but shouldn't be accepted).

Thoughts @albertvaka?

When formatting events, we process all opts as if they're Strings,
but date_happened is actually an Integer timestamp.
Added logic and unit tests to handle this Integer option.
@albertvaka
Copy link
Contributor

I think we should still accept strings, to not break backwards compatibility... if someone was passing a string before, this would break it for them. The bug report says that they ended up passing a string, for example.

Apart from that, LGTM 😃

@KSerrania
Copy link
Contributor Author

Should we do the same for format_service_check? The docs say we accept Integers for :timestamp, but we call remove_pipes, which crashes if used on Integers

@KSerrania KSerrania force-pushed the kserrania/fix-date-happened-event branch from 6a55ffb to 1bf7e1e Compare July 5, 2019 16:03
@albertvaka
Copy link
Contributor

Yes, that would make sense.

Copy link
Contributor

@albertvaka albertvaka left a comment

Choose a reason for hiding this comment

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

LGTM

@KSerrania KSerrania changed the title [events] Fix crash when Integer date_happened option is provided [events/service checks] Allow Integer date_happened / timestamp option Jul 8, 2019
@KSerrania KSerrania merged commit 4870d93 into master Jul 8, 2019
@KSerrania KSerrania deleted the kserrania/fix-date-happened-event branch July 8, 2019 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants