Add new Metrics API (#26919)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
099f704d4f
Коммит
5590e1604a
@@ -588,6 +588,10 @@ func (c *Client4) bookmarkRoute(channelId, bookmarkId string) string {
|
||||
return fmt.Sprintf(c.bookmarksRoute(channelId)+"/%v", bookmarkId)
|
||||
}
|
||||
|
||||
func (c *Client4) perfMetricsRoute() string {
|
||||
return "/perf"
|
||||
}
|
||||
|
||||
func (c *Client4) DoAPIGet(ctx context.Context, url string, etag string) (*http.Response, error) {
|
||||
return c.DoAPIRequest(ctx, http.MethodGet, c.APIURL+url, "", etag)
|
||||
}
|
||||
@@ -8848,3 +8852,16 @@ func (c *Client4) ListChannelBookmarksForChannel(ctx context.Context, channelId
|
||||
}
|
||||
return b, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) SubmitClientMetrics(ctx context.Context, report *PerformanceReport) (*Response, error) {
|
||||
buf, err := json.Marshal(report)
|
||||
if err != nil {
|
||||
return nil, NewAppError("SubmitClientMetrics", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
res, err := c.DoAPIPostBytes(ctx, c.perfMetricsRoute(), buf)
|
||||
if err != nil {
|
||||
return BuildResponse(res), err
|
||||
}
|
||||
|
||||
return BuildResponse(res), nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user