Documentation ¶
Overview ¶
-------------------------------------------------------------------------
* * docker_runner.go * Runner for DB Instance In Docker or Pod * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/docker_runner.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * export_runner.go * Export Runner * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/export_runner.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * http.go * Http client * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/http.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * module_linux.go * Plugin module interface * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/module_linux.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * plugin.go * Plugin Interface * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/plugin.go *------------------------------------------------------------------------- * Copyright (c) 2018. Alibaba Cloud, All right reserved. * This software is the confidential and proprietary information of Alibaba Cloud ("Confidential Information"). * You shall not disclose such Confidential Information and shall use it only in accordance with the terms of * the license agreement you entered into with Alibaba Cloud.
-------------------------------------------------------------------------
* * schema.go * Metrics schema * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/schema.go *-------------------------------------------------------------------------
-------------------------------------------------------------------------
* * software_polardb_runner.go * SoftwarePolardbRunner * * * Copyright (c) 2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * IDENTIFICATION * internal/gather/software_polardb_runner.go *-------------------------------------------------------------------------
Index ¶
- Constants
- Variables
- func DefaultMessageSerializeBySchema(ms *SchemaItems, content map[string]interface{}, buf *bytes.Buffer) error
- func HTTPConnectionNew() *http.Client
- func HTTPGet(client *http.Client, url string) ([]byte, error)
- func MessageHeaderSerializeBySchema(schemaHeader *SchemaItems, ins *Instance, headerMap map[string]interface{}) error
- func MessageSerialize(ms *SchemaItems, values map[string]interface{}, buf *bytes.Buffer) error
- func OnlyArrayMessageSerialize(v []string, buf *bytes.Buffer) error
- func OnlyIntArrayMessageSerialize(ms *SchemaItems, values map[string][]int, buf *bytes.Buffer) error
- func OnlyIntMessageSerializeBySchema(ms *SchemaItems, content map[string]uint64, buf *bytes.Buffer) error
- type BusinessSchema
- type BusinessSchemaDesc
- type DockerRunner
- type ExportRunner
- type ExternConf
- type Instance
- type ModuleInfo
- type PluginCtx
- type PluginInfo
- type PluginInterface
- type Runner
- type RunnerService
- type Schema
- type SchemaItem
- type SchemaItemDesc
- type SchemaItems
- type SingletonRunner
- type SoftwarePolardbRunner
- func (rr *SoftwarePolardbRunner) RunnerInit(mInfos *sync.Map, pInfo *PluginInfo, ctx *PluginCtx) error
- func (rr *SoftwarePolardbRunner) RunnerNotify()
- func (rr *SoftwarePolardbRunner) RunnerRun(wg *sync.WaitGroup) error
- func (rr *SoftwarePolardbRunner) RunnerStatus() interface{}
- func (rr *SoftwarePolardbRunner) RunnerStop()
Constants ¶
const ( // IntType for schema IntType = 0 // FloatType for schema FloatType = 1 // StringType for schema StringType = 2 // MapKeyType from schema MapKeyType = 3 // ListType from schema ListType = 4 // CPUTopType from schema CPUTopType = 5 // IOTopType from schema IOTopType = 6 // MemTopType from schema MemTopType = 7 // DStatusType from schema DStatusType = 8 // mapType for schema MapType = 9 // map with Int as key and double as value IntDoubleMap = 10 )
const (
MonitorConfPath = "conf/monitor.yaml"
)
Variables ¶
var DatatypeFormalizeMap map[string]string
var PluginNameFormalizeMap map[string]string
Functions ¶
func DefaultMessageSerializeBySchema ¶
func DefaultMessageSerializeBySchema(ms *SchemaItems, content map[string]interface{}, buf *bytes.Buffer) error
DefaultMessageSerializeBySchema method
func MessageHeaderSerializeBySchema ¶
func MessageHeaderSerializeBySchema(schemaHeader *SchemaItems, ins *Instance, headerMap map[string]interface{}) error
MessageHeaderSerializeBySchema method
func MessageSerialize ¶
func MessageSerialize(ms *SchemaItems, values map[string]interface{}, buf *bytes.Buffer) error
MessageSerialize method
func OnlyArrayMessageSerialize ¶
OnlyArrayMessageSerialize method
func OnlyIntArrayMessageSerialize ¶
func OnlyIntArrayMessageSerialize(ms *SchemaItems, values map[string][]int, buf *bytes.Buffer) error
OnlyIntArrayMessageSerialize method
func OnlyIntMessageSerializeBySchema ¶
func OnlyIntMessageSerializeBySchema(ms *SchemaItems, content map[string]uint64, buf *bytes.Buffer) error
OnlyIntMessageSerializeBySchema method
Types ¶
type BusinessSchema ¶
type BusinessSchema struct { Version uint32 Headers SchemaItems Metrics SchemaItems }
BusinessSchema for business
func JSON2Schema ¶
func JSON2Schema(j []byte, buf *bytes.Buffer) (*BusinessSchema, error)
JSON2Schema parser json schema
type BusinessSchemaDesc ¶
type BusinessSchemaDesc struct { Headers []SchemaItemDesc `json:"headers"` Metrics []SchemaItemDesc `json:"metrics"` }
BusinessSchemaDesc schema json definition begin
type DockerRunner ¶
type DockerRunner struct { Runner // contains filtered or unexported fields }
DockerRunner for a instance
func (*DockerRunner) RunnerInit ¶
func (dr *DockerRunner) RunnerInit(mInfoMap *sync.Map, pInfo *PluginInfo, pCtx *PluginCtx) error
RunnerInit init this runner
func (*DockerRunner) RunnerNotify ¶
func (dr *DockerRunner) RunnerNotify()
RunnerNotify notify a runner
func (*DockerRunner) RunnerRun ¶
func (dr *DockerRunner) RunnerRun(wg *sync.WaitGroup) error
RunnerRun run plugin for a docker instance
func (*DockerRunner) RunnerStatus ¶
func (dr *DockerRunner) RunnerStatus() interface{}
RunnerStatus get status from a runner
func (*DockerRunner) RunnerStop ¶
func (dr *DockerRunner) RunnerStop()
RunnerStop stop all runner instance
type ExportRunner ¶
type ExportRunner struct { Runner // contains filtered or unexported fields }
ExportRunner a runner only for export functions
func (*ExportRunner) RunnerInit ¶
func (er *ExportRunner) RunnerInit(mInfoMap *sync.Map, pInfo *PluginInfo, pCtx *PluginCtx) error
RunnerInit init this runner
func (*ExportRunner) RunnerNotify ¶
func (er *ExportRunner) RunnerNotify()
RunnerNotify notify a runner
func (*ExportRunner) RunnerRun ¶
func (er *ExportRunner) RunnerRun(wg *sync.WaitGroup) error
RunnerRun export runner run
func (*ExportRunner) RunnerStatus ¶
func (er *ExportRunner) RunnerStatus() interface{}
RunnerStatus get status
type ExternConf ¶
type ExternConf struct { Schema string `json:"schema"` Type string `json:"type"` Business string `json:"business"` Context map[string]interface{} `json:"context"` }
ExternConf struct
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance base struct
type ModuleInfo ¶
type ModuleInfo struct { ID string Mode string Extern string PluginABI PluginInterface Eat map[string]interface{} // module-name.FuncName as key Iat map[string]interface{} // module-name.FuncName as key Contexts sync.Map // module-name as key // contains filtered or unexported fields }
ModuleInfo a module struct
func (*ModuleInfo) ModuleInit ¶
func (module *ModuleInfo) ModuleInit(pInfo *PluginInfo) error
ModuleInit init a module
type PluginCtx ¶
type PluginCtx struct { //Plugins map[string]*PluginInfo Plugins sync.Map // pluginName as key,pluginInfo as value ReverseDependMap map[string][]*PluginInfo PluginQueue chan *PluginInfo // contains filtered or unexported fields }
PluginCtx : plugin context ReverseDependMap : depOn 被依赖 : dep 依赖, 如 A 依赖 B & C,则记录两条:B:A, C:A
type PluginInfo ¶
type PluginInfo struct { Type string `json:"type"` Mode string `json:"mode"` Runner string `json:"runner"` Exports []string `json:"exports"` Imports []string `json:"imports"` Path string `json:"path"` Name string `json:"name"` Extern string `json:"extern"` WorkDir string `json:"workdir"` WorkDirPrefix string `json:"prefix"` DoubleCheckDir string `json:"doulecheckdir"` Target string `json:"target"` // 用于判断实例类型,对齐本地元数据的dbtype DbType string `json:"dbtype"` // 用于上报数据的dbtype,不一定等于target BusinessType string `json:"businessType"` // 用于上报数据的类型 BizType string `json:"biz_type"` //区分实例是属于公共云还是阿里集团 Enable bool `json:"enable"` Interval int `json:"interval"` Backend []string `json:"backend"` Processor string `json:"processor"` // NOTE(wormhole.gl): processor ProcessorBackends []string `json:"multi_backends"` // NOTE(wormhole.gl): processor backends Dependencies []string `json:"dependencies"` }
PluginInfo for plugin
type PluginInterface ¶
type PluginInterface struct { Init func(interface{}) (interface{}, error) Run func(interface{}, interface{}) error Exit func(interface{}) error }
PluginInterface plugin common
type RunnerService ¶
type RunnerService interface { RunnerInit(mInfoMap *sync.Map, pInfo *PluginInfo, ctx *PluginCtx) error RunnerRun(wait *sync.WaitGroup) error RunnerStop() RunnerStatus() interface{} RunnerNotify() }
RunnerService base interface
func NewDockerRunner ¶
func NewDockerRunner() RunnerService
NewDockerRunner new a docker runner object
func NewExportRunner ¶
func NewExportRunner() RunnerService
NewExportRunner new a docker runner object, one plugin conf will run only one runner and one instance in this runner
func NewSoftwarePolardbRunner ¶
func NewSoftwarePolardbRunner() RunnerService
NewSoftwarePolardbRunner new a SoftwarePolardbRunner object
type SchemaItem ¶
SchemaItem for the schema
type SchemaItemDesc ¶
type SchemaItemDesc struct { Index int `json:"index"` Type string `json:"type"` Name string `json:"name"` }
SchemaItemDesc schema json definition begin
type SingletonRunner ¶
type SingletonRunner struct {
Runner
}
SingletonRunner struct
func (*SingletonRunner) RunnerInit ¶
func (sr *SingletonRunner) RunnerInit(mInfoMap *sync.Map, pInfo *PluginInfo, pCtx *PluginCtx) error
RunnerInit init
func (*SingletonRunner) RunnerNotify ¶
func (sr *SingletonRunner) RunnerNotify()
RunnerNotify notify
func (*SingletonRunner) RunnerRun ¶
func (sr *SingletonRunner) RunnerRun(wg *sync.WaitGroup) error
RunnerRun run
func (*SingletonRunner) RunnerStatus ¶
func (sr *SingletonRunner) RunnerStatus() interface{}
RunnerStatus status
type SoftwarePolardbRunner ¶
type SoftwarePolardbRunner struct { Runner // contains filtered or unexported fields }
SoftwarePolardbRunner struct
func (*SoftwarePolardbRunner) RunnerInit ¶
func (rr *SoftwarePolardbRunner) RunnerInit(mInfos *sync.Map, pInfo *PluginInfo, ctx *PluginCtx) error
RunnerInit init this runner
func (*SoftwarePolardbRunner) RunnerNotify ¶
func (rr *SoftwarePolardbRunner) RunnerNotify()
RunnerNotify notify
func (*SoftwarePolardbRunner) RunnerRun ¶
func (rr *SoftwarePolardbRunner) RunnerRun(wg *sync.WaitGroup) error
RunnerRun run
func (*SoftwarePolardbRunner) RunnerStatus ¶
func (rr *SoftwarePolardbRunner) RunnerStatus() interface{}
RunnerStatus status
func (*SoftwarePolardbRunner) RunnerStop ¶
func (rr *SoftwarePolardbRunner) RunnerStop()
RunnerStop stop