chore: rate limit param (#4785)

This commit is contained in:
Vishal Sharma 2024-04-01 15:06:38 +05:30 committed by GitHub
parent 5e0e9da6c4
commit 8c02f8ec31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -401,7 +401,7 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router, am *AuthMiddleware) {
router.HandleFunc("/api/v1/explorer/views/{viewId}", am.EditAccess(aH.deleteSavedView)).Methods(http.MethodDelete)
router.HandleFunc("/api/v1/feedback", am.OpenAccess(aH.submitFeedback)).Methods(http.MethodPost)
router.HandleFunc("/api/v1/events", am.ViewAccess(aH.registerEvent)).Methods(http.MethodPost)
router.HandleFunc("/api/v1/event", am.ViewAccess(aH.registerEvent)).Methods(http.MethodPost)
// router.HandleFunc("/api/v1/get_percentiles", aH.getApplicationPercentiles).Methods(http.MethodGet)
router.HandleFunc("/api/v1/services", am.ViewAccess(aH.getServices)).Methods(http.MethodPost)
@ -1516,7 +1516,7 @@ func (aH *APIHandler) registerEvent(w http.ResponseWriter, r *http.Request) {
}
userEmail, err := auth.GetEmailFromJwt(r.Context())
if err == nil {
telemetry.GetInstance().SendEvent(request.EventName, request.Attributes, userEmail, true, true)
telemetry.GetInstance().SendEvent(request.EventName, request.Attributes, userEmail, request.RateLimited, true)
aH.WriteJSON(w, r, map[string]string{"data": "Event Processed Successfully"})
} else {
RespondError(w, &model.ApiError{Typ: model.ErrorInternal, Err: err}, nil)

View File

@ -165,8 +165,9 @@ type GetTopOperationsParams struct {
}
type RegisterEventParams struct {
EventName string `json:"eventName"`
Attributes map[string]interface{} `json:"attributes"`
EventName string `json:"eventName"`
Attributes map[string]interface{} `json:"attributes"`
RateLimited bool `json:"rateLimited"`
}
type GetUsageParams struct {