[MM-60687] Log DoActionRequest requests to INFO (#29952)

* log DoActionRequest requests to INFO

* make generated
Этот коммит содержится в:
Christopher Poile
2025-01-21 20:02:39 -05:00
коммит произвёл GitHub
родитель a08341d398
Коммит c205398040
2 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@@ -135,6 +135,10 @@ type AppIface interface {
// DisablePlugin will set the config for an installed plugin to disabled, triggering deactivation if active.
// Notifies cluster peers through config change.
DisablePlugin(id string) *model.AppError
// DoActionRequest performs an HTTP POST request to an integration's action endpoint.
// Caller must consume and close returned http.Response as necessary.
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
DoActionRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError)
// DoPermissionsMigrations execute all the permissions migrations need by the current version.
DoPermissionsMigrations() error
// EnablePlugin will set the config for an installed plugin to enabled, triggering asynchronous
@@ -290,10 +294,6 @@ type AppIface interface {
PatchBot(rctx request.CTX, botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
// PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.
PatchChannelModerationsForChannel(c request.CTX, channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
// Perform an HTTP POST request to an integration's action endpoint.
// Caller must consume and close returned http.Response as necessary.
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
DoActionRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError)
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
PermanentDeleteBot(rctx request.CTX, botUserId string) *model.AppError
// PopulateWebConnConfig checks if the connection id already exists in the hub,

Просмотреть файл

@@ -234,6 +234,15 @@ func (a *App) DoPostActionWithCookie(c request.CTX, postID, actionId, userID, se
return "", model.NewAppError("DoPostActionWithCookie", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
// Log request, regardless of whether destination is internal or external
c.Logger().Info("DoPostActionWithCookie POST request, through DoActionRequest",
mlog.String("url", upstreamURL),
mlog.String("user_id", upstreamRequest.UserId),
mlog.String("post_id", upstreamRequest.PostId),
mlog.String("channel_id", upstreamRequest.ChannelId),
mlog.String("team_id", upstreamRequest.TeamId),
)
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(*a.Config().ServiceSettings.OutgoingIntegrationRequestsTimeout)*time.Second)
defer cancel()
resp, appErr := a.DoActionRequest(c.WithContext(ctx), upstreamURL, requestJSON)
@@ -297,7 +306,7 @@ func (a *App) DoPostActionWithCookie(c request.CTX, postID, actionId, userID, se
return clientTriggerId, nil
}
// Perform an HTTP POST request to an integration's action endpoint.
// DoActionRequest performs an HTTP POST request to an integration's action endpoint.
// Caller must consume and close returned http.Response as necessary.
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
func (a *App) DoActionRequest(c request.CTX, rawURL string, body []byte) (*http.Response, *model.AppError) {
@@ -489,6 +498,14 @@ func (a *App) SubmitInteractiveDialog(c request.CTX, request model.SubmitDialogR
return nil, model.NewAppError("SubmitInteractiveDialog", "app.submit_interactive_dialog.json_error", nil, "", http.StatusBadRequest).Wrap(err)
}
// Log request, regardless of whether destination is internal or external
c.Logger().Info("SubmitInteractiveDialog POST request, through DoActionRequest",
mlog.String("url", url),
mlog.String("user_id", request.UserId),
mlog.String("channel_id", request.ChannelId),
mlog.String("team_id", request.TeamId),
)
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(*a.Config().ServiceSettings.OutgoingIntegrationRequestsTimeout)*time.Second)
defer cancel()
resp, appErr := a.DoActionRequest(c.WithContext(ctx), url, b)