Closed aimee-ault closed 5 years ago
Hey,
To get daily counts of events I think you'll have to do
count = 0
events = client.events(client.projects.last.id)
count += events.count
last_response = client.last_response
until last_response.rels[:next].nil?
last_response = last_response.rels[:next].get
count += last_response.data.count
end
and include the timestamps you want to restrict to. Apologies that this isn't super easy at the moment. As part of a new dashboard we want to release soon there will be an api available to get arbitrary counts between two dates relatively easily!
hey @snmaynard , I just stumbled across this issue. Did you ever release any updates to the API to make getting event counts easier? Would be super handy for error rate % calculations.
Apologies I didnt get back to this issue, missed the github notifications. For future reference you can now do this with the trends API -> https://bugsnagapiv2.docs.apiary.io/#reference/errors/trends/list-the-trends-for-a-project-(buckets)
I'm hoping this isn't actually a bug but just user error on my part, but reporting it either way to clarify (also sorry if I'm reporting this in the wrong place, but it seemed like it might be an API issue instead of with the gem, but I know you guys maintain the gem as well...)
So, using the ruby gem for the Bugsnag API, if I set up a client with
auto_paginate
set to false in the client config, it continues to return paginated results.For example:
I then use the client to fetch errors and events counts on the last project on my account:
30 being the default pagination in the API. However, if I take a look at
client.projects.last
, I can see that it has an errors count of 2719, much higher than 30. Overriding the paginated count in the options sent with the request seems to cap the set to 100 results (which also seems to be the client's default).Also: To provide better context for what I'm trying to do: I just want to get daily counts of events--I excluded the start_date, end_date arguments from above just to clarify the issue but in actual use, I'm including those... so it seems wasteful to need to pull so much event data and also kind of weird that I'd have to iterate over multiple requests just to get accurate counts. I've gone through the API docs a few times but it seems like this is the only way to get that information?