Skip to content

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

Merged
KSerrania merged 3 commits intomasterfrom
kserrania/fix-date-happened-event
Jul 8, 2019
Merged

[events/service checks] Allow Integer date_happened / timestamp option#115
KSerrania merged 3 commits intomasterfrom
kserrania/fix-date-happened-event

Conversation

@KSerrania
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Yes, that would make sense.

Copy link
Copy Markdown
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