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
fix: only send metrics if there is data to send. (#58) #66
Conversation
Pull Request Test Coverage Report for Build 1589092239
💛 - Coveralls |
1432bd3
to
5cb50ab
Compare
5cb50ab
to
ac4bde9
Compare
expect(WebMock).to have_requested(:post, 'http://test-url/client/metrics') | ||
.with( | ||
body: hash_including( | ||
appName: "my-test-app", | ||
instanceId: "rspec/test" | ||
) | ||
) | ||
.with { |req| | ||
hash = JSON.parse(req.body) | ||
|
||
[ | ||
DateTime.parse(hash['bucket']['stop']) >= DateTime.parse(hash['bucket']['start']), | ||
hash['bucket']['toggles']['featureA']['yes'] == 3, | ||
hash['bucket']['toggles']['featureA']['no'] == 2, | ||
hash['bucket']['toggles']['featureB']['yes'] == 1 | ||
].all?(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.
[rubocop] <Lint/AmbiguousBlockAssociation> reported by reviewdog 🐶
Parenthesize the param `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with { |req|
hash = JSON.parse(req.body)
[
DateTime.parse(hash['bucket']['stop']) >= DateTime.parse(hash['bucket']['start']),
hash['bucket']['toggles']['featureA']['yes'] == 3,
hash['bucket']['toggles']['featureA']['no'] == 2,
hash['bucket']['toggles']['featureB']['yes'] == 1
].all?(true)
}` to make sure that the block will be associated with the `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with` method call.
expect(WebMock).to have_requested(:post, 'http://test-url/client/metrics') | ||
.with( | ||
body: hash_including( | ||
appName: "my-test-app", | ||
instanceId: "rspec/test" | ||
) | ||
) | ||
.with { |req| | ||
hash = JSON.parse(req.body) | ||
|
||
[ | ||
DateTime.parse(hash['bucket']['stop']) >= DateTime.parse(hash['bucket']['start']), | ||
hash['bucket']['toggles']['featureA']['yes'] == 3, | ||
hash['bucket']['toggles']['featureA']['no'] == 2, | ||
hash['bucket']['toggles']['featureB']['yes'] == 1 | ||
].all?(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.
[rubocop] <Lint/AmbiguousBlockAssociation> reported by reviewdog 🐶
Parenthesize the param `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with { |req|
hash = JSON.parse(req.body)
[
DateTime.parse(hash['bucket']['stop']) >= DateTime.parse(hash['bucket']['start']),
hash['bucket']['toggles']['featureA']['yes'] == 3,
hash['bucket']['toggles']['featureA']['no'] == 2,
hash['bucket']['toggles']['featureB']['yes'] == 1
].all?(true)
}` to make sure that the block will be associated with the `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with` method call.
|
||
metrics_reporter.post | ||
|
||
expect(WebMock).to have_requested(:post, 'http://test-url/client/metrics') |
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.
Lint/AmbiguousBlockAssociation: Parenthesize the param `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with { |req|
hash = JSON.parse(req.body)
[
DateTime.parse(hash['bucket']['stop']) >= DateTime.parse(hash['bucket']['start']),
hash['bucket']['toggles']['featureA']['yes'] == 3,
hash['bucket']['toggles']['featureA']['no'] == 2,
hash['bucket']['toggles']['featureB']['yes'] == 1
].all?(true)
}` to make sure that the block will be associated with the `have_requested(:post, 'http://test-url/client/metrics')
.with(
body: hash_including(
appName: "my-test-app",
instanceId: "rspec/test"
)
)
.with` method call.
(at-me in a reply with help
or ignore
)
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.
Looks good
We want to preserve the backend from having to work, when there is no work to be done.
c010b0c
to
090b803
Compare
We want to preserve the backend from having to work, when there is no work to be done.