<div dir="ltr"><div><div><div>Hello,<br><br></div>One point not made so far, even today developers have to code twice against GET &#39;*/data/&#39; because of different possible outputs. First is GET &#39;*/data/&#39; with some parameters to get raw data and then another instance with identical URL but different parameters to get bucketed results. The split in API will formalize the differences and will no longer burden the developer with reading the documentation to make sure the right parameters are passed.<br><br></div>The typical CRUD REST API design principles cannot be applied in some cases to the Hawkular Metrics interface because of the project&#39;s nature. There is little CRUD in ingesting metrics once and making that data available in a few different ways (raw, bucketed, by tags, and eventually pre-computed aggregates). And that makes it somewhat challenging to design and find good articles and examples. But here a few resources that I think are good in this context:<br><br>1) <a href="https://www.thoughtworks.com/insights/blog/rest-api-design-resource-modeling" target="_blank">https://www.thoughtworks.com/insights/blog/rest-api-design-resource-modeling</a>  - section &#39;An example from the public GitHub API&#39;<br>2) <a href="http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api" target="_blank">http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api</a> - section &#39;What about actions that don&#39;t fit into the world of CRUD operations?&#39;<br>3) <a href="https://developer.github.com/v3/repos/statistics/" target="_blank">https://developer.github.com/v3/repos/statistics/</a>  - documentation 
page to get statistical data for a repo, the rest of the documentation 
is also interesting<br>4) <a href="https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats" target="_blank">https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats</a> - documentation for getting ad keyword statistics<br><br></div>I see two common themes in the links above. First, the public APIs are really complex and the number of end-points is really not the concern; more important are ease of use, single purpose, and good documentation. And second, outside of CRUD there is little material (blogs, books, articles) about what to do.<br><div><br></div><div>With this in mind here is the plan of action based on the feedback in this thread and many discussions we had in the community and amongst Hawkular Metrics contributors. Hawkular Metrics will proceed with merging the first PR to split and restructure &#39;/data&#39;, the old code is deprecated but intact. We will work with the community and current users to find the best path to fully remove &#39;*/data&#39;. We will publish more details about the deprecation and plans for removal as soon as we have more details; also except this change to be documented in detail in the release notes until fully removed. Just to be clear, this is not a single release transition to fully remove &#39;*/data/&#39;, so far we identified a minimum of 3 releases, but it could extend beyond that based on feedback.<br></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr">Thank you,<br>Stefan Negrea<br><br>Software Engineer<br><br></div></div></div>
<br><div class="gmail_quote">On Tue, Apr 5, 2016 at 8:04 AM, Heiko W.Rupp <span dir="ltr">&lt;<a href="mailto:hrupp@redhat.com" target="_blank">hrupp@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On 5 Apr 2016, at 0:18, Stefan Negrea wrote:<br>
<br>
&gt; On Mon, Apr 4, 2016 at 4:03 PM, John Sanda &lt;<a href="mailto:jsanda@redhat.com" target="_blank">jsanda@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Making sure we don’t break clients is the most important aspect of<br>
&gt;&gt; this;<br>
&gt;&gt; however, there are some other questions I want to throw out. Today we<br>
&gt;&gt; only<br>
&gt;&gt; support clients adding raw data points. What if in the future though<br>
&gt;&gt; we add<br>
&gt;&gt; support for complex types like histograms and allow clients to<br>
&gt;&gt; directly<br>
&gt;&gt; store them. Would clients post that data to /raw, /stats, or<br>
&gt;&gt; something else?<br>
&gt;&gt;<br>
&gt;&gt; Today we compute aggregated metrics at query time. We are going to<br>
&gt;&gt; add<br>
&gt;&gt; support for pre-computed aggregate metrics that are persisted. Do we<br>
&gt;&gt; have<br>
&gt;&gt; different endpoints for each? I haven’t thought about it too much<br>
&gt;&gt; yet, but<br>
&gt;&gt; I don’t separate endpoints is the way to go.<br>
&gt;&gt;<br>
&gt;<br>
&gt; In the actual JIRA ticket there were 3 ideas floated around: separate<br>
&gt; endpoint, or /raw endpoint (because that is not bucketed data), or<br>
&gt; /stats<br>
&gt; endpoint (because is bucketed, just server side). And I think those<br>
&gt; are all<br>
&gt; the possible variations. One thing that I do not like about &#39;/data&#39;<br>
&gt; and<br>
&gt; pre-computed aggregates, if we do not split that method will serve 3<br>
&gt; or 4<br>
&gt; different formats depending on query params. That is way too<br>
&gt; complicated<br>
&gt; for both us and the users.<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; With HWKMETRICS-373, we are introducing support for tag based<br>
&gt;&gt; bucketing as<br>
&gt;&gt; opposed to the date range bucketing already have. There are some<br>
&gt;&gt; minor<br>
&gt;&gt; differences in the data structures returned in the response, namely a<br>
&gt;&gt; map<br>
&gt;&gt; is returned instead of an array. Should we have a different endpoints<br>
&gt;&gt; for<br>
&gt;&gt; tag based buckets vs date range buckets?<br>
&gt;&gt;<br>
&gt;<br>
&gt; I like the idea of just raw and stats. I associate /raw with raw data<br>
&gt; stored by Hawkular Metrics, and that includes pre-computed aggregates<br>
&gt; too,<br>
&gt; and /stats with some sort of statistical computation done do the raw<br>
&gt; data<br>
&gt; before returned to the user. Based on this, the tag querying would<br>
&gt; fall<br>
&gt; under &#39;/stats&#39; if data is bucketed and would fall under &#39;/raw&#39; if you<br>
&gt; query<br>
&gt; for just raw data that is tagged.<br>
<br>
<br>
</div></div>John wrote about &quot;tag based bucketing as opposed to the date range<br>
bucketing&quot;<br>
<br>
So both is bucket data and both /stats -- but with different return<br>
types.<br>
If this is true, they need to return different content-types. This can<br>
not just<br>
be returned like so without any notice to the used and the user doing<br>
the<br>
guesswork.<br>
<div><div>_______________________________________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org" target="_blank">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/hawkular-dev</a><br>
</div></div></blockquote></div><br></div></div>