-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds metrics view events #170
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
67fbee3
to
8fb160c
Compare
8fb160c
to
8b5dc73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm struggling to read this, the tests aren't making clear to me how I (as a user) should use this and what I do with it.
|
||
# invoke | ||
usage = c.usage.find() | ||
events = usage.Usage(c, session).find() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right, right? I can't get here from Client
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it in favor of the Views interface, but I'm unsure if that's the right call. What is your opinion? Should we continue exposing Usage
and Visits
even though Views
is a superset of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should wire them up all under metrics
. Since they're in the API, it seems reasonable that we should provide a wrapper for them. Perhaps the user knows they only want one and not the other, and it's more efficient to just request the one they want. We prefer the one that just works and has everything, and we emphasize that in docs and guides.
As I was reading the API docs to try to understand the feature, I realized there's another place we probably want to expose this: on ContentItem
, which would hit these APIs but filtered by guid. In that case, you won't want to query both endpoints because only one will work: one is for shiny (R only? IDK) and one is for everything else. That feels like a place where I don't want all three available, I don't want to have to think about which is right?
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. Based on my conversations with @kmasiello and other's it seems like understanding that aspect of the APIs is cumbersome. Aside from that, I really don't like the existing names. Maybe, namespace them under metrics.instrumentation
(e.g., metrics.instrumentation.usage
and metrics.instrumentation.visits
).
Adding the hook in ContentItem
is a great idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from that, I really don't like the existing names.
Yeah, agreed. Honestly I can't tell the difference between Views
, Visits
, and Usage
.
Maybe, namespace them under
metrics.instrumentation
(e.g.,metrics.instrumentation.usage
andmetrics.instrumentation.visits
).
I guess you could 🤷 . So metrics.instrumentation
would yield another object that has usage
and visits
attributes?
Do we need Views under metrics
? Do we have other metrics? I guess this is top-level, so we could have other things like system metrics?
Would it make sense to put Views off of Content, even though that's not where they're mounted in the API? Like client.content.views.find()
? They are views of content, yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed. Honestly I can't tell the difference between Views, Visits, and Usage.
We should use this as an opportunity to improve the API. If the Views
abstraction is well received, we should introduce that in a future version of Connect and drop the rest of the instrumentation API.
Do we have other metrics?
Nothing else at the moment, but we should. @christierney / @Lytol - what else are we pushing into Prometheus? It seems right to me to separate the namespace for metrics to declutter the non-metrics part of the API.
Would it make sense to put Views off of Content.
We can. It's the existing implementation plus a filter on content_guid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed. Honestly I can't tell the difference between Views, Visits, and Usage.
We should use this as an opportunity to improve the API. If the Views abstraction is well received, we should introduce that in a future version of Connect and drop the rest of the instrumentation API.
Agreed. I just meant more about naming, I couldn't tell which was the one that contained the others since they all sounds the same. But if we're only presenting one name, I think it's fine.
Would it make sense to put Views off of Content.
We can. It's the existing implementation plus a filter on content_guid.
Let me clarify. I think there are two different ideas:
- Add
content.get(guid).views.find()
, which is equivalent to the currentmetrics.views.find(content_guid = guid)
. That's from a previous comment. - What I meant here was: instead of
client.metrics.views
, should it be exposed viaclient.content.views
and skip themetrics
path entirely? Ifviews
are always about Content, maybe it makes logical sense to access them via content. (Or if we have other metrics to expose, we could do both?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant here was: instead of client.metrics.views, should it be exposed via client.content.views and skip the metrics path entirely? If views are always about Content, maybe it makes logical sense to access them via content. (Or if we have other metrics to expose, we could do both?)
There are reasons to want to analyze the total usage across all applications. We don't have any other way of doing that other than collecting all views for every piece of content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add #181
Is this PR intended to solve #137? |
Yes |
The main interface is |
The
metrics.views
package coalesces the existing instrumentation APIs into a single interface. The new event typemetrics.views.ViewEvent
encapsulates themetrics.usage.UsageEvent
andmetrics.visits.VisitEvent
. TheViewEvent
schema is a mashup of the two underlying schemas, with the exception of thetime
field onVisitEvent
. InViewEvent
this field is removed and mapped tostarted
andended
. Otherwise, fields that do not exist in the underlying schema returnNone
.Resolves #137