librato / librato-metrics

Ruby wrapper to make it easy to interact with Librato's API.
https://librato.com
Other
108 stars 51 forks source link

Client should test for invalid data #71

Closed radiospiel closed 11 years ago

radiospiel commented 11 years ago

In the spirit of #69 the client should already test if some data is invalid to prevent it from being sent to the server in the first place. I stumbled across a coding error where I sent much more data to the server as intended, and the librato server correctly returned an error ("metrics is configured as a counter, but..".

I guess this error could have been raised from the gem already, without the roundtrip.

nextmat commented 11 years ago

@radiospiel The challenge with doing the specific kind of validation client-side you suggest is that the client side does not have stateful knowledge of the kind of metric you submitted with that name previously. So to validate it would have to do a query on all the metrics you were about to submit per submission which would significantly degrade performance.

I'm definitely open to other options for client-side validation though if you have them.

I've tried to strike a balance between validations that can be performed quickly client-side vs the performance impact of more heavy validations. The gem is used in a lot of places where performance really matters so I always weigh that in adding features.

nextmat commented 11 years ago

Let me know if you have further thoughts on this, closing for now.