Documentation
¶
Index ¶
- Constants
- func Encrypt(raw string) string
- type API
- type AlertMetricsData
- type AuthDataGroup
- type AuthPermission
- type CustomServiceTopology
- type DaoDataGroupNew
- type DaoDataScope
- type DatasourceGroup
- type FeatureMapping
- type I18nTranslation
- type InsertPage
- type LogTableInfo
- type MenuItem
- type Operator
- type OtherLogTable
- type Repo
- type Router
- type RouterInsertPage
- type ServiceNameRule
- type ServiceNameRuleCondition
- type Threshold
Constants ¶
View Source
const AnonymousUsername = "anonymous"
View Source
const ERROR_RATE = 5.0
View Source
const GLOBAL = "global"
User-configured threshold table
View Source
const LATENCY = 5.0
View Source
const LOG = 5.0
View Source
const TPS = 5.0
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct { ID int `gorm:"primary_key;auto_increment"` Path string `gorm:"column:path;type:varchar(255);index:idx_path_method,unique" mapstructure:"path"` Method string `gorm:"column:method;type:varchar(10);index:idx_path_method,unique" mapstructure:"method"` Enabled bool `gorm:"column:enabled;default:true"` }
type AlertMetricsData ¶
type AlertMetricsData struct { Id int `json:"-" gorm:"primaryKey;autoIncrement"` Name string `json:"name" gorm:"not null;type:varchar(255);column:name"` NameEN string `json:"-" gorm:"type:varchar(255);column:name_en"` PQL string `json:"pql" gorm:"not null;type:varchar(5000);column:pql"` Unit string `json:"unit" gorm:"not null;type:varchar(255);column:unit"` Group string `json:"group" gorm:"not null;type:varchar(255);column:group"` }
AlertMetricsData provide PQL corresponding to user selectable metrics
func (*AlertMetricsData) TableName ¶
func (a *AlertMetricsData) TableName() string
type AuthDataGroup ¶
type AuthDataGroup struct { ID int64 `gorm:"column:id;primary_key;auto_increment" json:"-"` SubjectID int64 `gorm:"column:subject_id;index:sub_type_id_idx,priority:1" json:"-"` SubjectType string `gorm:"column:subject_type;index:sub_type_id_idx,priority:2" json:"-"` // user or team GroupID int64 `gorm:"column:data_group_id;index:group_id_idx" json:"-"` Type string `gorm:"column:type;default:view" json:"type"` // view, edit User *profile.User `gorm:"-" json:"user,omitempty"` Team *profile.Team `gorm:"-" json:"team,omitempty"` }
AuthDataGroup Records the permissions that users or teams have on specific data groups.
func (AuthDataGroup) MarshalJSON ¶
func (adg AuthDataGroup) MarshalJSON() ([]byte, error)
func (AuthDataGroup) TableName ¶
func (AuthDataGroup) TableName() string
type AuthPermission ¶
type AuthPermission struct { ID int `gorm:"primary_key;auto_increment" json:"id"` Type string `gorm:"column:type;index:idx_sub_id_type" json:"type"` // feature SubjectID int64 `gorm:"column:subject_id;index:idx_sub_id_type" json:"subjectId"` // Role ID, user ID or team ID SubjectType string `gorm:"column:subject_type;type:varchar(10)" json:"subjectType"` // role, user, team PermissionID int `gorm:"column:permission_id" json:"permissionId"` }
AuthPermission records which features are authorised to which subjects.
func (AuthPermission) TableName ¶
func (AuthPermission) TableName() string
type CustomServiceTopology ¶
type CustomServiceTopology struct { ID int `gorm:"column:id;primary_key;auto_increment" json:"id"` ClusterId string `gorm:"column:cluster_id;type:varchar(100)" json:"clusterId"` LeftNode string `gorm:"column:left_node;type:varchar(200)" json:"leftNode"` LeftType string `gorm:"column:left_type;type:varchar(20)" json:"leftType"` RightNode string `gorm:"column:right_node;type:varchar(200)" json:"rightNode"` RightType string `gorm:"column:right_type;type:varchar(20)" json:"rightType"` StartTime int64 `gorm:"column:start_time" json:"startTime"` ExpireTime int64 `gorm:"column:expire_time" json:"expireTime"` }
func (CustomServiceTopology) TableName ¶
func (CustomServiceTopology) TableName() string
type DaoDataGroupNew ¶
type DaoDataGroupNew interface { LoadDataGroupTree(ctx core.Context) (*datagroup.DataGroupTreeNode, error) GetDataGroupIDsByUserId(ctx core.Context, userID int64) ([]int64, error) InitRootGroup(ctx core.Context) error }
var DaoDataGroup DaoDataGroupNew
type DaoDataScope ¶
type DaoDataScope interface { SaveScopes(ctx core.Context, scopes []datagroup.DataScope) error LoadScopes(ctx core.Context) (*datagroup.DataScopeTree, error) DeleteScopes(ctx core.Context, scopesIDs []string) error GetScopesByScopeIDs(ctx core.Context, scopeIDs []string) ([]datagroup.DataScope, error) GetScopeIDsOptionByGroupID(ctx core.Context, groupID int64) (options []string, err error) GetScopeIDsSelectedByGroupID(ctx core.Context, groupID int64) (selected []string, err error) GetScopeIDsSelectedByPermGroupIDs(ctx core.Context, permGroupIDs []int64) ([]string, error) UpdateGroup2Scope(ctx core.Context, groupID int64, scopeIDs []string) error DeleteGroup2Scope(ctx core.Context, groupID int64) error DeleteGroup2ScopeByGroupIDScopeIDs(ctx core.Context, groupID int64, scopeIDs []string) error DeleteG2SByGroupsIDsAndScopeIDs(ctx core.Context, groupIDs []int64, scopeIDs []string) error GetScopeIDsByGroupIDAndCat(ctx core.Context, groupID int64, category string) ([]string, error) GetScopesByGroupIDAndCat(ctx core.Context, groupID int64, category string) ([]datagroup.DataScope, error) CheckScopePermission(ctx core.Context, permGroupIDs []int64, cluster, namespace, service string) (bool, error) PeekScopeIDWithoutPerm(ctx core.Context, permGroupIDs []int64, scopeIDs []string) (noPerm []string, err error) }
var DaoDataScopeImpl DaoDataScope = nil
type DatasourceGroup ¶
type DatasourceGroup struct { GroupID int64 `gorm:"column:group_id;primary_key" json:"-"` Datasource string `gorm:"column:datasource;primary_key" json:"datasource"` Type string `gorm:"column:type" json:"type"` // service or namespace Category string `gorm:"column:category" json:"category"` // apm or normal ClusterID string `gorm:"column:cluster_id" json:"clusterId"` }
DatasourceGroup is a mapping table of Datasource and DataGroup.
func (*DatasourceGroup) TableName ¶
func (dsg *DatasourceGroup) TableName() string
type FeatureMapping ¶
type FeatureMapping struct { ID int `gorm:"column:id;primary_key"` FeatureID int `gorm:"column:feature_id;index:feature_mapped_idx"` MappedID int `gorm:"column:mapped_id;index:feature_mapped_idx"` MappedType string `gorm:"column:mapped_type"` // menu router api }
FeatureMapping maps feature to menu item, router and api.
func (*FeatureMapping) TableName ¶
func (t *FeatureMapping) TableName() string
type I18nTranslation ¶
type I18nTranslation struct { ID int `gorm:"column:id;primary_key;auto_increment" json:"-"` Language string `gorm:"column:language;type:varchar(20)" json:"-" mapstructure:"language"` // en, zh, etc. Translation string `gorm:"column:translation;type:varchar(50)" json:"translation" mapstructure:"translation"` FieldName string `gorm:"column:field_name;type:varchar(20)" json:"field_name" mapstructure:"field_name"` // which field is translated EntityID int `gorm:"column:entity_id" json:"-"` EntityType string `gorm:"column:entity_type;type:varchar(20)" json:"-" mapstructure:"entity_type"` // menu_item or feature }
func (I18nTranslation) TableName ¶
func (I18nTranslation) TableName() string
type InsertPage ¶
type InsertPage struct { PageID int `gorm:"column:page_id;primary_key;auto_increment" json:"pageId"` Url string `gorm:"column:url;type:varchar(150)" json:"url"` Type string `gorm:"column:type;type:varchar(20)" json:"type"` // For now it's grafana or jaeger. Custom bool `gorm:"column:custom" json:"-"` }
InsertPage saves embedded interface.
func (*InsertPage) TableName ¶
func (t *InsertPage) TableName() string
type LogTableInfo ¶
type LogTableInfo struct { ID uint `gorm:"primaryKey;autoIncrement"` DataBase string `gorm:"type:varchar(255);column:database"` Table string `gorm:"type:varchar(255);column:tablename"` Cluster string `gorm:"type:varchar(255)"` Fields string `gorm:"type:varchar(5000)"` // log field type ParseName string `gorm:"type:varchar(255);column:parsename"` RouteRule string `gorm:"type:varchar(1000);column:routerule"` // routing rule ParseRule string `gorm:"type:varchar(5000);column:parserule"` // parsing rules ParseInfo string `gorm:"type:varchar(255);column:parseinfo"` Service string `gorm:"type:varchar(255)"` IsStructured bool `gorm:"type:bool;column:structured"` }
func (LogTableInfo) TableName ¶
func (LogTableInfo) TableName() string
type MenuItem ¶
type MenuItem struct { ItemID int `gorm:"column:item_id;primary_key" json:"itemId"` Key string `gorm:"column:key;type:varchar(20);uniqueIndex" json:"key"` Label string `gorm:"-" json:"label"` // AKA item name. Icon string `gorm:"column:icon;type:varchar(150)" json:"icon"` ParentID *int `gorm:"column:parent_id" json:"-"` Abbreviation string `gorm:"-" json:"abbreviation,omitempty"` RouterID int `gorm:"column:router_id" json:"-"` Order int `gorm:"column:sort_order;index:sort_order_idx" json:"-"` // The order of a menu item. Children []MenuItem `gorm:"-" json:"children,omitempty" swaggerignore:"true"` Router *Router `gorm:"-" json:"router,omitempty"` // Frontend router. }
type OtherLogTable ¶
type OtherLogTable struct { ID uint `gorm:"primaryKey;autoIncrement"` DataBase string `gorm:"type:varchar(255);column:database"` Table string `gorm:"type:varchar(255);column:tablename"` Cluster string `gorm:"type:varchar(255)"` TimeField string `gorm:"type:varchar(255);column:timefield"` LogField string `gorm:"type:varchar(255);column:logfield"` Instance string `gorm:"type:varchar(255)"` }
func (OtherLogTable) TableName ¶
func (OtherLogTable) TableName() string
type Repo ¶
type Repo interface { CreateOrUpdateThreshold(ctx core.Context, model *Threshold) error GetOrCreateThreshold(ctx core.Context, serviceName string, endPoint string, level string) (Threshold, error) DeleteThreshold(ctx core.Context, serviceName string, endPoint string) error OperateLogTableInfo(ctx core.Context, model *LogTableInfo, op Operator) error GetAllLogTable(ctx core.Context) ([]LogTableInfo, error) UpdateLogParseRule(ctx core.Context, model *LogTableInfo) error GetAllOtherLogTable(ctx core.Context) ([]OtherLogTable, error) OperatorOtherLogTable(ctx core.Context, model *OtherLogTable, op Operator) error CreateDingTalkReceiver(ctx core.Context, dingTalkConfig *amconfig.DingTalkConfig) error // GetDingTalkReceiver get the webhook URL secret corresponding to the uuid. GetDingTalkReceiver(ctx core.Context, uuid string) (amconfig.DingTalkConfig, error) GetDingTalkReceiverByAlertName(ctx core.Context, configFile string, alertName string, page, pageSize int) ([]*amconfig.DingTalkConfig, int64, error) UpdateDingTalkReceiver(ctx core.Context, dingTalkConfig *amconfig.DingTalkConfig, oldName string) error DeleteDingTalkReceiver(ctx core.Context, configFile, alertName string) error ListQuickAlertRuleMetric(ctx core.Context) ([]AlertMetricsData, error) Login(ctx core.Context, username, password string) (*profile.User, error) CreateUser(ctx core.Context, user *profile.User) error UpdateUserPhone(ctx core.Context, userID int64, phone string) error UpdateUserEmail(ctx core.Context, userID int64, email string) error UpdateUserPassword(ctx core.Context, userID int64, oldPassword, newPassword string) error UpdateUserInfo(ctx core.Context, userID int64, phone string, email string, corporation string) error GetUserInfo(ctx core.Context, userID int64) (profile.User, error) GetAnonymousUser(ctx core.Context) (profile.User, error) GetUserList(ctx core.Context, req *request.GetUserListRequest) ([]profile.User, int64, error) RemoveUser(ctx core.Context, userID int64) error RestPassword(ctx core.Context, userID int64, newPassword string) error UserExists(ctx core.Context, userID ...int64) (bool, error) GetUserRole(ctx core.Context, userID int64) ([]profile.UserRole, error) GetUsersRole(ctx core.Context, userIDs []int64) ([]profile.UserRole, error) GetRoles(ctx core.Context, filter model.RoleFilter) ([]profile.Role, error) GetFeature(ctx core.Context, featureIDs []int) ([]profile.Feature, error) GetFeatureByName(ctx core.Context, name string) (int, error) GrantRoleWithUser(ctx core.Context, userID int64, roleIDs []int) error GrantRoleWithRole(ctx core.Context, roleID int, userIDs []int64) error RevokeRole(ctx core.Context, userID int64, roleIDs []int) error RevokeRoleWithRole(ctx core.Context, roleID int) error GetSubjectPermission(ctx core.Context, subID int64, subType string, typ string) ([]int, error) GetSubjectsPermission(ctx core.Context, subIDs []int64, subType string, typ string) ([]AuthPermission, error) RoleExists(ctx core.Context, roleID int) (bool, error) GrantPermission(ctx core.Context, subID int64, subType string, typ string, permissionIDs []int) error RevokePermission(ctx core.Context, subID int64, subType string, typ string, permissionIDs []int) error GetAddAndDeletePermissions(ctx core.Context, subID int64, subType, typ string, permList []int) (toAdd []int, toDelete []int, err error) RoleGrantedToUser(ctx core.Context, userID int64, roleID int) (bool, error) RoleGranted(ctx core.Context, roleID int) (bool, error) FillItemRouter(ctx core.Context, items *[]MenuItem) error GetItemsRouter(ctx core.Context, itemIDs []int) ([]Router, error) GetRouterByIDs(ctx core.Context, routerIDs []int) ([]Router, error) GetRouterInsertedPage(ctx core.Context, routers []*Router, language string) error GetFeatureTans(ctx core.Context, features *[]profile.Feature, language string) error GetMenuItemTans(ctx core.Context, menuItems *[]MenuItem, language string) error CreateDataGroup(ctx core.Context, group *datagroup.DataGroup) error DeleteDataGroup(ctx core.Context, groupID int64) error CreateDatasourceGroup(ctx core.Context, datasource []model.Datasource, dataGroupID int64) error DeleteDSGroup(ctx core.Context, groupID int64) error DataGroupExist(ctx core.Context, filter model.DataGroupFilter) (bool, error) UpdateDataGroup(ctx core.Context, groupID int64, groupName string, description string) error GetDataGroup(ctx core.Context, filter model.DataGroupFilter) ([]datagroup.DataGroup, int64, error) GetDataGroupByGroupIDOrUserID(ctx core.Context, groupID int64, userID int64, category string) ([]datagroup.DataGroup, error) GetDataGroupByGroupID(ctx core.Context, groupID int64, category string) ([]datagroup.DataGroup, error) GetDataGroupByUserID(ctx core.Context, userID int64) ([]datagroup.DataGroup, error) RetrieveDataFromGroup(ctx core.Context, groupID int64, datasource []string) error GetGroupDatasource(ctx core.Context, groupID ...int64) ([]DatasourceGroup, error) GetFeatureMappingByFeature(ctx core.Context, featureIDs []int, mappedType string) ([]FeatureMapping, error) GetFeatureMappingByMapped(ctx core.Context, mappedID int, mappedType string) (FeatureMapping, error) GetMenuItems(ctx core.Context) ([]MenuItem, error) GetTeamList(ctx core.Context, req *request.GetTeamRequest) ([]profile.Team, int64, error) DeleteTeam(ctx core.Context, teamID int64) error CreateTeam(ctx core.Context, team profile.Team) error TeamExist(ctx core.Context, filter model.TeamFilter) (bool, error) GetTeam(ctx core.Context, teamID int64) (profile.Team, error) UpdateTeam(ctx core.Context, team profile.Team) error InviteUserToTeam(ctx core.Context, teamID int64, userIDs []int64) error AssignUserToTeam(ctx core.Context, userID int64, teamIDs []int64) error GetUserTeams(ctx core.Context, userID int64) ([]int64, error) GetTeamUsers(ctx core.Context, teamID int64) ([]int64, error) GetTeamUserList(ctx core.Context, teamID int64) ([]profile.User, error) RemoveFromTeamByUser(ctx core.Context, userID int64, teamIDs []int64) error RemoveFromTeamByTeam(ctx core.Context, teamID int64, userIDs []int64) error DeleteAllUserTeam(ctx core.Context, id int64, by string) error GetAssignedTeam(ctx core.Context, userID int64) ([]profile.Team, error) CreateRole(ctx core.Context, role *profile.Role) error DeleteRole(ctx core.Context, roleID int) error UpdateRole(ctx core.Context, roleID int, roleName, description string) error GetAuthDataGroupBySub(ctx core.Context, subjectID int64, subjectType string) ([]AuthDataGroup, error) GetGroupAuthDataGroupByGroup(ctx core.Context, groupID int64, subjectType string) ([]AuthDataGroup, error) AssignDataGroup(ctx core.Context, authDataGroups []AuthDataGroup) error RevokeDataGroupByGroup(ctx core.Context, dataGroupIDs []int64, subjectID int64) error RevokeDataGroupBySub(ctx core.Context, subjectIDs []int64, groupID int64) error GetSubjectDataGroupList(ctx core.Context, subjectID int64, subjectType string) ([]datagroup.DataGroup, error) GetModifyAndDeleteDataGroup(ctx core.Context, subjectID int64, subjectType string, dgPermissions []request.DataGroupPermission) (toModify []AuthDataGroup, toDelete []int64, err error) DeleteAuthDataGroup(ctx core.Context, subjectID int64, subjectType string) error GetDataGroupUsers(ctx core.Context, groupID int64) ([]AuthDataGroup, error) GetDataGroupTeams(ctx core.Context, groupID int64) ([]AuthDataGroup, error) CheckGroupPermission(ctx core.Context, userID, groupID int64, typ string) (bool, error) CheckScopePermission(ctx core.Context, permGroupIDs []int64, cluster, namespace, service string) (bool, error) DropDataGroupDatasourceConstraint(ctx core.Context) error GetAPIByPath(ctx core.Context, path string, method string) (*API, error) // GetContextDB Gets transaction form ctx. GetContextDB(ctx core.Context) *gorm.DB // Transaction Starts a transaction and automatically commit and rollback. Transaction(ctx core.Context, funcs ...func(txCtx core.Context) error) error GetAMConfigReceiver(ctx core.Context, filter *request.AMConfigReceiverFilter, pageParam *request.PageParam) ([]amconfig.Receiver, int, error) AddAMConfigReceiver(ctx core.Context, receiver amconfig.Receiver) error UpdateAMConfigReceiver(ctx core.Context, receiver amconfig.Receiver, oldName string) error DeleteAMConfigReceiver(ctx core.Context, name string) error CheckAMReceiverCount(ctx core.Context) int64 MigrateAMReceiver(ctx core.Context, receivers []amconfig.Receiver) ([]amconfig.Receiver, error) CreateCustomServiceTopology(ctx core.Context, topology *CustomServiceTopology) error ListCustomServiceTopology(ctx core.Context) ([]CustomServiceTopology, error) DeleteCustomServiceTopology(ctx core.Context, id int) error CreateServiceNameRule(ctx core.Context, serviceNameRule *ServiceNameRule) error ListAllServiceNameRule(ctx core.Context) ([]ServiceNameRule, error) UpsertServiceNameRuleCondition(ctx core.Context, condition *ServiceNameRuleCondition) error ListAllServiceNameRuleCondition(ctx core.Context) ([]ServiceNameRuleCondition, error) ServiceNameRuleExists(ctx core.Context, ruleId int) (bool, error) DeleteServiceNameRule(ctx core.Context, ruleId int) error integration.ObservabilityInputManage DaoDataScope DaoDataGroupNew }
Define the Database query interface
type Router ¶
type Router struct { RouterID int `gorm:"column:router_id;primary_key" json:"routerId"` RouterTo string `gorm:"column:router_to;uniqueIndex;type:varchar(200)" json:"to"` Custom bool `gorm:"column:custom;default:false" json:"-"` HideTimeSelector bool `gorm:"column:hide_time_selector" json:"hideTimeSelector"` Page *InsertPage `gorm:"-" json:"page,omitempty"` }
type RouterInsertPage ¶
type RouterInsertPage struct { ID int `gorm:"column:id"` RouterID int `gorm:"column:router_id"` PageID int `gorm:"column:page_id"` Language string `gorm:"column:language;type:varchar(20);default:NULL" json:"language"` }
RouterInsertPage maps router to inserted page.
func (RouterInsertPage) TableName ¶
func (RouterInsertPage) TableName() string
type ServiceNameRule ¶
type ServiceNameRule struct { ID int `gorm:"column:id;primary_key;auto_increment" json:"id"` Service string `gorm:"column:service_name;type:varchar(100)" json:"serviceName"` ClusterId string `gorm:"column:cluster_id;type:varchar(100)" json:"clusterId"` }
func (ServiceNameRule) TableName ¶
func (ServiceNameRule) TableName() string
type ServiceNameRuleCondition ¶
type ServiceNameRuleCondition struct { ID int `gorm:"column:id;primary_key;auto_increment" json:"id"` RuleID int `gorm:"column:rule_id;" json:"ruleId"` Key string `gorm:"column:key;type:varchar(20)" json:"key"` MatchType string `gorm:"column:match_type;type:varchar(20)" json:"matchType"` Value string `gorm:"column:value;type:varchar(1000)" json:"value"` }
func (*ServiceNameRuleCondition) Match ¶
func (condition *ServiceNameRuleCondition) Match(labels map[string]string) bool
func (ServiceNameRuleCondition) TableName ¶
func (ServiceNameRuleCondition) TableName() string
type Threshold ¶
type Threshold struct { ID uint `gorm:"primaryKey;autoIncrement"` ServiceName string `gorm:"type:varchar(255)"` Level string `gorm:"type:varchar(255)"` EndPoint string `gorm:"type:varchar(255)"` Latency float64 `gorm:"type:decimal(10,2)"` Tps float64 `gorm:"type:decimal(10,2)"` ErrorRate float64 `gorm:"type:decimal(10,2)"` Log float64 `gorm:"type:decimal(10,2)"` }
Source Files
¶
- alert_manager.go
- dao.go
- dao_api.go
- dao_auth_data_group.go
- dao_custom_service_topology.go
- dao_data_group.go
- dao_data_group_new.go
- dao_data_scope.go
- dao_feature.go
- dao_i18n.go
- dao_insert_page.go
- dao_logtableinfo.go
- dao_menu.go
- dao_othertableinfo.go
- dao_permission.go
- dao_quick_alert_rule_metric.go
- dao_receiver.go
- dao_role.go
- dao_router.go
- dao_service_name_rule.go
- dao_service_name_rule_condition.go
- dao_team.go
- dao_threshold.go
- dao_user.go
- init_api.go
- init_feature.go
- init_feature_mapping.go
- init_i18n.go
- init_insert_page.go
- init_menu_item.go
- init_permission.go
- init_role.go
- init_router.go
- init_router_page.go
- migrate_receiver.go
- transaction.go
Click to show internal directories.
Click to hide internal directories.