DataJunction / dj

A metrics platform.
http://datajunction.io
MIT License
34 stars 15 forks source link

Proposal for cube-centric consumption endpoints #869

Open samredai opened 10 months ago

samredai commented 10 months ago

The client experiences have naturally become split, having a client type (call it the "reader" persona) for those wanting to pull metadata on nodes or pull sql/data and those who want to contribute towards building the DJ graph (call it the "builder" persona). We've largely thought of reader functionality as a subset of builder functionality, in other words, readers need to view a set of things and builders need to view/edit/create those things.

image

This is largely correct but I think the CRUDish feeling of the "reader" functionality is not inviting to a user who isn't interested in the DJ internals but just wants to know what data is available for consumption and how can they get it. This is largely what the cube construct is meant to support and I would roughly say that data is available for consumption if:

This proposal is to extend the reader functionality by extending the client and adding some facilitating endpoints to the backend API that extends the cube router to provide a rich "cube only" set of features. image

A few examples would be:

agorajek commented 10 months ago

@samredai I don't think that anything you said here is controversial, but I may be missing something here... are you saying that this cube-centric functionality should be added to the Reader side but not-added to the Builder side? I think that the ability for the Builder class to inherit all of the Reader class is natural and does not seems like a problem to me. As I said I think I am missing the point here.

samredai commented 10 months ago

@agorajek using the client interface was probably a bit of a distraction but the core of what I'm proposing is that we extend the api by adding a number of /cubes/{functionality}/ endpoints.

We do this today for metrics and dimensions, i.e. the /metrics/common/dimensions/ and /dimensions/common/metrics/ endpoints so I didn't expect it to be too controversial to do something similar for cubes. I just wanted to get everyone's thoughts. I'll start on a PR adding a few of this to give something more concrete to review.

agorajek commented 10 months ago

Ah... yes indeed. Agree on both points: client was a distraction on the topic and the /cubes/* endpoints makes total sense.

shangyian commented 10 months ago

@samredai I agree that extending these API endpoints with more cube-specific ones make sense! There's also already /cubes/dimensions/sql and /cubes/dimensions/data. Once we have better logic to handle the max-stale headers, it'll be much clearer to users what kind of data they're getting back from a cube.

samredai commented 10 months ago

Awesome I'll get started on a couple of these towards the end of this week!