for api delivering time range of performance data down granularity of 1 second primary consumption being live graphs (ajax) though used alerts well, better have api input take begin date , end date or start time , time range? example
get_data("begintime": "2016-01-01t00:00:00z", "endtime": "2016-01-01t00:05:00z")
or
get_data("datatime":"2016-01-01t00:00:00z","timewidthsecs":300)
both versions have advantages.
the first api in cases knew time range wanted. exact time range pertinent if knew time range performance problem occurred.
the second api more flexible. since main use case graphing data, second 1 allow me overload arguments. example :
get_data("datatime":"2016-01-01t00:00:00z") /* returns data since time , polling , refreshing graph */
get_data("timewidthsecs":300) /* return recent 300 secs , intial setup of graph */
get_data("datatime":"2016-01-01t00:00:00z","timewidthsecs":300) /* data since time, 300 secs , getting historic time range */
get_data("datatime":"2016-01-01t00:00:00z","timewidthsecs":-300) /* data before time, 300 seconds, getting historic time range */
since consumer might polling , getting data since time, i.e. last date have data for, useful. of course there should other construct stream data push model, wanted pull model useful.
also easier read/debug code gives timewidth in seconds rather 2 dates human intervention require human date arithmetic.
thoughts?
Comments
Post a Comment