-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support for push report metrics endpoint. #98
Conversation
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.
Thanks @lisaah for this PR! Just a few notes for types and backwards compatibility
lib/regions.ts
Outdated
|
||
constructor(trackUrl: string, apiUrl: string) { | ||
constructor(trackUrl: string, apiUrl: string, trackPushUrl: string) { |
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.
To maintain backwards compatibility, this should be optional. I doubt anyone is creating their own Regions, but just in case!
lib/track.ts
Outdated
@@ -20,6 +20,7 @@ export class TrackClient { | |||
request: Request; | |||
trackRoot: string; | |||
apiRoot: string; | |||
trackPushRoot: string; |
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.
Similarly, this should be optional
lib/track.ts
Outdated
@@ -98,6 +100,10 @@ export class TrackClient { | |||
}); | |||
} | |||
|
|||
trackPush(data: RequestData = {}) { |
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.
A few things here:
data
should be more strongly typed. According to the api docs, there are only four valid parameters. Atype
orinterface
should be created fortrackPush
to only allow those four (requried) parameters- There should be special handling if
this.trackPushRoot
isundefined
. Probably aMissingParamError
or a newError
subclass
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.
👍 Added the typing, can make it required but the docs don't seem to annotate them as required like it does for name in regular events.
@lisaah thanks for the updates! I'm sorry about the back and forth, but after you opened this PR I had a chat with the team about why the push metrics endpoint was different, and we all agreed it was a bit weird. We've made a change in production that adds |
Sure, think it makes the code cleaner that way anyways. |
Thanks again @lisaah, this has been published with |
The base url for this endpoint doesn't seem to obey the
api/v1
standard of the rest.