MM-21898: Part 2. Add opentracing (#13904)
* initial implementation of opentracing * app layer * Revert Makefile * . * cleanup * . * . * . * . * . * . * . * . * . * . * . * [ci] * autogenerate interface * . * missed vendor files * updated interfaces * updated store layers * lint fixes * . * finishing layer generators and nested spans * added errors and b3 support * code review * . * . * fixed build error due to misplased flag.Parse() * code review addressed
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a34ec4793
Коммит
182c29b456
334
app/app_iface.go
334
app/app_iface.go
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// Code generated by "make store-layers"
|
||||
// Code generated by "make app-layers"
|
||||
// DO NOT EDIT
|
||||
|
||||
package app
|
||||
@@ -35,16 +35,257 @@ import (
|
||||
|
||||
// AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation.
|
||||
type AppIface interface {
|
||||
// GetViewUsersRestrictionsForTeam returns a list with the channel ids that the user has permissions to view on a
|
||||
// team. If the result is an empty list, the user can't view any channel; if it's
|
||||
// nil, there are no restrictions for the user in the specified team.
|
||||
GetViewUsersRestrictionsForTeam(userId string, teamId string) ([]string, *model.AppError)
|
||||
// @openTracingParams teamId
|
||||
// previous ListCommands now ListAutocompleteCommands
|
||||
ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
|
||||
// @openTracingParams teamId, skipSlackParsing
|
||||
CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError)
|
||||
// AddCursorIdsForPostList adds NextPostId and PrevPostId as cursor to the PostList.
|
||||
// The conditional blocks ensure that it sets those cursor IDs immediately as afterPost, beforePost or empty,
|
||||
// and only query to database whenever necessary.
|
||||
AddCursorIdsForPostList(originalList *model.PostList, afterPost, beforePost string, since int64, page, perPage int)
|
||||
// AddPublicKey will add plugin public key to the config. Overwrites the previous file
|
||||
AddPublicKey(name string, key io.Reader) *model.AppError
|
||||
// Basic test team and user so you always know one
|
||||
CreateBasicUser(client *model.Client4) *model.AppError
|
||||
// Caller must close the first return value
|
||||
FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)
|
||||
// ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given
|
||||
// groups.
|
||||
//
|
||||
// The result can be used, for example, to determine the set of users who would be removed from a channel if the
|
||||
// channel were group-constrained with the given groups.
|
||||
ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
|
||||
// ClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
|
||||
ClientConfigWithComputed() map[string]string
|
||||
// ConvertUserToBot converts a user to bot.
|
||||
ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
|
||||
// CreateBot creates the given bot and corresponding user.
|
||||
CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
|
||||
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
|
||||
CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
|
||||
// CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups
|
||||
// are configured to sync with teams and channels for group members on or after the given timestamp.
|
||||
CreateDefaultMemberships(since int64) error
|
||||
// CreateGuest creates a guest and sets several fields of the returned User struct to
|
||||
// their zero values.
|
||||
CreateGuest(user *model.User) (*model.User, *model.AppError)
|
||||
// CreateUser creates a user and sets several fields of the returned User struct to
|
||||
// their zero values.
|
||||
CreateUser(user *model.User) (*model.User, *model.AppError)
|
||||
// Creates and stores FileInfos for a post created before the FileInfos table existed.
|
||||
MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo
|
||||
// DO NOT CALL THIS.
|
||||
// This is to avoid having to change all the code in cmd/mattermost/commands/* for now
|
||||
// shutdown should be called directly on the server
|
||||
Shutdown()
|
||||
// DefaultChannelNames returns the list of system-wide default channel names.
|
||||
//
|
||||
// By default the list will be (not necessarily in this order):
|
||||
// ['town-square', 'off-topic']
|
||||
// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
|
||||
// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
|
||||
// ['town-square', 'game-of-thrones', 'wow']
|
||||
DefaultChannelNames() []string
|
||||
// DeleteBotIconImage deletes LHS icon for a bot.
|
||||
DeleteBotIconImage(botUserId string) *model.AppError
|
||||
// DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed
|
||||
// groups of all group-constrained teams and channels.
|
||||
DeleteGroupConstrainedMemberships() error
|
||||
// DeletePublicKey will delete plugin public key from the config.
|
||||
DeletePublicKey(name string) *model.AppError
|
||||
// DemoteUserToGuest Convert user's roles and all his mermbership's roles from
|
||||
// regular user roles to guest roles.
|
||||
DemoteUserToGuest(user *model.User) *model.AppError
|
||||
// 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
|
||||
// DoPermissionsMigrations execute all the permissions migrations need by the current version.
|
||||
DoPermissionsMigrations() *model.AppError
|
||||
// EnablePlugin will set the config for an installed plugin to enabled, triggering asynchronous
|
||||
// activation if inactive anywhere in the cluster.
|
||||
// Notifies cluster peers through config change.
|
||||
EnablePlugin(id string) *model.AppError
|
||||
// Expand announcements in incoming webhooks from Slack. Those announcements
|
||||
// can be found in the text attribute, or in the pretext, text, title and value
|
||||
// attributes of the attachment structure. The Slack attachment structure is
|
||||
// documented here: https://api.slack.com/docs/attachments
|
||||
ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment
|
||||
// FillInPostProps should be invoked before saving posts to fill in properties such as
|
||||
// channel_mentions.
|
||||
//
|
||||
// If channel is nil, FillInPostProps will look up the channel corresponding to the post.
|
||||
FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError
|
||||
// FilterNonGroupChannelMembers returns the subset of the given user IDs of the users who are not members of groups
|
||||
// associated to the channel excluding bots
|
||||
FilterNonGroupChannelMembers(userIds []string, channel *model.Channel) ([]string, error)
|
||||
// FilterNonGroupTeamMembers returns the subset of the given user IDs of the users who are not members of groups
|
||||
// associated to the team excluding bots.
|
||||
FilterNonGroupTeamMembers(userIds []string, team *model.Team) ([]string, error)
|
||||
// GetAllLdapGroupsPage retrieves all LDAP groups under the configured base DN using the default or configured group
|
||||
// filter.
|
||||
GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
|
||||
// GetBot returns the given bot.
|
||||
GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
|
||||
// GetBotIconImage retrieves LHS icon for a bot.
|
||||
GetBotIconImage(botUserId string) ([]byte, *model.AppError)
|
||||
// GetBots returns the requested page of bots.
|
||||
GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
|
||||
// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
|
||||
GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
|
||||
// GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.
|
||||
GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
|
||||
// GetConfigFile proxies access to the given configuration file to the underlying config store.
|
||||
GetConfigFile(name string) ([]byte, error)
|
||||
// GetEmojiStaticUrl returns a relative static URL for system default emojis,
|
||||
// and the API route for custom ones. Errors if not found or if custom and deleted.
|
||||
GetEmojiStaticUrl(emojiName string) (string, *model.AppError)
|
||||
// GetEnvironmentConfig returns a map of configuration keys whose values have been overridden by an environment variable.
|
||||
GetEnvironmentConfig() map[string]interface{}
|
||||
// GetLdapGroup retrieves a single LDAP group by the given LDAP group id.
|
||||
GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)
|
||||
// GetMarketplacePlugins returns a list of plugins from the marketplace-server,
|
||||
// and plugins that are installed locally.
|
||||
GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError)
|
||||
// GetPluginPublicKeyFiles returns all public keys listed in the config.
|
||||
GetPluginPublicKeyFiles() ([]string, *model.AppError)
|
||||
// GetPluginStatus returns the status for a plugin installed on this server.
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
// GetPluginStatuses returns the status for plugins installed on this server.
|
||||
GetPluginStatuses() (model.PluginStatuses, *model.AppError)
|
||||
// GetPluginsEnvironment returns the plugin environment for use if plugins are enabled and
|
||||
// initialized.
|
||||
//
|
||||
// To get the plugins environment when the plugins are disabled, manually acquire the plugins
|
||||
// lock instead.
|
||||
GetPluginsEnvironment() *plugin.Environment
|
||||
// GetPublicKey will return the actual public key saved in the `name` file.
|
||||
GetPublicKey(name string) ([]byte, *model.AppError)
|
||||
// GetSanitizedConfig gets the configuration for a system admin without any secrets.
|
||||
GetSanitizedConfig() *model.Config
|
||||
// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
|
||||
GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
|
||||
// GetTotalUsersStats is used for the DM list total
|
||||
GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
|
||||
// InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle
|
||||
// from the prepackaged folder, if available, or remotely if EnableRemoteMarketplace is true.
|
||||
InstallMarketplacePlugin(request *model.InstallMarketplacePluginRequest) (*model.Manifest, *model.AppError)
|
||||
// InstallPlugin unpacks and installs a plugin but does not enable or activate it.
|
||||
InstallPlugin(pluginFile io.ReadSeeker, replace bool) (*model.Manifest, *model.AppError)
|
||||
// InstallPluginWithSignature verifies and installs plugin.
|
||||
InstallPluginWithSignature(pluginFile, signature io.ReadSeeker) (*model.Manifest, *model.AppError)
|
||||
// IsUsernameTaken checks if the username is already used by another user. Return false if the username is invalid.
|
||||
IsUsernameTaken(name string) bool
|
||||
// License returns the currently active license or nil if the application is unlicensed.
|
||||
License() *model.License
|
||||
// LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
|
||||
LimitedClientConfigWithComputed() map[string]string
|
||||
// MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.
|
||||
MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
|
||||
// OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon,
|
||||
// so that it points to the URL (relative) of the emoji - static if emoji is default, /api if custom.
|
||||
OverrideIconURLIfEmoji(post *model.Post)
|
||||
// PatchBot applies the given patch to the bot and corresponding user.
|
||||
PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *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(rawURL string, body []byte) (*http.Response, *model.AppError)
|
||||
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
|
||||
PermanentDeleteBot(botUserId string) *model.AppError
|
||||
// PromoteGuestToUser Convert user's roles and all his mermbership's roles from
|
||||
// guest roles to regular user roles.
|
||||
PromoteGuestToUser(user *model.User, requestorId string) *model.AppError
|
||||
// RenameChannel is used to rename the channel Name and the DisplayName fields
|
||||
RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError)
|
||||
// RenameTeam is used to rename the team Name and the DisplayName fields
|
||||
RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError)
|
||||
// RevokeSessionsFromAllUsers will go through all the sessions active
|
||||
// in the server and revoke them
|
||||
RevokeSessionsFromAllUsers() *model.AppError
|
||||
// SaveConfig replaces the active configuration, optionally notifying cluster peers.
|
||||
SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError
|
||||
// SearchAllChannels returns a list of channels, the total count of the results of the search (if the paginate search option is true), and an error.
|
||||
SearchAllChannels(term string, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, *model.AppError)
|
||||
// SearchAllTeams returns a team list and the total count of the results
|
||||
SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError)
|
||||
// ServePluginPublicRequest serves public plugin files
|
||||
// at the URL http(s)://$SITE_URL/plugins/$PLUGIN_ID/public/{anything}
|
||||
ServePluginPublicRequest(w http.ResponseWriter, r *http.Request)
|
||||
// ServerBusyStateChanged is called when a CLUSTER_EVENT_BUSY_STATE_CHANGED is received.
|
||||
ServerBusyStateChanged(sbs *model.ServerBusyState)
|
||||
// SessionHasPermissionToManageBot returns nil if the session has access to manage the given bot.
|
||||
// This function deviates from other authorization checks in returning an error instead of just
|
||||
// a boolean, allowing the permission failure to be exposed with more granularity.
|
||||
SessionHasPermissionToManageBot(session model.Session, botUserId string) *model.AppError
|
||||
// SetBotIconImage sets LHS icon for a bot.
|
||||
SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError
|
||||
// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
|
||||
SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError
|
||||
// SetStatusLastActivityAt sets the last activity at for a user on the local app server and updates
|
||||
// status to away if needed. Used by the WS to set status to away if an 'online' device disconnects
|
||||
// while an 'away' device is still connected
|
||||
SetStatusLastActivityAt(userId string, activityAt int64)
|
||||
// SyncPlugins synchronizes the plugins installed locally
|
||||
// with the plugin bundles available in the file store.
|
||||
SyncPlugins() *model.AppError
|
||||
// SyncRolesAndMembership updates the SchemeAdmin status and membership of all of the members of the given
|
||||
// syncable.
|
||||
SyncRolesAndMembership(syncableID string, syncableType model.GroupSyncableType)
|
||||
// SyncSyncableRoles updates the SchemeAdmin field value of the given syncable's members based on the configuration of
|
||||
// the member's group memberships and the configuration of those groups to the syncable. This method should only
|
||||
// be invoked on group-synced (aka group-constrained) syncables.
|
||||
SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
|
||||
// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
|
||||
// groups.
|
||||
//
|
||||
// The result can be used, for example, to determine the set of users who would be removed from a team if the team
|
||||
// were group-constrained with the given groups.
|
||||
TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
|
||||
// This function is intended for use from the CLI. It is not robust against people joining the channel while the move
|
||||
// is in progress, and therefore should not be used from the API without first fixing this potential race condition.
|
||||
MoveChannel(team *model.Team, channel *model.Channel, user *model.User, removeDeactivatedMembers bool) *model.AppError
|
||||
// This function migrates the default built in roles from code/config to the database.
|
||||
DoAdvancedPermissionsMigration()
|
||||
// This to be used for places we check the users password when they are already logged in
|
||||
DoubleCheckPassword(user *model.User, password string) *model.AppError
|
||||
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
|
||||
UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
|
||||
// UpdateBotOwner changes a bot's owner to the given value.
|
||||
UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
|
||||
// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
|
||||
UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
|
||||
// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
|
||||
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
|
||||
// UploadFileX uploads a single file as specified in t. It applies the upload
|
||||
// constraints, executes plugins and image processing logic as needed. It
|
||||
// returns a filled-out FileInfo and an optional error. A plugin may reject the
|
||||
// upload, returning a rejection error. In this case FileInfo would have
|
||||
// contained the last "good" FileInfo before the execution of that plugin.
|
||||
UploadFileX(channelId, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError)
|
||||
// Uploads some files to the given team and channel as the given user. files and filenames should have
|
||||
// the same length. clientIds should either not be provided or have the same length as files and filenames.
|
||||
// The provided files should be closed by the caller so that they are not leaked.
|
||||
UploadFiles(teamId string, channelId string, userId string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
|
||||
// UserIsInAdminRoleGroup returns true at least one of the user's groups are configured to set the members as
|
||||
// admins in the given syncable.
|
||||
UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError)
|
||||
// VerifyPlugin checks that the given signature corresponds to the given plugin and matches a trusted certificate.
|
||||
VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError
|
||||
//GetUserStatusesByIds used by apiV4
|
||||
GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)
|
||||
AcceptLanguage() string
|
||||
AccountMigration() einterfaces.AccountMigrationInterface
|
||||
ActivateMfa(userId, token string) *model.AppError
|
||||
AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string) (*model.ChannelMember, *model.AppError)
|
||||
AddConfigListener(listener func(*model.Config, *model.Config)) string
|
||||
AddCursorIdsForPostList(originalList *model.PostList, afterPost, beforePost string, since int64, page, perPage int)
|
||||
AddDirectChannels(teamId string, user *model.User) *model.AppError
|
||||
AddLicenseListener(listener func(oldLicense, newLicense *model.License)) string
|
||||
AddNotificationEmailToBatch(user *model.User, post *model.Post, team *model.Team) *model.AppError
|
||||
AddPublicKey(name string, key io.Reader) *model.AppError
|
||||
AddSamlIdpCertificate(fileData *multipart.FileHeader) *model.AppError
|
||||
AddSamlPrivateCertificate(fileData *multipart.FileHeader) *model.AppError
|
||||
AddSamlPublicCertificate(fileData *multipart.FileHeader) *model.AppError
|
||||
@@ -77,7 +318,6 @@ type AppIface interface {
|
||||
BulkExport(writer io.Writer, file string, pathToEmojiDir string, dirNameToExportEmoji string) *model.AppError
|
||||
BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model.AppError, int)
|
||||
CancelJob(jobId string) *model.AppError
|
||||
ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
|
||||
ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError)
|
||||
ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *model.AppError)
|
||||
CheckForClientSideCert(r *http.Request) (string, string, string)
|
||||
@@ -95,7 +335,6 @@ type AppIface interface {
|
||||
ClearTeamMembersCache(teamID string)
|
||||
ClientConfig() map[string]string
|
||||
ClientConfigHash() string
|
||||
ClientConfigWithComputed() map[string]string
|
||||
ClientLicense() map[string]string
|
||||
Cluster() einterfaces.ClusterInterface
|
||||
CompareAndDeletePluginKey(pluginId string, key string, oldValue []byte) (bool, *model.AppError)
|
||||
@@ -105,21 +344,14 @@ type AppIface interface {
|
||||
Compliance() einterfaces.ComplianceInterface
|
||||
Config() *model.Config
|
||||
Context() context.Context
|
||||
ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
|
||||
CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)
|
||||
CreateBasicUser(client *model.Client4) *model.AppError
|
||||
CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
|
||||
CreateChannel(channel *model.Channel, addMember bool) (*model.Channel, *model.AppError)
|
||||
CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channel, *model.AppError)
|
||||
CreateCommand(cmd *model.Command) (*model.Command, *model.AppError)
|
||||
CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError)
|
||||
CreateCommandWebhook(commandId string, args *model.CommandArgs) (*model.CommandWebhook, *model.AppError)
|
||||
CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
|
||||
CreateDefaultMemberships(since int64) error
|
||||
CreateEmoji(sessionUserId string, emoji *model.Emoji, multiPartImageData *multipart.Form) (*model.Emoji, *model.AppError)
|
||||
CreateGroup(group *model.Group) (*model.Group, *model.AppError)
|
||||
CreateGroupChannel(userIds []string, creatorId string) (*model.Channel, *model.AppError)
|
||||
CreateGuest(user *model.User) (*model.User, *model.AppError)
|
||||
CreateIncomingWebhookForChannel(creatorId string, channel *model.Channel, hook *model.IncomingWebhook) (*model.IncomingWebhook, *model.AppError)
|
||||
CreateJob(job *model.Job) (*model.Job, *model.AppError)
|
||||
CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
|
||||
@@ -136,7 +368,6 @@ type AppIface interface {
|
||||
CreateTeam(team *model.Team) (*model.Team, *model.AppError)
|
||||
CreateTeamWithUser(team *model.Team, userId string) (*model.Team, *model.AppError)
|
||||
CreateTermsOfService(text, userId string) (*model.TermsOfService, *model.AppError)
|
||||
CreateUser(user *model.User) (*model.User, *model.AppError)
|
||||
CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)
|
||||
CreateUserAsAdmin(user *model.User) (*model.User, *model.AppError)
|
||||
CreateUserFromSignup(user *model.User) (*model.User, *model.AppError)
|
||||
@@ -148,10 +379,8 @@ type AppIface interface {
|
||||
DeactivateGuests() *model.AppError
|
||||
DeactivateMfa(userId string) *model.AppError
|
||||
DeauthorizeOAuthAppForUser(userId, appId string) *model.AppError
|
||||
DefaultChannelNames() []string
|
||||
DeleteAllExpiredPluginKeys() *model.AppError
|
||||
DeleteAllKeysForPlugin(pluginId string) *model.AppError
|
||||
DeleteBotIconImage(botUserId string) *model.AppError
|
||||
DeleteBrandImage() *model.AppError
|
||||
DeleteChannel(channel *model.Channel, userId string) *model.AppError
|
||||
DeleteCommand(commandId string) *model.AppError
|
||||
@@ -159,7 +388,6 @@ type AppIface interface {
|
||||
DeleteEphemeralPost(userId, postId string)
|
||||
DeleteFlaggedPosts(postId string)
|
||||
DeleteGroup(groupID string) (*model.Group, *model.AppError)
|
||||
DeleteGroupConstrainedMemberships() error
|
||||
DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
DeleteIncomingWebhook(hookId string) *model.AppError
|
||||
@@ -169,52 +397,40 @@ type AppIface interface {
|
||||
DeletePost(postId, deleteByID string) (*model.Post, *model.AppError)
|
||||
DeletePostFiles(post *model.Post)
|
||||
DeletePreferences(userId string, preferences model.Preferences) *model.AppError
|
||||
DeletePublicKey(name string) *model.AppError
|
||||
DeleteReactionForPost(reaction *model.Reaction) *model.AppError
|
||||
DeleteScheme(schemeId string) (*model.Scheme, *model.AppError)
|
||||
DeleteToken(token *model.Token) *model.AppError
|
||||
DemoteUserToGuest(user *model.User) *model.AppError
|
||||
DiagnosticId() string
|
||||
DisableAutoResponder(userId string, asAdmin bool) *model.AppError
|
||||
DisablePlugin(id string) *model.AppError
|
||||
DisableUserAccessToken(token *model.UserAccessToken) *model.AppError
|
||||
DoActionRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
|
||||
DoAdvancedPermissionsMigration()
|
||||
DoAppMigrations()
|
||||
DoEmojisPermissionsMigration()
|
||||
DoGuestRolesCreationMigration()
|
||||
DoLocalRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
|
||||
DoLogin(w http.ResponseWriter, r *http.Request, user *model.User, deviceId string) *model.AppError
|
||||
DoPermissionsMigrations() *model.AppError
|
||||
DoPostAction(postId, actionId, userId, selectedOption string) (string, *model.AppError)
|
||||
DoPostActionWithCookie(postId, actionId, userId, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
|
||||
DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError)
|
||||
DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
|
||||
DoubleCheckPassword(user *model.User, password string) *model.AppError
|
||||
DownloadFromURL(downloadURL string) ([]byte, error)
|
||||
Elasticsearch() einterfaces.ElasticsearchInterface
|
||||
EnablePlugin(id string) *model.AppError
|
||||
EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
|
||||
EnsureDiagnosticId()
|
||||
EnvironmentConfig() map[string]interface{}
|
||||
// @openTracingParams args
|
||||
ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
|
||||
ExportPermissions(w io.Writer) error
|
||||
FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
|
||||
FileBackend() (filesstore.FileBackend, *model.AppError)
|
||||
FileExists(path string) (bool, *model.AppError)
|
||||
FileReader(path string) (filesstore.ReadCloseSeeker, *model.AppError)
|
||||
FillInChannelProps(channel *model.Channel) *model.AppError
|
||||
FillInChannelsProps(channelList *model.ChannelList) *model.AppError
|
||||
FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError
|
||||
FilterNonGroupChannelMembers(userIds []string, channel *model.Channel) ([]string, error)
|
||||
FilterNonGroupTeamMembers(userIds []string, team *model.Team) ([]string, error)
|
||||
FindTeamByName(name string) bool
|
||||
GenerateMfaSecret(userId string) (*model.MfaSecret, *model.AppError)
|
||||
GeneratePublicLink(siteURL string, info *model.FileInfo) string
|
||||
GetActivePluginManifests() ([]*model.Manifest, *model.AppError)
|
||||
GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError)
|
||||
GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.AppError)
|
||||
GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
|
||||
GetAllPrivateTeams() ([]*model.Team, *model.AppError)
|
||||
GetAllPrivateTeamsPage(offset int, limit int) ([]*model.Team, *model.AppError)
|
||||
GetAllPrivateTeamsPageWithCount(offset int, limit int) (*model.TeamsWithCount, *model.AppError)
|
||||
@@ -231,16 +447,12 @@ type AppIface interface {
|
||||
GetAuditsPage(userId string, page int, perPage int) (model.Audits, *model.AppError)
|
||||
GetAuthorizationCode(w http.ResponseWriter, r *http.Request, service string, props map[string]string, loginHint string) (string, *model.AppError)
|
||||
GetAuthorizedAppsForUser(userId string, page, perPage int) ([]*model.OAuthApp, *model.AppError)
|
||||
GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
|
||||
GetBotIconImage(botUserId string) ([]byte, *model.AppError)
|
||||
GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
|
||||
GetBrandImage() ([]byte, *model.AppError)
|
||||
GetBulkReactionsForPosts(postIds []string) (map[string][]*model.Reaction, *model.AppError)
|
||||
GetChannel(channelId string) (*model.Channel, *model.AppError)
|
||||
GetChannelByName(channelName, teamId string, includeDeleted bool) (*model.Channel, *model.AppError)
|
||||
GetChannelByNameForTeamName(channelName, teamName string, includeDeleted bool) (*model.Channel, *model.AppError)
|
||||
GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, *model.AppError)
|
||||
GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
|
||||
GetChannelGuestCount(channelId string) (int64, *model.AppError)
|
||||
GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError)
|
||||
GetChannelMemberCount(channelId string) (int64, *model.AppError)
|
||||
@@ -257,13 +469,11 @@ type AppIface interface {
|
||||
GetChannelsForUser(teamId string, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError)
|
||||
GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (*model.ChannelList, *model.AppError)
|
||||
GetClusterId() string
|
||||
GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
|
||||
GetClusterStatus() []*model.ClusterInfo
|
||||
GetCommand(commandId string) (*model.Command, *model.AppError)
|
||||
GetComplianceFile(job *model.Compliance) ([]byte, *model.AppError)
|
||||
GetComplianceReport(reportId string) (*model.Compliance, *model.AppError)
|
||||
GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError)
|
||||
GetConfigFile(name string) ([]byte, error)
|
||||
GetCookieDomain() string
|
||||
GetDataRetentionPolicy() (*model.DataRetentionPolicy, *model.AppError)
|
||||
GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError)
|
||||
@@ -272,8 +482,6 @@ type AppIface interface {
|
||||
GetEmojiByName(emojiName string) (*model.Emoji, *model.AppError)
|
||||
GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)
|
||||
GetEmojiList(page, perPage int, sort string) ([]*model.Emoji, *model.AppError)
|
||||
GetEmojiStaticUrl(emojiName string) (string, *model.AppError)
|
||||
GetEnvironmentConfig() map[string]interface{}
|
||||
GetFile(fileId string) ([]byte, *model.AppError)
|
||||
GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
|
||||
GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
|
||||
@@ -308,10 +516,8 @@ type AppIface interface {
|
||||
GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError)
|
||||
GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError)
|
||||
GetLatestTermsOfService() (*model.TermsOfService, *model.AppError)
|
||||
GetLdapGroup(ldapGroupID string) (*model.Group, *model.AppError)
|
||||
GetLogs(page, perPage int) ([]string, *model.AppError)
|
||||
GetLogsSkipSend(page, perPage int) ([]string, *model.AppError)
|
||||
GetMarketplacePlugins(filter *model.MarketplacePluginFilter) ([]*model.MarketplacePlugin, *model.AppError)
|
||||
GetMessageForNotification(post *model.Post, translateFunc i18n.TranslateFunc) string
|
||||
GetMultipleEmojiByName(names []string) ([]*model.Emoji, *model.AppError)
|
||||
GetNewUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
|
||||
@@ -340,11 +546,7 @@ type AppIface interface {
|
||||
GetPermalinkPost(postId string, userId string) (*model.PostList, *model.AppError)
|
||||
GetPinnedPosts(channelId string) (*model.PostList, *model.AppError)
|
||||
GetPluginKey(pluginId string, key string) ([]byte, *model.AppError)
|
||||
GetPluginPublicKeyFiles() ([]string, *model.AppError)
|
||||
GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
|
||||
GetPluginStatuses() (model.PluginStatuses, *model.AppError)
|
||||
GetPlugins() (*model.PluginsResponse, *model.AppError)
|
||||
GetPluginsEnvironment() *plugin.Environment
|
||||
GetPostAfterTime(channelId string, time int64) (*model.Post, *model.AppError)
|
||||
GetPostIdAfterTime(channelId string, time int64) (string, *model.AppError)
|
||||
GetPostIdBeforeTime(channelId string, time int64) (string, *model.AppError)
|
||||
@@ -364,7 +566,6 @@ type AppIface interface {
|
||||
GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
|
||||
GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, *model.AppError)
|
||||
GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, *model.AppError)
|
||||
GetPublicKey(name string) ([]byte, *model.AppError)
|
||||
GetReactionsForPost(postId string) ([]*model.Reaction, *model.AppError)
|
||||
GetRecentlyActiveUsersForTeam(teamId string) (map[string]*model.User, *model.AppError)
|
||||
GetRecentlyActiveUsersForTeamPage(teamId string, page, perPage int, asAdmin bool, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, *model.AppError)
|
||||
@@ -376,7 +577,6 @@ type AppIface interface {
|
||||
GetSamlMetadataFromIdp(idpMetadataUrl string) (*model.SamlMetadataResponse, *model.AppError)
|
||||
GetSanitizeOptions(asAdmin bool) map[string]bool
|
||||
GetSanitizedClientLicense() map[string]string
|
||||
GetSanitizedConfig() *model.Config
|
||||
GetScheme(id string) (*model.Scheme, *model.AppError)
|
||||
GetSchemeByName(name string) (*model.Scheme, *model.AppError)
|
||||
GetSchemeRolesForChannel(channelId string) (string, string, string, *model.AppError)
|
||||
@@ -395,7 +595,6 @@ type AppIface interface {
|
||||
GetTeam(teamId string) (*model.Team, *model.AppError)
|
||||
GetTeamByInviteId(inviteId string) (*model.Team, *model.AppError)
|
||||
GetTeamByName(name string) (*model.Team, *model.AppError)
|
||||
GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
|
||||
GetTeamIcon(team *model.Team) ([]byte, *model.AppError)
|
||||
GetTeamIdFromQuery(query url.Values) (string, *model.AppError)
|
||||
GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)
|
||||
@@ -410,7 +609,6 @@ type AppIface interface {
|
||||
GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)
|
||||
GetTeamsUnreadForUser(excludeTeamId string, userId string) ([]*model.TeamUnread, *model.AppError)
|
||||
GetTermsOfService(id string) (*model.TermsOfService, *model.AppError)
|
||||
GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
|
||||
GetUser(userId string) (*model.User, *model.AppError)
|
||||
GetUserAccessToken(tokenId string, sanitize bool) (*model.UserAccessToken, *model.AppError)
|
||||
GetUserAccessTokens(page, perPage int) ([]*model.UserAccessToken, *model.AppError)
|
||||
@@ -419,7 +617,6 @@ type AppIface interface {
|
||||
GetUserByEmail(email string) (*model.User, *model.AppError)
|
||||
GetUserByUsername(username string) (*model.User, *model.AppError)
|
||||
GetUserForLogin(id, loginId string) (*model.User, *model.AppError)
|
||||
GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)
|
||||
GetUserTermsOfService(userId string) (*model.UserTermsOfService, *model.AppError)
|
||||
GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)
|
||||
GetUsersByGroupChannelIds(channelIds []string, asAdmin bool) (map[string][]*model.User, *model.AppError)
|
||||
@@ -445,7 +642,6 @@ type AppIface interface {
|
||||
GetUsersWithoutTeamPage(options *model.UserGetOptions, asAdmin bool) ([]*model.User, *model.AppError)
|
||||
GetVerifyEmailToken(token string) (*model.Token, *model.AppError)
|
||||
GetViewUsersRestrictions(userId string) (*model.ViewUsersRestrictions, *model.AppError)
|
||||
GetViewUsersRestrictionsForTeam(userId string, teamId string) ([]string, *model.AppError)
|
||||
HTMLTemplates() *template.Template
|
||||
HTTPService() httpservice.HTTPService
|
||||
Handle404(w http.ResponseWriter, r *http.Request)
|
||||
@@ -470,10 +666,7 @@ type AppIface interface {
|
||||
ImportPermissions(jsonl io.Reader) error
|
||||
InitPlugins(pluginDir, webappPluginDir string)
|
||||
InitPostMetadata()
|
||||
InstallMarketplacePlugin(request *model.InstallMarketplacePluginRequest) (*model.Manifest, *model.AppError)
|
||||
InstallPlugin(pluginFile io.ReadSeeker, replace bool) (*model.Manifest, *model.AppError)
|
||||
InstallPluginFromData(data model.PluginEventData)
|
||||
InstallPluginWithSignature(pluginFile, signature io.ReadSeeker) (*model.Manifest, *model.AppError)
|
||||
InvalidateAllCaches() *model.AppError
|
||||
InvalidateAllCachesSkipSend()
|
||||
InvalidateAllEmailInvites() *model.AppError
|
||||
@@ -492,18 +685,14 @@ type AppIface interface {
|
||||
IsPhase2MigrationCompleted() *model.AppError
|
||||
IsUserAway(lastActivityAt int64) bool
|
||||
IsUserSignUpAllowed() *model.AppError
|
||||
IsUsernameTaken(name string) bool
|
||||
JoinChannel(channel *model.Channel, userId string) *model.AppError
|
||||
JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin bool, userRequestorId string) *model.AppError
|
||||
JoinUserToTeam(team *model.Team, user *model.User, userRequestorId string) *model.AppError
|
||||
Ldap() einterfaces.LdapInterface
|
||||
LeaveChannel(channelId string, userId string) *model.AppError
|
||||
LeaveTeam(team *model.Team, user *model.User, requestorId string) *model.AppError
|
||||
License() *model.License
|
||||
LimitedClientConfig() map[string]string
|
||||
LimitedClientConfigWithComputed() map[string]string
|
||||
ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
|
||||
ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
|
||||
ListDirectory(path string) ([]string, *model.AppError)
|
||||
ListPluginKeys(pluginId string, page, perPage int) ([]string, *model.AppError)
|
||||
ListTeamCommands(teamId string) ([]*model.Command, *model.AppError)
|
||||
@@ -511,13 +700,10 @@ type AppIface interface {
|
||||
Log() *mlog.Logger
|
||||
LoginByOAuth(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)
|
||||
MakePermissionError(permission *model.Permission) *model.AppError
|
||||
MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
|
||||
MarkChannelsAsViewed(channelIds []string, userId string, currentSessionId string) (map[string]int64, *model.AppError)
|
||||
MaxPostSize() int
|
||||
MessageExport() einterfaces.MessageExportInterface
|
||||
Metrics() einterfaces.MetricsInterface
|
||||
MigrateFilenamesToFileInfos(post *model.Post) []*model.FileInfo
|
||||
MoveChannel(team *model.Team, channel *model.Channel, user *model.User, removeDeactivatedMembers bool) *model.AppError
|
||||
MoveCommand(team *model.Team, command *model.Command) *model.AppError
|
||||
MoveFile(oldPath, newPath string) *model.AppError
|
||||
NewClusterDiscoveryService() *ClusterDiscoveryService
|
||||
@@ -528,8 +714,6 @@ type AppIface interface {
|
||||
NotificationsLog() *mlog.Logger
|
||||
OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
|
||||
OriginChecker() func(*http.Request) bool
|
||||
OverrideIconURLIfEmoji(post *model.Post)
|
||||
PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
|
||||
PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)
|
||||
PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)
|
||||
PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)
|
||||
@@ -538,7 +722,6 @@ type AppIface interface {
|
||||
PatchUser(userId string, patch *model.UserPatch, asAdmin bool) (*model.User, *model.AppError)
|
||||
Path() string
|
||||
PermanentDeleteAllUsers() *model.AppError
|
||||
PermanentDeleteBot(botUserId string) *model.AppError
|
||||
PermanentDeleteChannel(channel *model.Channel) *model.AppError
|
||||
PermanentDeleteTeam(team *model.Team) *model.AppError
|
||||
PermanentDeleteTeamId(teamId string) *model.AppError
|
||||
@@ -555,9 +738,7 @@ type AppIface interface {
|
||||
PostWithProxyRemovedFromImageURLs(post *model.Post) *model.Post
|
||||
PreparePostForClient(originalPost *model.Post, isNewPost bool, isEditPost bool) *model.Post
|
||||
PreparePostListForClient(originalList *model.PostList) *model.PostList
|
||||
ProcessSlackAttachments(attachments []*model.SlackAttachment) []*model.SlackAttachment
|
||||
ProcessSlackText(text string) string
|
||||
PromoteGuestToUser(user *model.User, requestorId string) *model.AppError
|
||||
Publish(message *model.WebSocketEvent)
|
||||
PublishSkipClusterSend(message *model.WebSocketEvent)
|
||||
PurgeElasticsearchIndexes() *model.AppError
|
||||
@@ -582,8 +763,6 @@ type AppIface interface {
|
||||
RemoveTeamMemberFromTeam(teamMember *model.TeamMember, requestorId string) *model.AppError
|
||||
RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError
|
||||
RemoveUserFromTeam(teamId string, userId string, requestorId string) *model.AppError
|
||||
RenameChannel(channel *model.Channel, newChannelName string, newDisplayName string) (*model.Channel, *model.AppError)
|
||||
RenameTeam(team *model.Team, newTeamName string, newDisplayName string) (*model.Team, *model.AppError)
|
||||
RequestId() string
|
||||
ResetPasswordFromToken(userSuppliedTokenString, newPassword string) *model.AppError
|
||||
ResetPermissionsSystem() *model.AppError
|
||||
@@ -596,7 +775,6 @@ type AppIface interface {
|
||||
RevokeSession(session *model.Session) *model.AppError
|
||||
RevokeSessionById(sessionId string) *model.AppError
|
||||
RevokeSessionsForDeviceId(userId string, deviceId string, currentSessionId string) *model.AppError
|
||||
RevokeSessionsFromAllUsers() *model.AppError
|
||||
RevokeUserAccessToken(token *model.UserAccessToken) *model.AppError
|
||||
RolesGrantPermission(roleNames []string, permissionId string) bool
|
||||
Saml() einterfaces.SamlInterface
|
||||
@@ -606,13 +784,10 @@ type AppIface interface {
|
||||
SaveAndBroadcastStatus(status *model.Status)
|
||||
SaveBrandImage(imageData *multipart.FileHeader) *model.AppError
|
||||
SaveComplianceReport(job *model.Compliance) (*model.Compliance, *model.AppError)
|
||||
SaveConfig(newCfg *model.Config, sendConfigChangeClusterMessage bool) *model.AppError
|
||||
SaveLicense(licenseBytes []byte) (*model.License, *model.AppError)
|
||||
SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *model.AppError)
|
||||
SaveUserTermsOfService(userId, termsOfServiceId string, accepted bool) *model.AppError
|
||||
SchemesIterator(batchSize int) func() []*model.Scheme
|
||||
SearchAllChannels(term string, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, *model.AppError)
|
||||
SearchAllTeams(searchOpts *model.TeamSearch) ([]*model.Team, int64, *model.AppError)
|
||||
SearchArchivedChannels(teamId string, term string, userId string) (*model.ChannelList, *model.AppError)
|
||||
SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
|
||||
SearchChannelsForUser(userId, teamId, term string) (*model.ChannelList, *model.AppError)
|
||||
@@ -644,23 +819,18 @@ type AppIface interface {
|
||||
SendPasswordResetEmail(email string, token *model.Token, locale, siteURL string) (bool, *model.AppError)
|
||||
SendSignInChangeEmail(email, method, locale, siteURL string) *model.AppError
|
||||
ServeInterPluginRequest(w http.ResponseWriter, r *http.Request, sourcePluginId, destinationPluginId string)
|
||||
ServePluginPublicRequest(w http.ResponseWriter, r *http.Request)
|
||||
ServePluginRequest(w http.ResponseWriter, r *http.Request)
|
||||
ServerBusyStateChanged(sbs *model.ServerBusyState)
|
||||
Session() *model.Session
|
||||
SessionCacheLength() int
|
||||
SessionHasPermissionTo(session model.Session, permission *model.Permission) bool
|
||||
SessionHasPermissionToChannel(session model.Session, channelId string, permission *model.Permission) bool
|
||||
SessionHasPermissionToChannelByPost(session model.Session, postId string, permission *model.Permission) bool
|
||||
SessionHasPermissionToManageBot(session model.Session, botUserId string) *model.AppError
|
||||
SessionHasPermissionToTeam(session model.Session, teamId string, permission *model.Permission) bool
|
||||
SessionHasPermissionToUser(session model.Session, userId string) bool
|
||||
SessionHasPermissionToUserOrBot(session model.Session, userId string) bool
|
||||
SetAcceptLanguage(s string)
|
||||
SetActiveChannel(userId string, channelId string) *model.AppError
|
||||
SetAutoResponderStatus(user *model.User, oldNotifyProps model.StringMap)
|
||||
SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError
|
||||
SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError
|
||||
SetClientLicense(m map[string]string)
|
||||
SetContext(c context.Context)
|
||||
SetDefaultProfileImage(user *model.User) *model.AppError
|
||||
@@ -683,7 +853,6 @@ type AppIface interface {
|
||||
SetSession(s *model.Session)
|
||||
SetStatusAwayIfNeeded(userId string, manual bool)
|
||||
SetStatusDoNotDisturb(userId string)
|
||||
SetStatusLastActivityAt(userId string, activityAt int64)
|
||||
SetStatusOffline(userId string, manual bool)
|
||||
SetStatusOnline(userId string, manual bool)
|
||||
SetStatusOutOfOffice(userId string)
|
||||
@@ -694,7 +863,6 @@ type AppIface interface {
|
||||
SetUserAgent(s string)
|
||||
SetupInviteEmailRateLimiting() error
|
||||
ShutDownPlugins()
|
||||
Shutdown()
|
||||
SlackAddBotUser(teamId string, log *bytes.Buffer) *model.User
|
||||
SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[string][]SlackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User, importerLog *bytes.Buffer) map[string]*model.Channel
|
||||
SlackAddPosts(teamId string, channel *model.Channel, posts []SlackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User)
|
||||
@@ -711,12 +879,8 @@ type AppIface interface {
|
||||
SwitchLdapToEmail(ldapPassword, code, email, newPassword string) (string, *model.AppError)
|
||||
SwitchOAuthToEmail(email, password, requesterId string) (string, *model.AppError)
|
||||
SyncLdap()
|
||||
SyncPlugins() *model.AppError
|
||||
SyncPluginsActiveState()
|
||||
SyncRolesAndMembership(syncableID string, syncableType model.GroupSyncableType)
|
||||
SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError
|
||||
T(translationID string, args ...interface{}) string
|
||||
TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError)
|
||||
TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError)
|
||||
TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError)
|
||||
TestElasticsearch(cfg *model.Config) *model.AppError
|
||||
@@ -730,9 +894,6 @@ type AppIface interface {
|
||||
UnregisterPluginCommand(pluginId, teamId, trigger string)
|
||||
UnregisterPluginCommands(pluginId string)
|
||||
UpdateActive(user *model.User, active bool) (*model.User, *model.AppError)
|
||||
UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
|
||||
UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
|
||||
UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
|
||||
UpdateChannelLastViewedAt(channelIds []string, userId string) *model.AppError
|
||||
UpdateChannelMemberNotifyProps(data map[string]string, channelId string, userId string) (*model.ChannelMember, *model.AppError)
|
||||
UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)
|
||||
@@ -773,18 +934,13 @@ type AppIface interface {
|
||||
UpdateUserRoles(userId string, newRoles string, sendWebSocketEvent bool) (*model.User, *model.AppError)
|
||||
UpdateWebConnUserActivity(session model.Session, activityAt int64)
|
||||
UploadEmojiImage(id string, imageData *multipart.FileHeader) *model.AppError
|
||||
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
|
||||
UploadFileX(channelId, name string, input io.Reader, opts ...func(*UploadFileTask)) (*model.FileInfo, *model.AppError)
|
||||
UploadFiles(teamId string, channelId string, userId string, files []io.ReadCloser, filenames []string, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
|
||||
UploadMultipartFiles(teamId string, channelId string, userId string, fileHeaders []*multipart.FileHeader, clientIds []string, now time.Time) (*model.FileUploadResponse, *model.AppError)
|
||||
UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
UserAgent() string
|
||||
UserCanSeeOtherUser(userId string, otherUserId string) (bool, *model.AppError)
|
||||
UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError)
|
||||
ValidateAndSetLicenseBytes(b []byte)
|
||||
VerifyEmailFromToken(userSuppliedTokenString string) *model.AppError
|
||||
VerifyPlugin(plugin, signature io.ReadSeeker) *model.AppError
|
||||
VerifyUserEmail(userId, email string) *model.AppError
|
||||
ViewChannel(view *model.ChannelView, userId string, currentSessionId string) (map[string]int64, *model.AppError)
|
||||
WaitForChannelMembership(channelId string, userId string)
|
||||
|
||||
@@ -38,6 +38,7 @@ func GetCommandProvider(name string) CommandProvider {
|
||||
return nil
|
||||
}
|
||||
|
||||
// @openTracingParams teamId, skipSlackParsing
|
||||
func (a *App) CreateCommandPost(post *model.Post, teamId string, response *model.CommandResponse, skipSlackParsing bool) (*model.Post, *model.AppError) {
|
||||
if skipSlackParsing {
|
||||
post.Message = response.Text
|
||||
@@ -68,6 +69,7 @@ func (a *App) CreateCommandPost(post *model.Post, teamId string, response *model
|
||||
return post, nil
|
||||
}
|
||||
|
||||
// @openTracingParams teamId
|
||||
// previous ListCommands now ListAutocompleteCommands
|
||||
func (a *App) ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError) {
|
||||
commands := make([]*model.Command, 0, 32)
|
||||
@@ -154,6 +156,7 @@ func (a *App) ListAllCommands(teamId string, T goi18n.TranslateFunc) ([]*model.C
|
||||
return commands, nil
|
||||
}
|
||||
|
||||
// @openTracingParams args
|
||||
func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {
|
||||
parts := strings.Split(args.Command, " ")
|
||||
trigger := parts[0][1:]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// Code generated by "make store-layers"
|
||||
// Code generated by "make app-layers"
|
||||
// DO NOT EDIT
|
||||
|
||||
package app
|
||||
|
||||
247
app/layer_generators/main.go
Обычный файл
247
app/layer_generators/main.go
Обычный файл
@@ -0,0 +1,247 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"go/ast"
|
||||
"go/parser"
|
||||
"go/token"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"golang.org/x/tools/imports"
|
||||
)
|
||||
|
||||
var (
|
||||
reserved = []string{"AcceptLanguage", "AccountMigration", "Cluster", "Compliance", "Context", "DataRetention", "Elasticsearch", "HTTPService", "ImageProxy", "IpAddress", "Ldap", "Log", "MessageExport", "Metrics", "Notification", "NotificationsLog", "Path", "RequestId", "Saml", "Session", "SetIpAddress", "SetRequestId", "SetSession", "SetStore", "SetT", "Srv", "Store", "T", "Timezones", "UserAgent", "SetUserAgent", "SetAcceptLanguage", "SetPath", "SetContext", "SetServer", "GetT"}
|
||||
outputFile string
|
||||
inputFile string
|
||||
outputFileTemplate string
|
||||
)
|
||||
|
||||
const (
|
||||
OPEN_TRACING_PARAMS_MARKER = "@openTracingParams"
|
||||
APP_ERROR_TYPE = "*model.AppError"
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&inputFile, "in", path.Join("..", "app_iface.go"), "App interface file")
|
||||
flag.StringVar(&outputFile, "out", path.Join("..", "opentracing_layer.go"), "Output file")
|
||||
flag.StringVar(&outputFileTemplate, "template", "opentracing_layer.go.tmpl", "Output template file")
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
code, err := generateLayer("OpenTracingAppLayer", outputFileTemplate)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
formattedCode, err := imports.Process(outputFile, code, &imports.Options{Comments: true})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(outputFile, formattedCode, 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
type methodParam struct {
|
||||
Name string
|
||||
Type string
|
||||
}
|
||||
|
||||
type methodData struct {
|
||||
ParamsToTrace map[string]bool
|
||||
Params []methodParam
|
||||
Results []string
|
||||
}
|
||||
|
||||
type storeMetadata struct {
|
||||
Name string
|
||||
Methods map[string]methodData
|
||||
}
|
||||
|
||||
func formatNode(src []byte, node ast.Expr) string {
|
||||
return string(src[node.Pos()-1 : node.End()-1])
|
||||
}
|
||||
|
||||
func extractMethodMetadata(method *ast.Field, src []byte) methodData {
|
||||
params := []methodParam{}
|
||||
paramsToTrace := map[string]bool{}
|
||||
results := []string{}
|
||||
e := method.Type.(*ast.FuncType)
|
||||
if method.Doc != nil {
|
||||
for _, comment := range method.Doc.List {
|
||||
s := comment.Text
|
||||
if idx := strings.Index(s, OPEN_TRACING_PARAMS_MARKER); idx != -1 {
|
||||
for _, p := range strings.Split(s[idx+len(OPEN_TRACING_PARAMS_MARKER):], ",") {
|
||||
paramsToTrace[strings.TrimSpace(p)] = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if e.Params != nil {
|
||||
for _, param := range e.Params.List {
|
||||
for _, paramName := range param.Names {
|
||||
paramType := (formatNode(src, param.Type))
|
||||
params = append(params, methodParam{Name: paramName.Name, Type: paramType})
|
||||
}
|
||||
}
|
||||
}
|
||||
if e.Results != nil {
|
||||
for _, result := range e.Results.List {
|
||||
results = append(results, formatNode(src, result.Type))
|
||||
}
|
||||
}
|
||||
for paramName := range paramsToTrace {
|
||||
found := false
|
||||
for _, param := range params {
|
||||
if param.Name == paramName {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
log.Fatalf("Unable to find a parameter called '%s' (method '%s') that is mentioned in the '%s' comment. Maybe it was renamed?", paramName, method.Names[0].Name, OPEN_TRACING_PARAMS_MARKER)
|
||||
}
|
||||
}
|
||||
return methodData{Params: params, Results: results, ParamsToTrace: paramsToTrace}
|
||||
}
|
||||
|
||||
func extractStoreMetadata() (*storeMetadata, error) {
|
||||
// Create the AST by parsing src.
|
||||
fset := token.NewFileSet() // positions are relative to fset
|
||||
|
||||
file, err := os.Open(inputFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to open %s file: %w", inputFile, err)
|
||||
}
|
||||
src, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer file.Close()
|
||||
f, err := parser.ParseFile(fset, "../app_iface.go", src, parser.AllErrors|parser.ParseComments)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
metadata := storeMetadata{Methods: map[string]methodData{}}
|
||||
|
||||
ast.Inspect(f, func(n ast.Node) bool {
|
||||
switch x := n.(type) {
|
||||
case *ast.TypeSpec:
|
||||
if x.Name.Name == "AppIface" {
|
||||
for _, method := range x.Type.(*ast.InterfaceType).Methods.List {
|
||||
methodName := method.Names[0].Name
|
||||
found := false
|
||||
for _, reservedMethod := range reserved {
|
||||
if methodName == reservedMethod {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if found {
|
||||
continue
|
||||
}
|
||||
metadata.Methods[methodName] = extractMethodMetadata(method, src)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
return &metadata, err
|
||||
}
|
||||
|
||||
func generateLayer(name, templateFile string) ([]byte, error) {
|
||||
out := bytes.NewBufferString("")
|
||||
metadata, err := extractStoreMetadata()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
metadata.Name = name
|
||||
|
||||
myFuncs := template.FuncMap{
|
||||
"joinResults": func(results []string) string {
|
||||
return strings.Join(results, ", ")
|
||||
},
|
||||
"joinResultsForSignature": func(results []string) string {
|
||||
switch len(results) {
|
||||
case 0:
|
||||
return ""
|
||||
case 1:
|
||||
return strings.Join(results, ", ")
|
||||
}
|
||||
return fmt.Sprintf("(%s)", strings.Join(results, ", "))
|
||||
},
|
||||
"genResultsVars": func(results []string) string {
|
||||
vars := make([]string, 0, len(results))
|
||||
for i := range results {
|
||||
vars = append(vars, fmt.Sprintf("resultVar%d", i))
|
||||
}
|
||||
return strings.Join(vars, ", ")
|
||||
},
|
||||
"errorToBoolean": func(results []string) string {
|
||||
for i, typeName := range results {
|
||||
if typeName == APP_ERROR_TYPE {
|
||||
return fmt.Sprintf("resultVar%d == nil", i)
|
||||
}
|
||||
}
|
||||
return "true"
|
||||
},
|
||||
"errorPresent": func(results []string) bool {
|
||||
for _, typeName := range results {
|
||||
if typeName == "*model.AppError" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
"errorVar": func(results []string) string {
|
||||
for i, typeName := range results {
|
||||
if typeName == "*model.AppError" {
|
||||
return fmt.Sprintf("resultVar%d", i)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
},
|
||||
"joinParams": func(params []methodParam) string {
|
||||
paramsNames := []string{}
|
||||
for _, param := range params {
|
||||
s := param.Name
|
||||
if strings.HasPrefix(param.Type, "...") {
|
||||
s += "..."
|
||||
}
|
||||
paramsNames = append(paramsNames, s)
|
||||
}
|
||||
return strings.Join(paramsNames, ", ")
|
||||
},
|
||||
"joinParamsWithType": func(params []methodParam) string {
|
||||
paramsWithType := []string{}
|
||||
for _, param := range params {
|
||||
paramsWithType = append(paramsWithType, fmt.Sprintf("%s %s", param.Name, param.Type))
|
||||
}
|
||||
return strings.Join(paramsWithType, ", ")
|
||||
},
|
||||
}
|
||||
|
||||
t := template.Must(template.New("opentracing_layer.go.tmpl").Funcs(myFuncs).ParseFiles(templateFile))
|
||||
err = t.Execute(out, metadata)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out.Bytes(), nil
|
||||
}
|
||||
218
app/layer_generators/opentracing_layer.go.tmpl
Обычный файл
218
app/layer_generators/opentracing_layer.go.tmpl
Обычный файл
@@ -0,0 +1,218 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// Code generated by "make app-layers"
|
||||
// DO NOT EDIT
|
||||
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
spanlog "github.com/opentracing/opentracing-go/log"
|
||||
)
|
||||
|
||||
type {{.Name}} struct {
|
||||
app AppIface
|
||||
|
||||
srv *Server
|
||||
|
||||
log *mlog.Logger
|
||||
notificationsLog *mlog.Logger
|
||||
|
||||
t goi18n.TranslateFunc
|
||||
session model.Session
|
||||
requestId string
|
||||
ipAddress string
|
||||
path string
|
||||
userAgent string
|
||||
acceptLanguage string
|
||||
|
||||
accountMigration einterfaces.AccountMigrationInterface
|
||||
cluster einterfaces.ClusterInterface
|
||||
compliance einterfaces.ComplianceInterface
|
||||
dataRetention einterfaces.DataRetentionInterface
|
||||
elasticsearch einterfaces.ElasticsearchInterface
|
||||
ldap einterfaces.LdapInterface
|
||||
messageExport einterfaces.MessageExportInterface
|
||||
metrics einterfaces.MetricsInterface
|
||||
notification einterfaces.NotificationInterface
|
||||
saml einterfaces.SamlInterface
|
||||
|
||||
httpService httpservice.HTTPService
|
||||
imageProxy *imageproxy.ImageProxy
|
||||
timezones *timezones.Timezones
|
||||
|
||||
context context.Context
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
{{range $index, $element := .Methods}}
|
||||
func (a *{{$.Name}}) {{$index}}({{$element.Params | joinParamsWithType}}) {{$element.Results | joinResultsForSignature}} {
|
||||
origCtx := a.ctx
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.{{$index}}")
|
||||
|
||||
a.ctx = newCtx
|
||||
a.app.Srv().Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
a.app.Srv().Store.SetContext(origCtx)
|
||||
a.ctx = origCtx
|
||||
}()
|
||||
{{range $paramIdx, $param := $element.Params}}
|
||||
{{if index $element.ParamsToTrace $param.Name}}
|
||||
span.SetTag("{{$param.Name}}", {{$param.Name}})
|
||||
{{end}}
|
||||
{{end}}
|
||||
defer span.Finish()
|
||||
{{- if $element.Results | len | eq 0}}
|
||||
a.app.{{$index}}({{$element.Params | joinParams}})
|
||||
{{else}}
|
||||
{{$element.Results | genResultsVars}} := a.app.{{$index}}({{$element.Params | joinParams}})
|
||||
{{if $element.Results | errorPresent}}
|
||||
if {{$element.Results | errorVar}} != nil {
|
||||
span.LogFields(spanlog.Error({{$element.Results | errorVar}}))
|
||||
ext.Error.Set(span, true)
|
||||
}
|
||||
{{end}}
|
||||
return {{$element.Results | genResultsVars -}}
|
||||
{{end}}}
|
||||
{{end}}
|
||||
|
||||
func NewOpenTracingAppLayer(childApp AppIface, ctx context.Context) *{{.Name}} {
|
||||
newApp := {{.Name}}{
|
||||
app: childApp,
|
||||
ctx: ctx,
|
||||
}
|
||||
|
||||
newApp.srv = childApp.Srv()
|
||||
newApp.log = childApp.Log()
|
||||
newApp.notificationsLog = childApp.NotificationsLog()
|
||||
newApp.t = childApp.GetT()
|
||||
if childApp.Session() != nil {
|
||||
newApp.session = *childApp.Session()
|
||||
}
|
||||
newApp.requestId = childApp.RequestId()
|
||||
newApp.ipAddress = childApp.IpAddress()
|
||||
newApp.path = childApp.Path()
|
||||
newApp.userAgent = childApp.UserAgent()
|
||||
newApp.acceptLanguage = childApp.AcceptLanguage()
|
||||
newApp.accountMigration = childApp.AccountMigration()
|
||||
newApp.cluster = childApp.Cluster()
|
||||
newApp.compliance = childApp.Compliance()
|
||||
newApp.dataRetention = childApp.DataRetention()
|
||||
newApp.elasticsearch = childApp.Elasticsearch()
|
||||
newApp.ldap = childApp.Ldap()
|
||||
newApp.messageExport = childApp.MessageExport()
|
||||
newApp.metrics = childApp.Metrics()
|
||||
newApp.notification = childApp.Notification()
|
||||
newApp.saml = childApp.Saml()
|
||||
newApp.httpService = childApp.HTTPService()
|
||||
newApp.imageProxy = childApp.ImageProxy()
|
||||
newApp.timezones = childApp.Timezones()
|
||||
newApp.context = childApp.Context()
|
||||
|
||||
return &newApp
|
||||
}
|
||||
|
||||
|
||||
func (a *{{.Name}}) Srv() *Server {
|
||||
return a.srv
|
||||
}
|
||||
func (a *{{.Name}}) Log() *mlog.Logger {
|
||||
return a.log
|
||||
}
|
||||
func (a *{{.Name}}) NotificationsLog() *mlog.Logger {
|
||||
return a.notificationsLog
|
||||
}
|
||||
func (a *{{.Name}}) T(translationID string, args ...interface{}) string {
|
||||
return a.t(translationID, args...)
|
||||
}
|
||||
func (a *{{.Name}}) Session() *model.Session {
|
||||
return &a.session
|
||||
}
|
||||
func (a *{{.Name}}) RequestId() string {
|
||||
return a.requestId
|
||||
}
|
||||
func (a *{{.Name}}) IpAddress() string {
|
||||
return a.ipAddress
|
||||
}
|
||||
func (a *{{.Name}}) Path() string {
|
||||
return a.path
|
||||
}
|
||||
func (a *{{.Name}}) UserAgent() string {
|
||||
return a.userAgent
|
||||
}
|
||||
func (a *{{.Name}}) AcceptLanguage() string {
|
||||
return a.acceptLanguage
|
||||
}
|
||||
func (a *{{.Name}}) AccountMigration() einterfaces.AccountMigrationInterface {
|
||||
return a.accountMigration
|
||||
}
|
||||
func (a *{{.Name}}) Cluster() einterfaces.ClusterInterface {
|
||||
return a.cluster
|
||||
}
|
||||
func (a *{{.Name}}) Compliance() einterfaces.ComplianceInterface {
|
||||
return a.compliance
|
||||
}
|
||||
func (a *{{.Name}}) DataRetention() einterfaces.DataRetentionInterface {
|
||||
return a.dataRetention
|
||||
}
|
||||
func (a *{{.Name}}) Elasticsearch() einterfaces.ElasticsearchInterface {
|
||||
return a.elasticsearch
|
||||
}
|
||||
func (a *{{.Name}}) Ldap() einterfaces.LdapInterface {
|
||||
return a.ldap
|
||||
}
|
||||
func (a *{{.Name}}) MessageExport() einterfaces.MessageExportInterface {
|
||||
return a.messageExport
|
||||
}
|
||||
func (a *{{.Name}}) Metrics() einterfaces.MetricsInterface {
|
||||
return a.metrics
|
||||
}
|
||||
func (a *{{.Name}}) Notification() einterfaces.NotificationInterface {
|
||||
return a.notification
|
||||
}
|
||||
func (a *{{.Name}}) Saml() einterfaces.SamlInterface {
|
||||
return a.saml
|
||||
}
|
||||
func (a *{{.Name}}) HTTPService() httpservice.HTTPService {
|
||||
return a.httpService
|
||||
}
|
||||
func (a *{{.Name}}) ImageProxy() *imageproxy.ImageProxy {
|
||||
return a.imageProxy
|
||||
}
|
||||
func (a *{{.Name}}) Timezones() *timezones.Timezones {
|
||||
return a.timezones
|
||||
}
|
||||
func (a *{{.Name}}) Context() context.Context {
|
||||
return a.context
|
||||
}
|
||||
func (a *{{.Name}}) SetSession(sess *model.Session) {
|
||||
a.session = *sess
|
||||
}
|
||||
func (a *{{.Name}}) SetT(t goi18n.TranslateFunc){
|
||||
a.t = t
|
||||
}
|
||||
func (a *{{.Name}}) SetRequestId(str string){
|
||||
a.requestId = str
|
||||
}
|
||||
func (a *{{.Name}}) SetIpAddress(str string){
|
||||
a.ipAddress = str
|
||||
}
|
||||
func (a *{{.Name}}) SetUserAgent(str string){
|
||||
a.userAgent = str
|
||||
}
|
||||
func (a *{{.Name}}) SetAcceptLanguage(str string) {
|
||||
a.acceptLanguage = str
|
||||
}
|
||||
func (a *{{.Name}}) SetPath(str string){
|
||||
a.path = str
|
||||
}
|
||||
func (a *{{.Name}}) SetContext(c context.Context){
|
||||
a.context = c
|
||||
}
|
||||
func (a *{{.Name}}) SetServer(srv *Server) {
|
||||
a.srv = srv
|
||||
}
|
||||
func (a *{{.Name}}) GetT() goi18n.TranslateFunc {
|
||||
return a.t
|
||||
}
|
||||
14988
app/opentracing_layer.go
Обычный файл
14988
app/opentracing_layer.go
Обычный файл
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/services/httpservice"
|
||||
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
|
||||
"github.com/mattermost/mattermost-server/v5/services/timezones"
|
||||
"github.com/mattermost/mattermost-server/v5/services/tracing"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
"github.com/mattermost/mattermost-server/v5/utils"
|
||||
)
|
||||
@@ -135,6 +136,8 @@ type Server struct {
|
||||
Saml einterfaces.SamlInterface
|
||||
|
||||
CacheProvider cache.Provider
|
||||
|
||||
tracer *tracing.Tracer
|
||||
}
|
||||
|
||||
func NewServer(options ...Option) (*Server, error) {
|
||||
@@ -178,6 +181,14 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
// Use this app logger as the global logger (eventually remove all instances of global logging)
|
||||
mlog.InitGlobalLogger(s.Log)
|
||||
|
||||
if *s.Config().ServiceSettings.EnableOpenTracing {
|
||||
tracer, err := tracing.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.tracer = tracer
|
||||
}
|
||||
|
||||
s.logListenerId = s.AddConfigListener(func(_, after *model.Config) {
|
||||
s.Log.ChangeLevels(utils.MloggerConfigFromLoggerConfig(&after.LogSettings, utils.GetLogFileLocation))
|
||||
|
||||
@@ -374,6 +385,12 @@ func (s *Server) Shutdown() error {
|
||||
|
||||
s.RunOldAppShutdown()
|
||||
|
||||
if s.tracer != nil {
|
||||
if err := s.tracer.Close(); err != nil {
|
||||
mlog.Error("Unable to cleanly shutdown opentracing client", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
err := s.shutdownDiagnostics()
|
||||
if err != nil {
|
||||
mlog.Error("Unable to cleanly shutdown diagnostic client", mlog.Err(err))
|
||||
|
||||
Ссылка в новой задаче
Block a user