Documentation ¶
Overview ¶
Package rkentry defines inner entries for rk-boot.
Index ¶
- Constants
- Variables
- func RegisterAppInfoEntriesFromConfig(configFilePath string) map[string]Entry
- func RegisterCertEntriesFromConfig(configFilePath string) map[string]Entry
- func RegisterConfigEntriesWithConfig(configFilePath string) map[string]Entry
- func RegisterCredEntriesFromConfig(configFilePath string) map[string]Entry
- func RegisterEntryRegFunc(regFunc EntryRegFunc)
- func RegisterEventLoggerEntriesWithConfig(configFilePath string) map[string]Entry
- func RegisterInternalEntriesFromConfig(configFilePath string)
- func RegisterRkMetaEntriesFromConfig(string) map[string]Entry
- func RegisterZapLoggerEntriesWithConfig(configFilePath string) map[string]Entry
- type ApisResponse
- type ApisResponseElement
- type AppInfoEntry
- type AppInfoEntryOption
- func WithAppNameAppInfo(name string) AppInfoEntryOption
- func WithDescriptionAppInfo(description string) AppInfoEntryOption
- func WithDocsUrlAppInfo(docsURL ...string) AppInfoEntryOption
- func WithHomeUrlAppInfo(homeUrl string) AppInfoEntryOption
- func WithIconUrlAppInfo(iconUrl string) AppInfoEntryOption
- func WithKeywordsAppInfo(keywords ...string) AppInfoEntryOption
- func WithMaintainersAppInfo(maintainers ...string) AppInfoEntryOption
- func WithVersionAppInfo(version string) AppInfoEntryOption
- type BootConfigAppInfo
- type BootConfigCert
- type BootConfigCommonService
- type BootConfigConfig
- type BootConfigCred
- type BootConfigEventLogger
- type BootConfigLoki
- type BootConfigProm
- type BootConfigRkMeta
- type BootConfigStaticHandler
- type BootConfigSw
- type BootConfigTv
- type BootConfigZapLogger
- type CertEntry
- func (entry *CertEntry) Bootstrap(ctx context.Context)
- func (entry *CertEntry) GetDescription() string
- func (entry *CertEntry) GetName() string
- func (entry *CertEntry) GetType() string
- func (entry *CertEntry) Interrupt(context.Context)
- func (entry *CertEntry) MarshalJSON() ([]byte, error)
- func (entry *CertEntry) String() string
- func (entry *CertEntry) UnmarshalJSON([]byte) error
- type CertEntryOption
- func WithClientCertPath(clientCertPath string) CertEntryOption
- func WithClientKeyPath(clientKeyPath string) CertEntryOption
- func WithDescriptionCert(description string) CertEntryOption
- func WithEventLoggerEntryCert(logger *EventLoggerEntry) CertEntryOption
- func WithNameCert(name string) CertEntryOption
- func WithRetrieverCert(retriever Retriever) CertEntryOption
- func WithServerCertPath(serverCertPath string) CertEntryOption
- func WithServerKeyPath(serverKeyPath string) CertEntryOption
- func WithZapLoggerEntryCert(logger *ZapLoggerEntry) CertEntryOption
- type CertStore
- type CertsResponse
- type CertsResponseElement
- type CommonServiceEntry
- func (entry *CommonServiceEntry) Bootstrap(context.Context)
- func (entry *CommonServiceEntry) Certs(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Configs(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Deps(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Entries(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Gc(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) GetDescription() string
- func (entry *CommonServiceEntry) GetName() string
- func (entry *CommonServiceEntry) GetType() string
- func (entry *CommonServiceEntry) Git(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Healthy(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Info(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Interrupt(context.Context)
- func (entry *CommonServiceEntry) License(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) Logs(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) MarshalJSON() ([]byte, error)
- func (entry *CommonServiceEntry) Readme(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) String() string
- func (entry *CommonServiceEntry) Sys(writer http.ResponseWriter, request *http.Request)
- func (entry *CommonServiceEntry) UnmarshalJSON([]byte) error
- type CommonServiceEntryOption
- type ConfigEntry
- func (entry *ConfigEntry) Bootstrap(context.Context)
- func (entry *ConfigEntry) GetDescription() string
- func (entry *ConfigEntry) GetLocale() string
- func (entry *ConfigEntry) GetName() string
- func (entry *ConfigEntry) GetType() string
- func (entry *ConfigEntry) GetViper() *viper.Viper
- func (entry *ConfigEntry) GetViperAsMap() map[string]interface{}
- func (entry *ConfigEntry) Interrupt(context.Context)
- func (entry *ConfigEntry) MarshalJSON() ([]byte, error)
- func (entry *ConfigEntry) String() string
- func (entry *ConfigEntry) UnmarshalJSON([]byte) error
- type ConfigEntryOption
- func WithDescriptionConfig(description string) ConfigEntryOption
- func WithEnvPrefixConfig(prefix string) ConfigEntryOption
- func WithLocaleConfig(locale string) ConfigEntryOption
- func WithNameConfig(name string) ConfigEntryOption
- func WithPathConfig(path string) ConfigEntryOption
- func WithViperInstanceConfig(vp *viper.Viper) ConfigEntryOption
- type ConfigsResponse
- type ConfigsResponseElement
- type CpuInfo
- type CredEntry
- func (entry *CredEntry) Bootstrap(ctx context.Context)
- func (entry *CredEntry) GetDescription() string
- func (entry *CredEntry) GetName() string
- func (entry *CredEntry) GetType() string
- func (entry *CredEntry) Interrupt(context.Context)
- func (entry *CredEntry) MarshalJSON() ([]byte, error)
- func (entry *CredEntry) String() string
- func (entry *CredEntry) UnmarshalJSON([]byte) error
- type CredEntryOption
- func WithDescriptionCred(description string) CredEntryOption
- func WithEventLoggerEntryCred(logger *EventLoggerEntry) CredEntryOption
- func WithNameCred(name string) CredEntryOption
- func WithRetrieverCred(retriever Retriever) CredEntryOption
- func WithZapLoggerEntryCred(logger *ZapLoggerEntry) CredEntryOption
- type CredRetrieverConsul
- func (retriever *CredRetrieverConsul) GetEndpoint() string
- func (retriever *CredRetrieverConsul) GetLocale() string
- func (retriever *CredRetrieverConsul) GetProvider() string
- func (retriever *CredRetrieverConsul) ListPaths() []string
- func (retriever *CredRetrieverConsul) Retrieve(context.Context) *CredStore
- type CredRetrieverEtcd
- type CredRetrieverLocalFs
- func (retriever *CredRetrieverLocalFs) GetEndpoint() string
- func (retriever *CredRetrieverLocalFs) GetLocale() string
- func (retriever *CredRetrieverLocalFs) GetProvider() string
- func (retriever *CredRetrieverLocalFs) ListPaths() []string
- func (retriever *CredRetrieverLocalFs) Retrieve(context.Context) *CredStore
- type CredRetrieverRemoteFs
- func (retriever *CredRetrieverRemoteFs) GetEndpoint() string
- func (retriever *CredRetrieverRemoteFs) GetLocale() string
- func (retriever *CredRetrieverRemoteFs) GetProvider() string
- func (retriever *CredRetrieverRemoteFs) ListPaths() []string
- func (retriever *CredRetrieverRemoteFs) Retrieve(context.Context) *CredStore
- type CredStore
- type DepResponse
- type EntriesResponse
- type EntriesResponseElement
- type Entry
- type EntryRegFunc
- type EventLoggerEntry
- func (entry *EventLoggerEntry) AddEntryLabelToLokiSyncer(e Entry)
- func (entry *EventLoggerEntry) AddLabelToLokiSyncer(k, v string)
- func (entry *EventLoggerEntry) Bootstrap(ctx context.Context)
- func (entry *EventLoggerEntry) GetDescription() string
- func (entry *EventLoggerEntry) GetEventFactory() *rkquery.EventFactory
- func (entry *EventLoggerEntry) GetEventHelper() *rkquery.EventHelper
- func (entry *EventLoggerEntry) GetLumberjackConfig() *lumberjack.Logger
- func (entry *EventLoggerEntry) GetName() string
- func (entry *EventLoggerEntry) GetType() string
- func (entry *EventLoggerEntry) Interrupt(ctx context.Context)
- func (entry *EventLoggerEntry) MarshalJSON() ([]byte, error)
- func (entry *EventLoggerEntry) String() string
- func (entry *EventLoggerEntry) Sync()
- func (entry *EventLoggerEntry) UnmarshalJSON([]byte) error
- type EventLoggerEntryOption
- func WithBaseLoggerEvent(base *zap.Logger) EventLoggerEntryOption
- func WithDescriptionEvent(description string) EventLoggerEntryOption
- func WithEventFactoryEvent(fac *rkquery.EventFactory) EventLoggerEntryOption
- func WithLokiSyncerEvent(loki *rklogger.LokiSyncer) EventLoggerEntryOption
- func WithNameEvent(name string) EventLoggerEntryOption
- type GcResponse
- type GitResponse
- type GoEnvInfo
- type GwErrorMappingResponse
- type GwErrorMappingResponseElement
- type HealthyResponse
- type LicenseResponse
- type LogsResponse
- type LogsResponseElement
- type MemInfo
- type NetInfo
- type NetInterface
- type OsInfo
- type ProcessInfo
- type PromEntry
- func (entry *PromEntry) Bootstrap(ctx context.Context)
- func (entry *PromEntry) GetDescription() string
- func (entry *PromEntry) GetName() string
- func (entry *PromEntry) GetType() string
- func (entry *PromEntry) Interrupt(ctx context.Context)
- func (entry *PromEntry) MarshalJSON() ([]byte, error)
- func (entry *PromEntry) RegisterCollectors(collectors ...prometheus.Collector) error
- func (entry *PromEntry) String() string
- func (entry *PromEntry) UnmarshalJSON(b []byte) error
- type PromEntryOption
- func WithEventLoggerEntryProm(eventLoggerEntry *EventLoggerEntry) PromEntryOption
- func WithNameProm(name string) PromEntryOption
- func WithPathProm(path string) PromEntryOption
- func WithPortProm(port uint64) PromEntryOption
- func WithPromRegistryProm(registry *prometheus.Registry) PromEntryOption
- func WithPusherProm(pusher *PushGatewayPusher) PromEntryOption
- func WithZapLoggerEntryProm(zapLoggerEntry *ZapLoggerEntry) PromEntryOption
- type PushGatewayPusher
- type PushGatewayPusherOption
- func WithBasicAuthPusher(cred string) PushGatewayPusherOption
- func WithCertStorePusher(certStore *CertStore) PushGatewayPusherOption
- func WithEventLoggerEntryPusher(eventLoggerEntry *EventLoggerEntry) PushGatewayPusherOption
- func WithIntervalMSPusher(intervalMs time.Duration) PushGatewayPusherOption
- func WithJobNamePusher(jobName string) PushGatewayPusherOption
- func WithRemoteAddressPusher(remoteAddress string) PushGatewayPusherOption
- func WithZapLoggerEntryPusher(zapLoggerEntry *ZapLoggerEntry) PushGatewayPusherOption
- type ReadmeResponse
- type ReqMetricsRK
- type ReqResponse
- type ResCodeRK
- type Retriever
- type RkMetaEntry
- type RkMetaEntryOption
- type ShutdownHook
- type StaticFileHandlerEntry
- func (entry *StaticFileHandlerEntry) Bootstrap(context.Context)
- func (entry *StaticFileHandlerEntry) GetDescription() string
- func (entry *StaticFileHandlerEntry) GetFileHandler() http.HandlerFunc
- func (entry *StaticFileHandlerEntry) GetName() string
- func (entry *StaticFileHandlerEntry) GetType() string
- func (entry *StaticFileHandlerEntry) Interrupt(context.Context)
- func (entry *StaticFileHandlerEntry) MarshalJSON() ([]byte, error)
- func (entry *StaticFileHandlerEntry) String() string
- func (entry *StaticFileHandlerEntry) UnmarshalJSON([]byte) error
- type StaticFileHandlerEntryOption
- func WithEventLoggerEntryStatic(eventLoggerEntry *EventLoggerEntry) StaticFileHandlerEntryOption
- func WithFileSystemStatic(fs http.FileSystem) StaticFileHandlerEntryOption
- func WithNameStatic(name string) StaticFileHandlerEntryOption
- func WithPathStatic(path string) StaticFileHandlerEntryOption
- func WithZapLoggerEntryStatic(zapLoggerEntry *ZapLoggerEntry) StaticFileHandlerEntryOption
- type SwEntry
- func (entry *SwEntry) AssetsFileHandler() http.HandlerFunc
- func (entry *SwEntry) Bootstrap(ctx context.Context)
- func (entry *SwEntry) ConfigFileHandler() http.HandlerFunc
- func (entry *SwEntry) GetDescription() string
- func (entry *SwEntry) GetName() string
- func (entry *SwEntry) GetType() string
- func (entry *SwEntry) Interrupt(ctx context.Context)
- func (entry *SwEntry) MarshalJSON() ([]byte, error)
- func (entry *SwEntry) String() string
- func (entry *SwEntry) UnmarshalJSON([]byte) error
- type SwOption
- func WithEnableCommonServiceSw(enable bool) SwOption
- func WithEventLoggerEntrySw(eventLoggerEntry *EventLoggerEntry) SwOption
- func WithHeadersSw(headers map[string]string) SwOption
- func WithJsonPathSw(path string) SwOption
- func WithNameSw(name string) SwOption
- func WithPathSw(path string) SwOption
- func WithPortSw(port uint64) SwOption
- func WithZapLoggerEntrySw(zapLoggerEntry *ZapLoggerEntry) SwOption
- type SysResponse
- type TvEntry
- func (entry *TvEntry) Action(subPath string, logger *zap.Logger) *bytes.Buffer
- func (entry *TvEntry) AssetsFileHandler() http.HandlerFunc
- func (entry *TvEntry) Bootstrap(context.Context)
- func (entry *TvEntry) ExecuteTemplate(templateName string, data interface{}, logger *zap.Logger) *bytes.Buffer
- func (entry *TvEntry) GetDescription() string
- func (entry *TvEntry) GetName() string
- func (entry *TvEntry) GetType() string
- func (entry *TvEntry) Interrupt(context.Context)
- func (entry *TvEntry) MarshalJSON() ([]byte, error)
- func (entry *TvEntry) String() string
- func (entry *TvEntry) UnmarshalJSON([]byte) error
- type TvEntryOption
- type ZapLoggerEntry
- func (entry *ZapLoggerEntry) AddEntryLabelToLokiSyncer(e Entry)
- func (entry *ZapLoggerEntry) AddLabelToLokiSyncer(k, v string)
- func (entry *ZapLoggerEntry) Bootstrap(ctx context.Context)
- func (entry *ZapLoggerEntry) GetDescription() string
- func (entry *ZapLoggerEntry) GetLogger() *zap.Logger
- func (entry *ZapLoggerEntry) GetLoggerConfig() *zap.Config
- func (entry *ZapLoggerEntry) GetLumberjackConfig() *lumberjack.Logger
- func (entry *ZapLoggerEntry) GetName() string
- func (entry *ZapLoggerEntry) GetType() string
- func (entry *ZapLoggerEntry) Interrupt(ctx context.Context)
- func (entry *ZapLoggerEntry) MarshalJSON() ([]byte, error)
- func (entry *ZapLoggerEntry) String() string
- func (entry *ZapLoggerEntry) Sync()
- func (entry *ZapLoggerEntry) UnmarshalJSON([]byte) error
- type ZapLoggerEntryOption
Constants ¶
const ( // AppNameDefault will be used if not provided by user AppNameDefault = "rk" // VersionDefault will be empty if not provided by user VersionDefault = "" // LangDefault will always be golang LangDefault = "golang" // AppInfoEntryName is a fixed value AppInfoEntryName = "AppInfoDefault" // AppInfoEntry is a fixed value AppInfoEntryType = "AppInfoEntry" // AppInfoEntryDescription is a fixed value AppInfoEntryDescription = "Internal RK entry which describes application with fields of appName, version and etc." )
const ( // CertEntryName name of default entry CertEntryName = "CertDefault" // CertEntryType type name of CertEntry CertEntryType = "CertEntry" // CertEntryDescription is default description of CertEntry CertEntryDescription = "Internal RK entry which retrieves certificates from localFs, remoteFs, etcd or consul." )
const ( // CommonServiceEntryType type of entry CommonServiceEntryType = "CommonServiceEntry" // CommonServiceEntryNameDefault name of entry CommonServiceEntryNameDefault = "CommonServiceDefault" // CommonServiceEntryDescription description of entry CommonServiceEntryDescription = "Internal RK entry which implements commonly used API." )
const ( // ConfigEntryType is entry type of ConfigEntry ConfigEntryType = "ConfigEntry" // ConfigEntryDescription is default description of ConfigEntry ConfigEntryDescription = "Internal RK entry which read user config file into viper instance." )
const ( // DefaultZapLoggerEntryName is default ZapLoggerEntry name DefaultZapLoggerEntryName = "zapLoggerDefault" // DefaultEventLoggerEntryName is default EventLoggerEntry name DefaultEventLoggerEntryName = "eventLoggerDefault" )
const ( // CredEntryName name of entry CredEntryName = "CredDefault" // CredEntryType type of entry CredEntryType = "CredEntry" // CredEntryDescription description of entry CredEntryDescription = "Internal RK entry which retrieves credentials from localFs, remoteFs, etcd or consul." // DefaultTimeout default timeout while connecting to retriever DefaultTimeout = 3 * time.Second // ProviderEtcd retriever type of etcd ProviderEtcd = "etcd" // ProviderConsul retriever type of consul ProviderConsul = "consul" // ProviderLocalFs retriever type of localFs ProviderLocalFs = "localFs" // ProviderRemoteFs retriever type of RemoteFs ProviderRemoteFs = "remoteFs" )
const ( // EventLoggerEntryType type of entry EventLoggerEntryType = "EventLoggerEntry" // EventLoggerNameNoop name of noop entry EventLoggerNameNoop = "EventLoggerNoop" // EventLoggerDescription of entry description EventLoggerDescription = "Internal RK entry which is used to log event such as RPC request or periodic jobs." )
const ( // PromEntryType default entry type PromEntryType = "PromEntry" // PromEntryNameDefault default entry name PromEntryNameDefault = "PromDefault" // PromEntryDescription default entry description PromEntryDescription = "Internal RK entry which implements prometheus client." )
const ( // RkMetaEntryName name of entry RkMetaEntryName = "RkMetaDefault" // RkMetaEntryType type of entry RkMetaEntryType = "RkMetaEntry" // RkMetaEntryDescription description of entry RkMetaEntryDescription = "Internal RK entry which describes rk metadata." )
const ( // StaticFileHandlerEntryType type of entry StaticFileHandlerEntryType = "StaticFileHandlerEntry" // StaticFileHandlerEntryNameDefault name of entry StaticFileHandlerEntryNameDefault = "StaticFileHandlerDefault" // StaticFileHandlerEntryDescription description of entry StaticFileHandlerEntryDescription = "Internal RK entry which implements static file handler." )
const ( // SwEntryType default entry type SwEntryType = "SwEntry" // SwEntryNameDefault default entry name SwEntryNameDefault = "SwDefault" // SwEntryDescription default entry description SwEntryDescription = "Internal RK entry for swagger UI." // ModPath used while reading files from pkger ModPath = "github.com/rookie-ninja/rk-entry" )
const ( // TvEntryType default entry type TvEntryType = "TvEntry" // TvEntryNameDefault default entry name TvEntryNameDefault = "TvDefault" // TvEntryDescription default entry description TvEntryDescription = "Internal RK entry which implements RK TV web UI." )
const ( // ZapLoggerEntryType name of entry ZapLoggerEntryType = "ZapLoggerEntry" // ZapLoggerNameNoop type of entry ZapLoggerNameNoop = "ZapLoggerNoop" // ZapLoggerDescription description of entry ZapLoggerDescription = "Internal RK entry which is used for logging with zap.Logger." )
Variables ¶
var ( // GlobalAppCtx global application context GlobalAppCtx = &appContext{ startTime: time.Now(), appInfoEntry: AppInfoEntryDefault(), zapLoggerEntries: make(map[string]Entry), eventLoggerEntries: make(map[string]Entry), configEntries: make(map[string]Entry), certEntries: make(map[string]Entry), credEntries: make(map[string]Entry), externalEntries: make(map[string]Entry), shutdownSig: make(chan os.Signal), shutdownHooks: make(map[string]ShutdownHook), userValues: make(map[string]interface{}), } )
var ( // Templates is a map to store go template Templates = map[string][]byte{} )
Functions ¶
func RegisterAppInfoEntriesFromConfig ¶
RegisterAppInfoEntriesFromConfig implements rkentry.EntryRegFunc which generate RKEntry based on boot configuration file.
func RegisterCertEntriesFromConfig ¶
RegisterCertEntriesFromConfig implements rkentry.EntryRegFunc which generate Entry based on boot configuration file. Currently, only YAML file is supported. File path could be either relative or absolute.
func RegisterConfigEntriesWithConfig ¶
RegisterConfigEntriesWithConfig create config entries with config file. Currently, only YAML file is supported. File path could be either relative or absolute.
func RegisterCredEntriesFromConfig ¶ added in v1.0.1
RegisterCredEntriesFromConfig implements rkentry.EntryRegFunc which generate Entry based on boot configuration file. Currently, only YAML file is supported. File path could be either relative or absolute.
func RegisterEntryRegFunc ¶
func RegisterEntryRegFunc(regFunc EntryRegFunc)
RegisterEntryRegFunc register user defined registration function. rkboot.Bootstrap will iterate every registration function and call it
func RegisterEventLoggerEntriesWithConfig ¶
RegisterEventLoggerEntriesWithConfig create event logger entries with config file. Currently, only YAML file is supported. File path could be either relative or absolute.
func RegisterInternalEntriesFromConfig ¶
func RegisterInternalEntriesFromConfig(configFilePath string)
RegisterInternalEntriesFromConfig is internal use only, please do not add entries registration function via this. Please use RegisterEntryRegFunc instead.
func RegisterRkMetaEntriesFromConfig ¶
RegisterRkMetaEntriesFromConfig implements rkentry.EntryRegFunc which generate RKEntry based on boot configuration file.
func RegisterZapLoggerEntriesWithConfig ¶
RegisterZapLoggerEntriesWithConfig create zap logger entries with config file. Currently, only YAML file is supported. File path could be either relative or absolute.
Types ¶
type ApisResponse ¶
type ApisResponse struct {
Entries []*ApisResponseElement `json:"entries" yaml:"entries"`
}
ApisResponse response for path of /apis
type ApisResponseElement ¶ added in v1.0.5
type ApisResponseElement struct { EntryName string `json:"entryName" yaml:"entryName"` Method string `json:"method" yaml:"method"` Path string `json:"path" yaml:"path"` Gw string `json:"gw" yaml:"gw"` Port uint64 `json:"port" yaml:"port"` SwUrl string `json:"swUrl" yaml:"swUrl"` }
ApiResponseElement element for ApisResponse
type AppInfoEntry ¶
type AppInfoEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"description" yaml:"description"` AppName string `json:"appName" yaml:"appName"` Version string `json:"version" yaml:"version"` Lang string `json:"lang" yaml:"lang"` Keywords []string `json:"keywords" yaml:"keywords"` HomeUrl string `json:"homeUrl" yaml:"homeUrl"` IconUrl string `json:"iconUrl" yaml:"iconUrl"` DocsUrl []string `json:"docsUrl" yaml:"docsUrl"` Maintainers []string `json:"maintainers" yaml:"maintainers"` License string `json:"-" yaml:"-"` Readme string `json:"-" yaml:"-"` GoMod string `json:"-" yaml:"-"` UtHtml string `json:"-" yaml:"-"` }
AppInfoEntry contains bellow fields. 1: AppName: Application name which refers to go process 2: Version: Application version 3: Lang: Programming language <NOT configurable!> 4: EntryDescription: Description of application itself 5: Keywords: A set of words describe application 6: HomeUrl: Home page URL 7: IconUrl: Application Icon URL 8: DocsUrl: A set of URLs of documentations of application 9: Maintainers: Maintainers of application 10: License: License of current application. 11: Readme: README.md file of current application. 11: GoMod: go.mod file of current application. 12: UtHtml: cov.html file of current application.
func AppInfoEntryDefault ¶
func AppInfoEntryDefault() *AppInfoEntry
AppInfoEntryDefault generate a AppInfo entry with default fields.
func RegisterAppInfoEntry ¶
func RegisterAppInfoEntry(opts ...AppInfoEntryOption) *AppInfoEntry
RegisterAppInfoEntry register RKEntry with options. This function is used while creating entry from code instead of config file. We will override RKEntry fields if value is nil or empty if necessary.
Generally, we recommend call rkctx.GlobalAppCtx.AddEntry() inside this function, however, we recommend to register RKEntry, ZapLoggerEntry, EventLoggerEntry with function of rkctx.RegisterBasicEntriesWithConfig which will register these entries to global context automatically.
func (*AppInfoEntry) Bootstrap ¶
func (entry *AppInfoEntry) Bootstrap(context.Context)
Bootstrap will read meta files.
func (*AppInfoEntry) GetDescription ¶
func (entry *AppInfoEntry) GetDescription() string
GetDescription return description of entry.
func (*AppInfoEntry) GetName ¶
func (entry *AppInfoEntry) GetName() string
GetName return name of entry.
func (*AppInfoEntry) GetType ¶
func (entry *AppInfoEntry) GetType() string
GetType return type of entry.
func (*AppInfoEntry) Interrupt ¶
func (entry *AppInfoEntry) Interrupt(context.Context)
Interrupt is noop function.
func (*AppInfoEntry) String ¶
func (entry *AppInfoEntry) String() string
String return string value of entry.
type AppInfoEntryOption ¶
type AppInfoEntryOption func(*AppInfoEntry)
AppInfoEntryOption which used while registering entry from codes.
func WithAppNameAppInfo ¶
func WithAppNameAppInfo(name string) AppInfoEntryOption
WithAppNameAppInfo provide application name.
func WithDescriptionAppInfo ¶
func WithDescriptionAppInfo(description string) AppInfoEntryOption
WithDescriptionAppInfo provide description.
func WithDocsUrlAppInfo ¶
func WithDocsUrlAppInfo(docsURL ...string) AppInfoEntryOption
WithDocsUrlAppInfo provide documentation URLs.
func WithHomeUrlAppInfo ¶
func WithHomeUrlAppInfo(homeUrl string) AppInfoEntryOption
WithHomeUrlAppInfo provide home page URL.
func WithIconUrlAppInfo ¶
func WithIconUrlAppInfo(iconUrl string) AppInfoEntryOption
WithIconUrlAppInfo provide icon URL.
func WithKeywordsAppInfo ¶
func WithKeywordsAppInfo(keywords ...string) AppInfoEntryOption
WithKeywordsAppInfo provide keywords.
func WithMaintainersAppInfo ¶
func WithMaintainersAppInfo(maintainers ...string) AppInfoEntryOption
WithMaintainersAppInfo provide maintainers.
func WithVersionAppInfo ¶
func WithVersionAppInfo(version string) AppInfoEntryOption
WithVersionAppInfo provide version.
type BootConfigAppInfo ¶
type BootConfigAppInfo struct { App struct { Description string `yaml:"description" json:"description"` Keywords []string `yaml:"keywords" json:"keywords"` HomeUrl string `yaml:"homeUrl" json:"homeUrl"` IconUrl string `yaml:"iconUrl" json:"iconUrl"` DocsUrl []string `yaml:"docsUrl" json:"docsUrl"` Maintainers []string `yaml:"maintainers" json:"maintainers"` } `yaml:"app"` }
BootConfigAppInfo is config of application's basic information. 1: Description: Description of application itself. 2: Keywords: A set of words describe application. 3: HomeUrl: Home page URL. 4: IconUrl: Application Icon URL. 5: Maintainers: Maintainers of application. 6: DocsUrl: A set of URLs of documentations of application.
type BootConfigCert ¶
type BootConfigCert struct { Cert []struct { Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Provider string `yaml:"provider" json:"provider"` Locale string `yaml:"locale" json:"locale"` Endpoint string `yaml:"endpoint" json:"endpoint"` Datacenter string `yaml:"datacenter" json:"datacenter"` Token string `yaml:"token" json:"token"` BasicAuth string `yaml:"basicAuth" json:"basicAuth"` ServerCertPath string `yaml:"serverCertPath" json:"serverCertPath"` ServerKeyPath string `yaml:"serverKeyPath" json:"serverKeyPath"` ClientCertPath string `yaml:"clientCertPath" json:"clientCertPath"` ClientKeyPath string `yaml:"clientKeyPath" json:"clientKeyPath"` Logger struct { ZapLogger struct { Ref string `yaml:"ref" json:"ref"` } `yaml:"zapLogger" json:"zapLogger"` EventLogger struct { Ref string `yaml:"ref" json:"ref"` } `yaml:"eventLogger" json:"eventLogger"` } `yaml:"logger" json:"logger"` } `yaml:"cert" json:"cert"` }
BootConfigCert is bootstrap config of CertEntry. etcd: 1: Cert.Name: Name of section, required. 2: Cert.Provider: etcd. 3: Cert.Locale: <realm>::<region>::<az>::<domain> 4: Cert.Endpoint: Endpoint of etcd server, http://x.x.x.x or x.x.x.x both acceptable. 5: Cert.BasicAuth: Basic auth for etcd server, like <user:pass>. 6: Cert.ServerCertPath: Key of server cert in etcd server. 7: Cert.ServerKeyPath: Key of server key in etcd server. 8: Cert.ClientCertPath: Key of client cert in etcd server. 9: Cert.ClientKeyPath: Key of client cert in etcd server.
localFs 1: Cert.Local.Name: Name of section, required. 2: Cert.Provider: localFS. 3: Cert.Locale: <realm>::<region>::<az>::<domain> 4: Cert.ServerCertPath: Key of server cert in local fs. 5: Cert.ServerKeyPath: Key of server key in local fs. 6: Cert.ClientCertPath: Key of client cert in local fs. 7: Cert.ClientKeyPath: Key of client cert in local fs.
consul 1: Cert.Name: Name of section, required. 2: Cert.Provider: consul. 3: Cert.Locale: <realm>::<region>::<az>::<domain> 4: Cert.Endpoint: Endpoint of consul server, http://x.x.x.x or x.x.x.x both acceptable. 5: Cert.Datacenter: Consul datacenter. 6: Cert.Token: Token for access consul. 7: Cert.BasicAuth: Basic auth for consul server, like <user:pass>. 8: Cert.ServerCertPath: Key of server cert in consul server. 9: Cert.ServerKeyPath: Key of server key in consul server. 10: Cert.ClientCertPath: Key of client cert in consul server. 11: Cert.ClientKeyPath: Key of client cert in consul server.
remoteFs: 1: Cert.Name: Name of section, required. 2: Cert.Provider: remoteFs. 3: Cert.Locale: <realm>::<region>::<az>::<domain> 4: Cert.Endpoint: Endpoint of remoteFs server, http://x.x.x.x or x.x.x.x both acceptable. 5: Cert.BasicAuth: Basic auth for remoteFs server, like <user:pass>. 6: Cert.ServerCertPath: Key of server cert in remoteFs server. 7: Cert.ServerKeyPath: Key of server key in remoteFs server. 8: Cert.ClientCertPath: Key of client cert in remoteFs server. 9: Cert.ClientKeyPath: Key of client cert in remoteFs server.
Logger: 1: Cert.Logger.ZapLogger.Ref: Name of zap logger entry defined in ZapLoggerEntry. 2: Cert.Logger.EventLogger.Ref: Name of event logger entry defined in EventLoggerEntry.
type BootConfigCommonService ¶ added in v1.0.5
type BootConfigCommonService struct {
Enabled bool `yaml:"enabled" json:"enabled"`
}
BootConfigCommonService Bootstrap config of common service. 1: Enabled: Enable common service.
type BootConfigConfig ¶
type BootConfigConfig struct { Config []struct { Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Locale string `yaml:"locale" json:"locale"` Path string `yaml:"path" json:"name"` EnvPrefix string `yaml:"envPrefix" json:"envPrefix"` } `yaml:"config" json:"config"` }
BootConfigConfig is bootstrap config of ConfigEntry information. 1: Config.Name: Name of viper entry. 2: Config.Description: Description of viper entry. 3: Config.Locale: <realm>::<region>::<az>::<domain> 4: Config.Path: File path of config file, could be either relative or absolute path.
If relative path was provided, then current working directory would be joined as prefix.
type BootConfigCred ¶ added in v1.0.1
type BootConfigCred struct { Cred []struct { Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Provider string `yaml:"provider" json:"provider"` Locale string `yaml:"locale" json:"locale"` Endpoint string `yaml:"endpoint" json:"endpoint"` Datacenter string `yaml:"datacenter" json:"datacenter"` Token string `yaml:"token" json:"token"` BasicAuth string `yaml:"basicAuth" json:"basicAuth"` Paths []string `yaml:"paths" json:"paths"` Logger struct { ZapLogger struct { Ref string `yaml:"ref" json:"ref"` } `yaml:"zapLogger" json:"zapLogger"` EventLogger struct { Ref string `yaml:"ref" json:"ref"` } `yaml:"eventLogger" json:"eventLogger"` } `yaml:"logger" json:"logger"` } `yaml:"cred" json:"cred"` }
BootConfigCred defines bootstrapper config
type BootConfigEventLogger ¶
type BootConfigEventLogger struct { EventLogger []struct { Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Encoding string `yaml:"encoding" json:"encoding"` OutputPaths []string `yaml:"outputPaths" json:"outputPaths"` Lumberjack *lumberjack.Logger `yaml:"lumberjack" json:"lumberjack"` Loki BootConfigLoki `yaml:"loki" json:"loki"` } `yaml:"eventLogger json:"eventLogger"` }
BootConfigEventLogger bootstrap config of Event Logger information. 1: RK.AppName: Application name which refers to go process.
Default application name of AppNameDefault would be assigned if missing in boot config file.
2: RK.Version: Version of application. 3: EventLogger.Name: Name of event logger entry. 4: EventLogger.Description: Description of event logger entry. 5: EventLogger.Format: Format of event logger, RK & JSON is supported. Please refer rkquery.RK & rkquery.JSON. 6: EventLogger.OutputPaths: Output paths of event logger, stdout would be the default one if not provided.
If one of output path was provided, then stdout would be omitted. Output path could be relative or absolute paths either.
7: EventLogger.Lumberjack: Lumberjack config which follows lumberjack.Logger style.
type BootConfigLoki ¶ added in v1.0.8
type BootConfigLoki struct { Enabled bool `yaml:"enabled" json:"enabled"` Addr string `yaml:"addr" json:"addr"` Path string `yaml:"path" json:"path"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` InsecureSkipVerify bool `yaml:"insecureSkipVerify" json:"insecureSkipVerify"` Labels map[string]string `yaml:"labels" json:"labels"` MaxBatchWaitMs int `yaml:"maxBatchWaitMs" json:"maxBatchWaitMs"` MaxBatchSize int `yaml:"maxBatchSize" json:"maxBatchSize"` }
type BootConfigProm ¶ added in v1.0.5
type BootConfigProm struct { Enabled bool `yaml:"enabled" json:"enabled"` Path string `yaml:"path" json:"path"` Pusher struct { Enabled bool `yaml:"enabled" json:"enabled"` IntervalMs int64 `yaml:"IntervalMs" json:"IntervalMs"` JobName string `yaml:"jobName" json:"jobName"` RemoteAddress string `yaml:"remoteAddress" json:"remoteAddress"` BasicAuth string `yaml:"basicAuth" json:"basicAuth"` Cert struct { Ref string `yaml:"ref" json:"ref"` } `yaml:"cert" json:"cert"` } `yaml:"pusher" json:"pusher"` }
BootConfigProm Boot config which is for prom entry.
type BootConfigRkMeta ¶
type BootConfigRkMeta struct { Name string `yaml:"name" json:"name"` Version string `yaml:"version" json:"version"` Git struct { Url string `yaml:"url" json:"url"` Branch string `yaml:"branch" json:"branch"` Tag string `yaml:"tag" json:"tag"` Commit struct { Id string `yaml:"id" json:"id"` IdAbbr string `yaml:"idAbbr" json:"idAbbr"` Date string `yaml:"date" json:"date"` Sub string `yaml:"sub" json:"sub"` Committer struct { Name string `yaml:"name" json:"name"` Email string `yaml:"email" json:"email"` } `yaml:"committer" json:"committer"` } `yaml:"commit" json:"commit"` } `yaml:"git" json:"git"` }
BootConfigRkMeta bootstrap config of application's meta information.
type BootConfigStaticHandler ¶ added in v1.0.5
type BootConfigStaticHandler struct { Enabled bool `yaml:"enabled" json:"enabled"` Path string `yaml:"path" json:"path"` SourceType string `yaml:"sourceType" json:"sourceType"` SourcePath string `yaml:"sourcePath" json:"sourcePath"` }
BootConfigStaticHandler bootstrap config of StaticHandler.
type BootConfigSw ¶ added in v1.0.5
type BootConfigSw struct { Enabled bool `yaml:"enabled" yaml:"enabled"` Path string `yaml:"path" yaml:"path"` JsonPath string `yaml:"jsonPath" yaml:"jsonPath"` Headers []string `yaml:"headers" yaml:"headers"` }
BootConfigSw Bootstrap config of swagger. 1: Enabled: Enable swagger. 2: Path: Swagger path accessible from restful API. 3: JsonPath: The path of where swagger JSON file was located. 4: Headers: The headers that would added into each API response.
type BootConfigTv ¶ added in v1.0.5
type BootConfigTv struct {
Enabled bool `yaml:"enabled" json:"enabled"`
}
BootConfigTv Bootstrap config of tv. 1: Enabled: Enable tv service.
type BootConfigZapLogger ¶
type BootConfigZapLogger struct { ZapLogger []struct { Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Zap *rklogger.ZapConfigWrap `yaml:"zap" json:"zap"` Lumberjack *lumberjack.Logger `yaml:"lumberjack" json:"lumberjack"` Loki BootConfigLoki `yaml:"loki" json:"loki"` } `yaml:"zapLogger" json:"zapLogger"` }
BootConfigZapLogger bootstrap config of Zap Logger information.
type CertEntry ¶
type CertEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` Store *CertStore `json:"store" yaml:"store"` Retriever Retriever `json:"retriever" yaml:"retriever"` ServerKeyPath string `json:"serverKeyPath" yaml:"serverKeyPath"` ServerCertPath string `json:"serverCertPath" yaml:"serverCertPath"` ClientKeyPath string `json:"clientKeyPath" yaml:"clientKeyPath"` ClientCertPath string `json:"clientKeyPath" yaml:"clientKeyPath"` }
CertEntry contains bellow fields. 1: EntryName: Name of entry. 2: EntryType: Type of entry which is CertEntry. 3: EntryDescription: Description of entry. 4: ZapLoggerEntry: ZapLoggerEntry was initialized at the beginning. 5: EventLoggerEntry: EventLoggerEntry was initialized at the beginning. 6: Store: Certificate store. 7: Retriever: Certificate retriever.
func RegisterCertEntry ¶
func RegisterCertEntry(opts ...CertEntryOption) *CertEntry
RegisterCertEntry create cert entry with options.
func (*CertEntry) GetDescription ¶
GetDescription return description of entry
func (*CertEntry) MarshalJSON ¶
MarshalJSON marshal entry
func (*CertEntry) UnmarshalJSON ¶
UnmarshalJSON unmarshal entry
type CertEntryOption ¶
type CertEntryOption func(entry *CertEntry)
CertEntryOption Option which used while registering entry from codes.
func WithClientCertPath ¶ added in v1.0.1
func WithClientCertPath(clientCertPath string) CertEntryOption
WithClientCertPath provide client cert path.
func WithClientKeyPath ¶ added in v1.0.1
func WithClientKeyPath(clientKeyPath string) CertEntryOption
WithClientKeyPath provide client key path.
func WithDescriptionCert ¶
func WithDescriptionCert(description string) CertEntryOption
WithDescriptionCert provide description.
func WithEventLoggerEntryCert ¶
func WithEventLoggerEntryCert(logger *EventLoggerEntry) CertEntryOption
WithEventLoggerEntryCert provide EventLoggerEntry.
func WithRetrieverCert ¶ added in v1.0.1
func WithRetrieverCert(retriever Retriever) CertEntryOption
WithRetrieverCert provide Retriever.
func WithServerCertPath ¶ added in v1.0.1
func WithServerCertPath(serverCertPath string) CertEntryOption
WithServerCertPath provide server cert path.
func WithServerKeyPath ¶ added in v1.0.1
func WithServerKeyPath(serverKeyPath string) CertEntryOption
WithServerKeyPath provide server key path.
func WithZapLoggerEntryCert ¶
func WithZapLoggerEntryCert(logger *ZapLoggerEntry) CertEntryOption
WithZapLoggerEntryCert provide ZapLoggerEntry.
type CertStore ¶
type CertStore struct { // Server certificate ServerCert []byte `json:"-" yaml:"-"` // Server key ServerKey []byte `json:"-" yaml:"-"` // Client certificate, useful while client authentication was enabled from server ClientCert []byte `json:"-" yaml:"-"` // Client key (private), useful while client authentication was enabled from server ClientKey []byte `json:"-" yaml:"-"` }
CertStore stores certificate as byte array. ServerCert: Server certificate. ServerKey: Private key of server certificate. ClientCert: Client certificate. ClientKey: Private key of client certificate.
func (*CertStore) ClientCertString ¶
ClientCertString parse client certificate to human readable string.
func (*CertStore) MarshalJSON ¶
MarshalJSON marshal entry
func (*CertStore) SeverCertString ¶
SeverCertString parse server certificate to human readable string.
func (*CertStore) UnmarshalJSON ¶
UnmarshalJSON unmarshal entry
type CertsResponse ¶
type CertsResponse struct {
Entries []*CertsResponseElement `json:"entries" yaml:"entries"`
}
CertsResponse response of /certs
type CertsResponseElement ¶ added in v1.0.5
type CertsResponseElement struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` ServerCertPath string `json:"serverCertPath" yaml:"serverCertPath"` ServerKeyPath string `json:"serverKeyPath" yaml:"serverKeyPath"` ClientCertPath string `json:"clientCertPath" yaml:"clientCertPath"` ClientKeyPath string `json:"clientKeyPath" yaml:"clientKeyPath"` Endpoint string `json:"endpoint" yaml:"endpoint"` Locale string `json:"locale" yaml:"locale"` Provider string `json:"provider" yaml:"provider"` ServerCert string `json:"serverCert" yaml:"serverCert"` ClientCert string `json:"clientCert" yaml:"clientCert"` }
CertsResponseElement element for CertsResponse
type CommonServiceEntry ¶ added in v1.0.5
type CommonServiceEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` HealthyPath string `json:"-" yaml:"-"` GcPath string `json:"-" yaml:"-"` InfoPath string `json:"-" yaml:"-"` ConfigsPath string `json:"-" yaml:"-"` SysPath string `json:"-" yaml:"-"` EntriesPath string `json:"-" yaml:"-"` CertsPath string `json:"-" yaml:"-"` LogsPath string `json:"-" yaml:"-"` DepsPath string `json:"-" yaml:"-"` LicensePath string `json:"-" yaml:"-"` ReadmePath string `json:"-" yaml:"-"` GitPath string `json:"-" yaml:"-"` ApisPath string `json:"-" yaml:"-"` ReqPath string `json:"-" yaml:"-"` GwErrorMappingPath string `json:"-" yaml:"-"` }
CommonServiceEntry RK common service which contains commonly used APIs 1: Healthy Returns true if process is alive 2: Gc Trigger gc() 3: Info Returns entry basic information 4: Configs Returns viper configs in GlobalAppCtx 5: Apis Returns list of apis registered in gin router 6: Sys Returns CPU and Memory information 7: Req Returns request metrics 8: Certs Returns certificates 9: Entries Returns entries 10: Logs Returns log entries 12: Deps Returns dependency which is full go.mod file content 13: License Returns license file content 14: Readme Returns README file content
func RegisterCommonServiceEntry ¶ added in v1.0.5
func RegisterCommonServiceEntry(opts ...CommonServiceEntryOption) *CommonServiceEntry
RegisterCommonServiceEntry Create new common service entry with options.
func RegisterCommonServiceEntryWithConfig ¶ added in v1.0.5
func RegisterCommonServiceEntryWithConfig(config *BootConfigCommonService, name string, zap *ZapLoggerEntry, event *EventLoggerEntry) *CommonServiceEntry
RegisterCommonServiceEntryWithConfig Create new common service entry with config
func (*CommonServiceEntry) Bootstrap ¶ added in v1.0.5
func (entry *CommonServiceEntry) Bootstrap(context.Context)
Bootstrap common service entry.
func (*CommonServiceEntry) Certs ¶ added in v1.0.5
func (entry *CommonServiceEntry) Certs(writer http.ResponseWriter, request *http.Request)
Certs handler @Summary List CertEntry @Id 7 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} CertsResponse @Router /rk/v1/certs [get]
func (*CommonServiceEntry) Configs ¶ added in v1.0.5
func (entry *CommonServiceEntry) Configs(writer http.ResponseWriter, request *http.Request)
Configs handler @Summary List ConfigEntry @Id 4 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} ConfigsResponse @Router /rk/v1/configs [get]
func (*CommonServiceEntry) Deps ¶ added in v1.0.5
func (entry *CommonServiceEntry) Deps(writer http.ResponseWriter, request *http.Request)
Deps handler @Summary List dependencies related application @Id 9 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} DepResponse @Router /rk/v1/deps [get]
func (*CommonServiceEntry) Entries ¶ added in v1.0.5
func (entry *CommonServiceEntry) Entries(writer http.ResponseWriter, request *http.Request)
Entries handler @Summary List all Entry @Id 6 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} EntriesResponse @Router /rk/v1/entries [get]
func (*CommonServiceEntry) Gc ¶ added in v1.0.5
func (entry *CommonServiceEntry) Gc(writer http.ResponseWriter, request *http.Request)
Gc handler @Summary Trigger Gc @Id 2 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} GcResponse @Router /rk/v1/gc [get]
func (*CommonServiceEntry) GetDescription ¶ added in v1.0.5
func (entry *CommonServiceEntry) GetDescription() string
GetDescription Get description of entry.
func (*CommonServiceEntry) GetName ¶ added in v1.0.5
func (entry *CommonServiceEntry) GetName() string
GetName Get name of entry.
func (*CommonServiceEntry) GetType ¶ added in v1.0.5
func (entry *CommonServiceEntry) GetType() string
GetType Get entry type.
func (*CommonServiceEntry) Git ¶ added in v1.0.5
func (entry *CommonServiceEntry) Git(writer http.ResponseWriter, request *http.Request)
Git handler @Summary Get Git information. @Id 12 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} GitResponse @Router /rk/v1/git [get]
func (*CommonServiceEntry) Healthy ¶ added in v1.0.5
func (entry *CommonServiceEntry) Healthy(writer http.ResponseWriter, request *http.Request)
Healthy handler @Summary Get application healthy status @Id 1 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} HealthyResponse @Router /rk/v1/healthy [get]
func (*CommonServiceEntry) Info ¶ added in v1.0.5
func (entry *CommonServiceEntry) Info(writer http.ResponseWriter, request *http.Request)
Info handler @Summary Get application and process info @Id 3 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} ProcessInfo @Router /rk/v1/info [get]
func (*CommonServiceEntry) Interrupt ¶ added in v1.0.5
func (entry *CommonServiceEntry) Interrupt(context.Context)
Interrupt common service entry.
func (*CommonServiceEntry) License ¶ added in v1.0.5
func (entry *CommonServiceEntry) License(writer http.ResponseWriter, request *http.Request)
License handler @Summary Get license related application @Id 10 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} LicenseResponse @Router /rk/v1/license [get]
func (*CommonServiceEntry) Logs ¶ added in v1.0.5
func (entry *CommonServiceEntry) Logs(writer http.ResponseWriter, request *http.Request)
Logs handler @Summary List logger related entries @Id 8 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} LogsResponse @Router /rk/v1/logs [get]
func (*CommonServiceEntry) MarshalJSON ¶ added in v1.0.5
func (entry *CommonServiceEntry) MarshalJSON() ([]byte, error)
MarshalJSON Marshal entry.
func (*CommonServiceEntry) Readme ¶ added in v1.0.5
func (entry *CommonServiceEntry) Readme(writer http.ResponseWriter, request *http.Request)
Readme handler @Summary Get README file. @Id 11 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} ReadmeResponse @Router /rk/v1/readme [get]
func (*CommonServiceEntry) String ¶ added in v1.0.5
func (entry *CommonServiceEntry) String() string
String Stringfy entry.
func (*CommonServiceEntry) Sys ¶ added in v1.0.5
func (entry *CommonServiceEntry) Sys(writer http.ResponseWriter, request *http.Request)
Sys handler @Summary Get OS Stat @Id 5 @version 1.0 @Security ApiKeyAuth @Security BasicAuth @Security JWT @produce application/json @Success 200 {object} SysResponse @Router /rk/v1/sys [get]
func (*CommonServiceEntry) UnmarshalJSON ¶ added in v1.0.5
func (entry *CommonServiceEntry) UnmarshalJSON([]byte) error
UnmarshalJSON Not supported.
type CommonServiceEntryOption ¶ added in v1.0.5
type CommonServiceEntryOption func(*CommonServiceEntry)
CommonServiceEntryOption Common service entry option.
func WithEventLoggerEntryCommonService ¶ added in v1.0.5
func WithEventLoggerEntryCommonService(eventLoggerEntry *EventLoggerEntry) CommonServiceEntryOption
WithEventLoggerEntryCommonService Provide rkentry.EventLoggerEntry.
func WithNameCommonService ¶ added in v1.0.5
func WithNameCommonService(name string) CommonServiceEntryOption
WithNameCommonService Provide name.
func WithZapLoggerEntryCommonService ¶ added in v1.0.5
func WithZapLoggerEntryCommonService(zapLoggerEntry *ZapLoggerEntry) CommonServiceEntryOption
WithZapLoggerEntryCommonService Provide rkentry.ZapLoggerEntry.
type ConfigEntry ¶
type ConfigEntry struct { EntryName string `yaml:"entryName" json:"entryName"` EntryType string `yaml:"entryType" json:"entryType"` EntryDescription string `yaml:"entryDescription" json:"entryDescription"` Locale string `yaml:"locale" json:"locale"` Path string `yaml:"path" json:"path"` EnvPrefix string `yaml:"envPrefix" json:"envPrefix"` // contains filtered or unexported fields }
ConfigEntry contains bellow fields. 1: EntryName: Name of entry. 2: EntryType: Type of entry which is ConfigEntryType. 3: EntryDescription: Description of ConfigEntry. 4: Locale: <realm>::<region>::<az>::<domain> 4: Path: File path of config file, could be either relative or absolute path.
If relative path was provided, then current working directory would be joined as prefix.
5: vp: Viper instance, see viper.Viper for details.
func RegisterConfigEntry ¶
func RegisterConfigEntry(opts ...ConfigEntryOption) *ConfigEntry
RegisterConfigEntry create ConfigEntry with options.
func (*ConfigEntry) Bootstrap ¶
func (entry *ConfigEntry) Bootstrap(context.Context)
Bootstrap entry.
func (*ConfigEntry) GetDescription ¶
func (entry *ConfigEntry) GetDescription() string
GetDescription return description of entry.
func (*ConfigEntry) GetLocale ¶
func (entry *ConfigEntry) GetLocale() string
GetLocale returns locale.
func (*ConfigEntry) GetName ¶
func (entry *ConfigEntry) GetName() string
GetName returns name of entry.
func (*ConfigEntry) GetType ¶
func (entry *ConfigEntry) GetType() string
GetType returns type of entry.
func (*ConfigEntry) GetViper ¶
func (entry *ConfigEntry) GetViper() *viper.Viper
GetViper returns viper instance.
func (*ConfigEntry) GetViperAsMap ¶
func (entry *ConfigEntry) GetViperAsMap() map[string]interface{}
GetViperAsMap convert values in viper instance into map.
func (*ConfigEntry) Interrupt ¶
func (entry *ConfigEntry) Interrupt(context.Context)
Interrupt entry.
func (*ConfigEntry) MarshalJSON ¶
func (entry *ConfigEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshal entry.
func (*ConfigEntry) String ¶
func (entry *ConfigEntry) String() string
String convert entry into JSON style string.
func (*ConfigEntry) UnmarshalJSON ¶
func (entry *ConfigEntry) UnmarshalJSON([]byte) error
UnmarshalJSON is not supported.
type ConfigEntryOption ¶
type ConfigEntryOption func(*ConfigEntry)
ConfigEntryOption which used while registering entry from codes.
func WithDescriptionConfig ¶
func WithDescriptionConfig(description string) ConfigEntryOption
WithDescriptionConfig provide description of entry.
func WithEnvPrefixConfig ¶ added in v1.0.5
func WithEnvPrefixConfig(prefix string) ConfigEntryOption
WithEnvPrefixConfig provide environment variable prefix for viper instance.
func WithLocaleConfig ¶
func WithLocaleConfig(locale string) ConfigEntryOption
WithLocaleConfig provide description of entry.
func WithNameConfig ¶
func WithNameConfig(name string) ConfigEntryOption
WithNameConfig provide name of entry.
func WithPathConfig ¶
func WithPathConfig(path string) ConfigEntryOption
WithPathConfig provide path of entry.
func WithViperInstanceConfig ¶
func WithViperInstanceConfig(vp *viper.Viper) ConfigEntryOption
WithViperInstanceConfig provide viper instance of entry.
type ConfigsResponse ¶
type ConfigsResponse struct {
Entries []*ConfigsResponseElement `json:"entries" yaml:"entries"`
}
ConfigsResponse response of /configs
type ConfigsResponseElement ¶ added in v1.0.5
type ConfigsResponseElement struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` EntryMeta map[string]interface{} `json:"entryMeta" yaml:"entryMeta"` Path string `json:"path" yaml:"path"` }
ConfigsResponseElement element for ConfigsResponse
type CpuInfo ¶
type CpuInfo struct { CpuUsedPercentage float64 `json:"cpuUsedPercentage" yaml:"cpuUsedPercentage"` LogicalCoreCount int `json:"logicalCoreCount" yaml:"logicalCoreCount"` PhysicalCoreCount int `json:"physicalCoreCount" yaml:"physicalCoreCount"` VendorId string `json:"vendorId" yaml:"vendorId"` ModelName string `json:"modelName" yaml:"modelName"` Mhz float64 `json:"mhz" yaml:"mhz"` CacheSize int32 `json:"cacheSize" yaml:"cacheSize"` }
CpuInfo defines CPU information read from system
type CredEntry ¶ added in v1.0.1
type CredEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` Store *CredStore `json:"store" yaml:"store"` Retriever Retriever `json:"retriever" yaml:"retriever"` }
CredEntry defines credential entry
func RegisterCredEntry ¶ added in v1.0.1
func RegisterCredEntry(opts ...CredEntryOption) *CredEntry
RegisterCredEntry create cred entry with options.
func (*CredEntry) Bootstrap ¶ added in v1.0.1
Bootstrap iterate retrievers and call Retrieve() for each of them.
func (*CredEntry) GetDescription ¶ added in v1.0.1
GetDescription returns description of entry
func (*CredEntry) MarshalJSON ¶ added in v1.0.1
MarshalJSON marshal entry
func (*CredEntry) UnmarshalJSON ¶ added in v1.0.1
UnmarshalJSON unmarshal entry
type CredEntryOption ¶ added in v1.0.1
type CredEntryOption func(entry *CredEntry)
CredEntryOption Option which used while registering entry from codes.
func WithDescriptionCred ¶ added in v1.0.1
func WithDescriptionCred(description string) CredEntryOption
WithDescriptionCred provide description.
func WithEventLoggerEntryCred ¶ added in v1.0.1
func WithEventLoggerEntryCred(logger *EventLoggerEntry) CredEntryOption
WithEventLoggerEntryCred provide EventLoggerEntry.
func WithNameCred ¶ added in v1.0.1
func WithNameCred(name string) CredEntryOption
WithNameCred provide name.
func WithRetrieverCred ¶ added in v1.0.1
func WithRetrieverCred(retriever Retriever) CredEntryOption
WithRetrieverCred provide Retriever.
func WithZapLoggerEntryCred ¶ added in v1.0.1
func WithZapLoggerEntryCred(logger *ZapLoggerEntry) CredEntryOption
WithZapLoggerEntryCred provide ZapLoggerEntry.
type CredRetrieverConsul ¶ added in v1.0.1
type CredRetrieverConsul struct { Provider string `yaml:"provider" json:"provider"` ZapLoggerEntry *ZapLoggerEntry `yaml:"-" json:"-"` EventLoggerEntry *EventLoggerEntry `yaml:"-" json:"-"` Locale string `yaml:"locale" json:"locale"` Endpoint string `yaml:"endpoint" json:"endpoint"` Datacenter string `yaml:"datacenter" json:"datacenter"` Token string `yaml:"-" json:"-"` BasicAuth string `yaml:"-" json:"-"` Paths []string `yaml:"paths" json:"paths"` }
CredRetrieverConsul is retriever read from Consul 1: Provider: Provider of retriever, required. 2: Locale: <realm>::<region>::<az>::<domain> 3: Endpoint: Endpoint of consul server, http://x.x.x.x or x.x.x.x both acceptable. 4: Datacenter: Consul datacenter. 5: Token: Token for access Consul. 6: BasicAuth: Basic auth for Consul server, like <user:pass>. 7: Paths: Key of value needs to retrieve from Consul server.
func (*CredRetrieverConsul) GetEndpoint ¶ added in v1.0.1
func (retriever *CredRetrieverConsul) GetEndpoint() string
GetEndpoint return endpoint.
func (*CredRetrieverConsul) GetLocale ¶ added in v1.0.1
func (retriever *CredRetrieverConsul) GetLocale() string
GetLocale return locale.
func (*CredRetrieverConsul) GetProvider ¶ added in v1.0.1
func (retriever *CredRetrieverConsul) GetProvider() string
GetProvider return provider of retriever.
func (*CredRetrieverConsul) ListPaths ¶ added in v1.0.1
func (retriever *CredRetrieverConsul) ListPaths() []string
ListPaths return list of paths
type CredRetrieverEtcd ¶ added in v1.0.1
type CredRetrieverEtcd struct { Name string `yaml:"name" json:"name"` Provider string `yaml:"provider" json:"provider"` Locale string `yaml:"locale" json:"locale"` ZapLoggerEntry *ZapLoggerEntry `yaml:"-" json:"-"` EventLoggerEntry *EventLoggerEntry `yaml:"-" json:"-"` Endpoint string `yaml:"endpoint" json:"endpoint"` BasicAuth string `yaml:"-" json:"-"` Paths []string `yaml:"paths" json:"paths"` }
CredRetrieverEtcd is retriever read from ETCD 1: Name: Name of section, required. 2: Provider: Provider of retriever, required. 3: Locale: <realm>::<region>::<az>::<domain> 4: Endpoint: Endpoint of ETCD server, http://x.x.x.x or x.x.x.x both acceptable. 5: BasicAuth: Basic auth for ETCD server, like <user:pass>. 6: Paths: Key of value needs to retrieve from ETCD server.
func (*CredRetrieverEtcd) GetEndpoint ¶ added in v1.0.1
func (retriever *CredRetrieverEtcd) GetEndpoint() string
GetEndpoint returns endpoint.
func (*CredRetrieverEtcd) GetLocale ¶ added in v1.0.1
func (retriever *CredRetrieverEtcd) GetLocale() string
GetLocale returns locale.
func (*CredRetrieverEtcd) GetProvider ¶ added in v1.0.1
func (retriever *CredRetrieverEtcd) GetProvider() string
GetProvider returns provider of retriever.
func (*CredRetrieverEtcd) ListPaths ¶ added in v1.0.1
func (retriever *CredRetrieverEtcd) ListPaths() []string
ListPaths return list of paths
type CredRetrieverLocalFs ¶ added in v1.0.1
type CredRetrieverLocalFs struct { Provider string `yaml:"provider" json:"provider"` Locale string `yaml:"locale" json:"locale"` ZapLoggerEntry *ZapLoggerEntry `yaml:"-" json:"-"` EventLoggerEntry *EventLoggerEntry `yaml:"-" json:"-"` Paths []string `yaml:"paths" json:"paths"` }
CredRetrieverLocalFs is retriever read from local file system 1: Provider: Type of retriever, required. 2: Locale: <realm>::<region>::<az>::<domain> 3: Paths: Key of value need to retrieve from localFs.
func (*CredRetrieverLocalFs) GetEndpoint ¶ added in v1.0.1
func (retriever *CredRetrieverLocalFs) GetEndpoint() string
GetEndpoint returns endpoint.
func (*CredRetrieverLocalFs) GetLocale ¶ added in v1.0.1
func (retriever *CredRetrieverLocalFs) GetLocale() string
GetLocale returns locale.
func (*CredRetrieverLocalFs) GetProvider ¶ added in v1.0.1
func (retriever *CredRetrieverLocalFs) GetProvider() string
GetProvider returns provider of retriever.
func (*CredRetrieverLocalFs) ListPaths ¶ added in v1.0.1
func (retriever *CredRetrieverLocalFs) ListPaths() []string
ListPaths return list of paths
type CredRetrieverRemoteFs ¶ added in v1.0.1
type CredRetrieverRemoteFs struct { Provider string `yaml:"provider" json:"provider"` ZapLoggerEntry *ZapLoggerEntry `yaml:"-" json:"-"` EventLoggerEntry *EventLoggerEntry `yaml:"-" json:"-"` Locale string `yaml:"locale" json:"locale"` Endpoint string `yaml:"endpoint" json:"endpoint"` BasicAuth string `yaml:"-" json:"-"` Paths []string `yaml:"paths" json:"paths"` }
CredRetrieverRemoteFs is retriever read from remote file system 1: Provider: Provider of retriever, required. 2: Locale: <realm>::<region>::<az>::<domain> 3: Endpoint: Endpoint of RemoteFileStore server, http://x.x.x.x or x.x.x.x both acceptable. 4: BasicAuth: Basic auth for RemoteFileStore server, like <user:pass>. 5: Paths: Key of value need to retrieved form remote FS.
func (*CredRetrieverRemoteFs) GetEndpoint ¶ added in v1.0.1
func (retriever *CredRetrieverRemoteFs) GetEndpoint() string
GetEndpoint returns endpoint.
func (*CredRetrieverRemoteFs) GetLocale ¶ added in v1.0.1
func (retriever *CredRetrieverRemoteFs) GetLocale() string
GetLocale returns locale.
func (*CredRetrieverRemoteFs) GetProvider ¶ added in v1.0.1
func (retriever *CredRetrieverRemoteFs) GetProvider() string
GetProvider returns provider of retriever.
func (*CredRetrieverRemoteFs) ListPaths ¶ added in v1.0.1
func (retriever *CredRetrieverRemoteFs) ListPaths() []string
ListPaths return list of paths
type CredStore ¶ added in v1.0.1
CredStore is storage stores credentials retrieve via retriever
func (*CredStore) MarshalJSON ¶ added in v1.0.1
MarshalJSON marshal entry
func (*CredStore) UnmarshalJSON ¶ added in v1.0.1
UnmarshalJSON unmarshal entry
type DepResponse ¶
type DepResponse struct {
GoMod string `json:"goMod" yaml:"goMod"`
}
DepResponse response of /dep
type EntriesResponse ¶
type EntriesResponse struct {
Entries map[string][]*EntriesResponseElement `json:"entries" yaml:"entries"`
}
EntriesResponse response of /entries
type EntriesResponseElement ¶ added in v1.0.5
type EntriesResponseElement struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` EntryMeta Entry `json:"entryMeta" yaml:"entryMeta"` }
EntriesResponseElement element for EntriesResponse
type Entry ¶
type Entry interface { // Bootstrap entry Bootstrap(context.Context) // Interrupt entry // Wait for shutdown signal and wait for draining incomplete procedure Interrupt(context.Context) // GetName returns name of entry GetName() string // GetType returns type of entry GetType() string // GetDescription returns description of entry GetDescription() string // String print entry as string String() string }
Entry interface which must be implemented for bootstrapper to bootstrap
type EntryRegFunc ¶
EntryRegFunc create new entries based on config file which must be implemented
func ListEntryRegFunc ¶
func ListEntryRegFunc() []EntryRegFunc
ListEntryRegFunc list user defined registration functions.
type EventLoggerEntry ¶
type EventLoggerEntry struct { EntryName string `yaml:"entryName" json:"entryName"` EntryType string `yaml:"entryType" json:"entryType"` EntryDescription string `yaml:"entryDescription" json:"entryDescription"` EventFactory *rkquery.EventFactory `yaml:"-" json:"-"` EventHelper *rkquery.EventHelper `yaml:"-" json:"-"` LoggerConfig *zap.Config `yaml:"zapConfig" json:"zapConfig"` LumberjackConfig *lumberjack.Logger `yaml:"lumberjackConfig" json:"lumberjackConfig"` // contains filtered or unexported fields }
EventLoggerEntry contains bellow fields.
func NoopEventLoggerEntry ¶
func NoopEventLoggerEntry() *EventLoggerEntry
NoopEventLoggerEntry create event logger entry with noop event factory. Event factory and event helper will be created with noop zap logger. Since we don't need any log rotation in case of noop, lumberjack config will be nil.
func RegisterEventLoggerEntry ¶
func RegisterEventLoggerEntry(opts ...EventLoggerEntryOption) *EventLoggerEntry
RegisterEventLoggerEntry create event logger entry with options.
func (*EventLoggerEntry) AddEntryLabelToLokiSyncer ¶ added in v1.0.8
func (entry *EventLoggerEntry) AddEntryLabelToLokiSyncer(e Entry)
AddEntryLabelToLokiSyncer add entry name entry type into loki syncer
func (*EventLoggerEntry) AddLabelToLokiSyncer ¶ added in v1.0.8
func (entry *EventLoggerEntry) AddLabelToLokiSyncer(k, v string)
AddLabelToLokiSyncer add key value pair as label into loki syncer
func (*EventLoggerEntry) Bootstrap ¶
func (entry *EventLoggerEntry) Bootstrap(ctx context.Context)
Bootstrap entry.
func (*EventLoggerEntry) GetDescription ¶
func (entry *EventLoggerEntry) GetDescription() string
GetDescription return description of entry.
func (*EventLoggerEntry) GetEventFactory ¶
func (entry *EventLoggerEntry) GetEventFactory() *rkquery.EventFactory
GetEventFactory return event factory, refer to rkquery.EventFactory.
func (*EventLoggerEntry) GetEventHelper ¶
func (entry *EventLoggerEntry) GetEventHelper() *rkquery.EventHelper
GetEventHelper return event helperm refer to rkquery.EventHelper.
func (*EventLoggerEntry) GetLumberjackConfig ¶
func (entry *EventLoggerEntry) GetLumberjackConfig() *lumberjack.Logger
GetLumberjackConfig return lumberjack config, refer to lumberjack.Logger.
func (*EventLoggerEntry) GetName ¶
func (entry *EventLoggerEntry) GetName() string
GetName returns name of entry.
func (*EventLoggerEntry) GetType ¶
func (entry *EventLoggerEntry) GetType() string
GetType returns type of entry.
func (*EventLoggerEntry) Interrupt ¶
func (entry *EventLoggerEntry) Interrupt(ctx context.Context)
Interrupt entry.
func (*EventLoggerEntry) MarshalJSON ¶
func (entry *EventLoggerEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshal entry.
func (*EventLoggerEntry) String ¶
func (entry *EventLoggerEntry) String() string
String convert entry into JSON style string.
func (*EventLoggerEntry) Sync ¶ added in v1.0.11
func (entry *EventLoggerEntry) Sync()
Sync underlying logger
func (*EventLoggerEntry) UnmarshalJSON ¶
func (entry *EventLoggerEntry) UnmarshalJSON([]byte) error
UnmarshalJSON not supported.
type EventLoggerEntryOption ¶
type EventLoggerEntryOption func(*EventLoggerEntry)
EventLoggerEntryOption Option which used while registering entry from codes.
func WithBaseLoggerEvent ¶ added in v1.0.11
func WithBaseLoggerEvent(base *zap.Logger) EventLoggerEntryOption
WithBaseLoggerEvent provide zap.Logger
func WithDescriptionEvent ¶
func WithDescriptionEvent(description string) EventLoggerEntryOption
WithDescriptionEvent provide description of entry.
func WithEventFactoryEvent ¶
func WithEventFactoryEvent(fac *rkquery.EventFactory) EventLoggerEntryOption
WithEventFactoryEvent provide event factory of entry which refers to rkquery.EventFactory.
func WithLokiSyncerEvent ¶ added in v1.0.8
func WithLokiSyncerEvent(loki *rklogger.LokiSyncer) EventLoggerEntryOption
WithLokiSyncerEvent provide rklogger.LokiSyncer
func WithNameEvent ¶
func WithNameEvent(name string) EventLoggerEntryOption
WithNameEvent provide name of entry.
type GcResponse ¶
type GcResponse struct { MemStatBeforeGc *MemInfo `json:"memStatBeforeGc" yaml:"memStatBeforeGc"` MemStatAfterGc *MemInfo `json:"memStatAfterGc" yaml:"memStatAfterGc"` }
GcResponse response of /gc Returns memory stats of GC before and after.
type GitResponse ¶
type GitResponse struct { Package string `json:"package" yaml:"package"` Url string `json:"url" yaml:"url"` Branch string `yaml:"branch" json:"branch"` Tag string `yaml:"tag" json:"tag"` CommitId string `yaml:"commitId" json:"commitId"` CommitIdAbbr string `yaml:"commitIdAbbr" json:"commitIdAbbr"` CommitDate string `yaml:"commitDate" json:"commitDate"` CommitSub string `yaml:"commitSub" json:"commitSub"` CommitterName string `yaml:"committerName" json:"committerName"` CommitterEmail string `yaml:"committerEmail" json:"committerEmail"` }
GitResponse response of /git
type GoEnvInfo ¶
type GoEnvInfo struct { GOOS string `json:"goos" yaml:"goos"` GOArch string `json:"goArch" yaml:"goArch"` StartTime string `json:"startTime" json:"startTime"` UpTimeSec int64 `json:"upTimeSec" json:"upTimeSec"` UpTimeStr string `json:"upTimeStr" json:"upTimeStr"` RoutinesCount int `json:"routinesCount" yaml:"routinesCount"` Version string `json:"version" yaml:"version"` }
GoEnvInfo defines go processor information
type GwErrorMappingResponse ¶
type GwErrorMappingResponse struct {
Mapping map[int32]*GwErrorMappingResponseElement `json:"mapping" yaml:"mapping"`
}
GwErrorMappingResponse response of /gwErrorMapping
type GwErrorMappingResponseElement ¶ added in v1.0.5
type GwErrorMappingResponseElement struct { GrpcCode int32 `json:"grpcCode" yaml:"grpcCode"` GrpcText string `json:"grpcText" yaml:"grpcText"` RestCode int32 `json:"restCode" yaml:"restCode"` RestText string `json:"restText" yaml:"restText"` }
GwErrorMappingResponseElement element for GwErrorMappingResponse
type HealthyResponse ¶
type HealthyResponse struct {
Healthy bool `json:"healthy" yaml:"healthy"`
}
HealthyResponse response of /healthy
type LicenseResponse ¶
type LicenseResponse struct {
License string `json:"license" yaml:"license"`
}
LicenseResponse response of /license
type LogsResponse ¶
type LogsResponse struct {
Entries map[string][]*LogsResponseElement `json:"entries" yaml:"entries"`
}
LogsResponse response of /logs.
type LogsResponseElement ¶ added in v1.0.5
type LogsResponseElement struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` EntryMeta Entry `json:"entryMeta" yaml:"entryMeta"` OutputPaths []string `json:"outputPaths" yaml:"outputPaths"` ErrorOutputPaths []string `json:"errorOutputPaths" yaml:"errorOutputPaths"` }
LogsResponseElement element for LogsResponse
type MemInfo ¶
type MemInfo struct { MemUsedPercentage float64 `json:"memUsedPercentage" yaml:"memUsedPercentage"` MemUsedMb uint64 `json:"memUsedMb" yaml:"memUsedMb"` MemAllocByte uint64 `json:"memAllocByte" yaml:"memAllocByte"` SysAllocByte uint64 `json:"sysAllocByte" yaml:"sysAllocByte"` LastGcTimestamp string `json:"lastGcTimestamp" yaml:"lastGcTimestamp"` GcCount uint32 `json:"gcCountTotal" yaml:"gcCountTotal"` ForceGcCount uint32 `json:"forceGcCount" yaml:"forceGcCount"` }
MemInfo memory stats of current running process
type NetInfo ¶
type NetInfo struct {
NetInterface []*NetInterface `json:"netInterface" yaml:"netInterface"`
}
NetInfo defines network interface information about local machine
type NetInterface ¶
type NetInterface struct { // e.g., "en0", "lo0", "eth0.100" Name string `json:"name" yaml:"name"` // maximum transmission unit Mtu int `json:"mtu" yaml:"mtu"` // IEEE MAC-48, EUI-48 and EUI-64 form HardwareAddr string `json:"hardwareAddr" yaml:"hardwareAddr"` // e.g., FlagUp, FlagLoopback, FlagMulticast Flags []string `json:"flags" yaml:"flags"` // A list of unicast interface addresses for a specific interface. Addrs []string `json:"addrs" yaml:"addrs"` // A list of multicast, joined group addresses for a specific interface MulticastAddrs []string `json:"multicastAddrs" yaml:"multicastAddrs"` }
NetInterface describes network interface
type OsInfo ¶
type OsInfo struct { Os string `json:"os" yaml:"os"` Arch string `json:"arch" yaml:"arch"` Hostname string `json:"hostname" yaml:"hostname"` }
OsInfo defines OS information
type ProcessInfo ¶
type ProcessInfo struct { AppName string `json:"appName" yaml:"appName"` Version string `json:"version" yaml:"version"` Description string `json:"description" yaml:"description"` Keywords []string `json:"keywords" yaml:"keywords"` HomeUrl string `json:"homeUrl" yaml:"homeUrl"` IconUrl string `json:"iconUrl" yaml:"iconUrl"` DocsUrl []string `json:"docsUrl" json:"docsUrl"` Maintainers []string `json:"maintainers" json:"maintainers"` UID string `json:"uid" json:"uid"` GID string `json:"gid" json:"gid"` Username string `json:"username" json:"username"` StartTime string `json:"startTime" json:"startTime"` UpTimeSec int64 `json:"upTimeSec" json:"upTimeSec"` UpTimeStr string `json:"upTimeStr" json:"upTimeStr"` Region string `json:"region" json:"region"` AZ string `json:"az" json:"az"` Realm string `json:"realm" json:"realm"` Domain string `json:"domain" json:"domain"` }
ProcessInfo process information for a running application. 1: AppName - Name of current application set by user 2: Version - Version of application set by user 3: Description - Description of application set by user 4: Keywords - Keywords of application set by user 5: HomeUrl - Home URL of application set by user 6: IconUrl - Icon URL of application set by user 7: DocsUrl; - Document URL list of application set by user 8: Maintainers - Maintainers of application set by user 9: UID - user id which runs process 10: GID - group id which runs process 11: Username - username which runs process 12: StartTime - application start time 13: UpTimeSec - application up time in seconds 14: UpTimeStr - application up time in string 15: Region - region where process runs 16: AZ - availability zone where process runs 17: Realm - realm where process runs 18: Domain - domain where process runs
func NewProcessInfo ¶
func NewProcessInfo() *ProcessInfo
NewProcessInfo creates a new ProcessInfo instance
type PromEntry ¶ added in v1.0.5
type PromEntry struct { Pusher *PushGatewayPusher `json:"-" yaml:"-"` EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"-" yaml:"-"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` Port uint64 `json:"port" yaml:"port"` Path string `json:"path" yaml:"path"` Registry *prometheus.Registry `json:"-" yaml:"-"` Registerer prometheus.Registerer `json:"-" yaml:"-"` Gatherer prometheus.Gatherer `json:"-" yaml:"-"` }
PromEntry Prometheus entry which implements rkentry.Entry.
func RegisterPromEntry ¶ added in v1.0.5
func RegisterPromEntry(opts ...PromEntryOption) *PromEntry
RegisterPromEntry Create a prom entry with options and add prom entry to rkentry.GlobalAppCtx
func RegisterPromEntryWithConfig ¶ added in v1.0.5
func RegisterPromEntryWithConfig(config *BootConfigProm, name string, port uint64, zap *ZapLoggerEntry, event *EventLoggerEntry, registry *prometheus.Registry) *PromEntry
RegisterPromEntryWithConfig create PromEntry with config
func (*PromEntry) GetDescription ¶ added in v1.0.5
GetDescription Get description of entry
func (*PromEntry) MarshalJSON ¶ added in v1.0.5
MarshalJSON Marshal entry
func (*PromEntry) RegisterCollectors ¶ added in v1.0.5
func (entry *PromEntry) RegisterCollectors(collectors ...prometheus.Collector) error
RegisterCollectors Register collectors in default registry
func (*PromEntry) UnmarshalJSON ¶ added in v1.0.5
UnmarshalJSON Unmarshal entry
type PromEntryOption ¶ added in v1.0.5
type PromEntryOption func(*PromEntry)
PromEntryOption Prom entry option used while initializing prom entry via code
func WithEventLoggerEntryProm ¶ added in v1.0.5
func WithEventLoggerEntryProm(eventLoggerEntry *EventLoggerEntry) PromEntryOption
WithEventLoggerEntryProm rkentry.EventLoggerEntry of prom entry
func WithNameProm ¶ added in v1.0.5
func WithNameProm(name string) PromEntryOption
WithNameProm Name of prom entry
func WithPathProm ¶ added in v1.0.5
func WithPathProm(path string) PromEntryOption
WithPathProm Path of prom entry
func WithPortProm ¶ added in v1.0.5
func WithPortProm(port uint64) PromEntryOption
WithPortProm Port of prom entry
func WithPromRegistryProm ¶ added in v1.0.5
func WithPromRegistryProm(registry *prometheus.Registry) PromEntryOption
WithPromRegistryProm Provide a new prometheus registry
func WithPusherProm ¶ added in v1.0.5
func WithPusherProm(pusher *PushGatewayPusher) PromEntryOption
WithPusherProm PushGateway of prom entry
func WithZapLoggerEntryProm ¶ added in v1.0.5
func WithZapLoggerEntryProm(zapLoggerEntry *ZapLoggerEntry) PromEntryOption
WithZapLoggerEntryProm rkentry.ZapLoggerEntry of prom entry
type PushGatewayPusher ¶ added in v1.0.5
type PushGatewayPusher struct { ZapLoggerEntry *ZapLoggerEntry `json:"zapLoggerEntry" yaml:"zapLoggerEntry"` EventLoggerEntry *EventLoggerEntry `json:"eventLoggerEntry" yaml:"eventLoggerEntry"` CertStore *CertStore `json:"certStore" yaml:"certStore"` Pusher *push.Pusher `json:"-" yaml:"-"` IntervalMs time.Duration `json:"intervalMs" yaml:"intervalMs"` RemoteAddress string `json:"remoteAddress" yaml:"remoteAddress"` JobName string `json:"jobName" yaml:"jobName"` Running *atomic.Bool `json:"running" yaml:"running"` Credential string `json:"-" yaml:"-"` // contains filtered or unexported fields }
PushGatewayPusher is a pusher which contains bellow instances
func NewPushGatewayPusher ¶ added in v1.0.5
func NewPushGatewayPusher(opts ...PushGatewayPusherOption) (*PushGatewayPusher, error)
NewPushGatewayPusher creates a new pushGateway periodic job instances with intervalMS, remote URL and job name 1: intervalMS: should be a positive integer 2: url: should be a non empty and valid url 3: jabName: should be a non empty string 4: cred: credential of basic auth format as user:pass 5: logger: a logger with stdout output would be assigned if nil
func (*PushGatewayPusher) GetPusher ¶ added in v1.0.5
func (pub *PushGatewayPusher) GetPusher() *push.Pusher
GetPusher simply call pusher.Gatherer() We add prefix "Add" before the function name since the original one is a little bit confusing. Thread safe
func (*PushGatewayPusher) IsRunning ¶ added in v1.0.5
func (pub *PushGatewayPusher) IsRunning() bool
IsRunning validate whether periodic job is running or not
func (*PushGatewayPusher) SetGatherer ¶ added in v1.0.5
func (pub *PushGatewayPusher) SetGatherer(gatherer prometheus.Gatherer)
SetGatherer sets gatherer of prometheus
func (*PushGatewayPusher) Start ¶ added in v1.0.5
func (pub *PushGatewayPusher) Start()
Start starts a periodic job
func (*PushGatewayPusher) Stop ¶ added in v1.0.5
func (pub *PushGatewayPusher) Stop()
Stop stops periodic job
func (*PushGatewayPusher) String ¶ added in v1.0.5
func (pub *PushGatewayPusher) String() string
String returns string value of PushGatewayPusher
type PushGatewayPusherOption ¶ added in v1.0.5
type PushGatewayPusherOption func(*PushGatewayPusher)
PushGatewayPusherOption is used while initializing push gateway pusher via code
func WithBasicAuthPusher ¶ added in v1.0.5
func WithBasicAuthPusher(cred string) PushGatewayPusherOption
WithBasicAuthPusher provides basic auth of pushgateway
func WithCertStorePusher ¶ added in v1.0.5
func WithCertStorePusher(certStore *CertStore) PushGatewayPusherOption
WithCertStorePusher provides EventLoggerEntry
func WithEventLoggerEntryPusher ¶ added in v1.0.5
func WithEventLoggerEntryPusher(eventLoggerEntry *EventLoggerEntry) PushGatewayPusherOption
WithEventLoggerEntryPusher provides EventLoggerEntry
func WithIntervalMSPusher ¶ added in v1.0.5
func WithIntervalMSPusher(intervalMs time.Duration) PushGatewayPusherOption
WithIntervalMSPusher provides interval in milliseconds
func WithJobNamePusher ¶ added in v1.0.5
func WithJobNamePusher(jobName string) PushGatewayPusherOption
WithJobNamePusher provides job name
func WithRemoteAddressPusher ¶ added in v1.0.5
func WithRemoteAddressPusher(remoteAddress string) PushGatewayPusherOption
WithRemoteAddressPusher provides remote address of pushgateway
func WithZapLoggerEntryPusher ¶ added in v1.0.5
func WithZapLoggerEntryPusher(zapLoggerEntry *ZapLoggerEntry) PushGatewayPusherOption
WithZapLoggerEntryPusher provides ZapLoggerEntry
type ReadmeResponse ¶
type ReadmeResponse struct {
Readme string `json:"readme" yaml:"readme"`
}
ReadmeResponse response of /readme
type ReqMetricsRK ¶
type ReqMetricsRK struct { RestPath string `json:"restPath" yaml:"restPath"` RestMethod string `json:"restMethod" yaml:"restMethod"` GrpcService string `json:"grpcService" yaml:"grpcService"` GrpcMethod string `json:"grpcMethod" yaml:"grpcMethod"` ElapsedNanoP50 float64 `json:"elapsedNanoP50" yaml:"elapsedNanoP50"` ElapsedNanoP90 float64 `json:"elapsedNanoP90" yaml:"elapsedNanoP90"` ElapsedNanoP99 float64 `json:"elapsedNanoP99" yaml:"elapsedNanoP99"` ElapsedNanoP999 float64 `json:"elapsedNanoP999" yaml:"elapsedNanoP999"` Count uint64 `json:"count" yaml:"count"` ResCode []*ResCodeRK `json:"resCode" yaml:"resCode"` }
ReqMetricsRK request metrics to struct from prometheus collector 1: RestPath - API path of restful service 2: RestMethod - API method of restful service 3: GrpcService - Grpc service 4: GrpcMethod - Grpc method 5: ElapsedNanoP50 - quantile of p50 with time elapsed 6: ElapsedNanoP90 - quantile of p90 with time elapsed 7: ElapsedNanoP99 - quantile of p99 with time elapsed 8: ElapsedNanoP999 - quantile of p999 with time elapsed 9: Count - total number of requests 10: ResCode - response code labels
func NewPromMetricsInfo ¶
func NewPromMetricsInfo(sumCollector *prometheus.SummaryVec) []*ReqMetricsRK
NewPromMetricsInfo parse metrics in prometheus client into rk style metrics for common service.
type ReqResponse ¶
type ReqResponse struct {
Metrics []*ReqMetricsRK `json:"metrics" yaml:"metrics"`
}
ReqResponse response of /req
type ResCodeRK ¶
type ResCodeRK struct { ResCode string `json:"resCode" yaml:"resCode"` Count uint64 `json:"count" yaml:"count"` }
ResCodeRK defines labels and request count
type Retriever ¶ added in v1.0.1
type Retriever interface { // Read credential files into byte array and store it into CredStore. Retrieve(context.Context) *CredStore // Return provider of retriever. GetProvider() string // Return list of paths ListPaths() []string // Return endpoint. GetEndpoint() string // Return locale. GetLocale() string }
Retriever is an interface for retrieving credentials.
type RkMetaEntry ¶
type RkMetaEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"entryDescription" yaml:"entryDescription"` RkMeta *rkcommon.RkMeta `json:"meta" yaml:"meta"` }
RkMetaEntry contains bellow fields.
func RegisterRkMetaEntry ¶
func RegisterRkMetaEntry(opts ...RkMetaEntryOption) *RkMetaEntry
RegisterRkMetaEntry register Entry with options. This function is used while creating entry from code instead of config file. We will override RKEntry fields if value is nil or empty if necessary.
Generally, we recommend call rkctx.GlobalAppCtx.AddEntry() inside this function, however, we recommend to register RKEntry, ZapLoggerEntry, EventLoggerEntry with function of rkctx.RegisterBasicEntriesWithConfig which will register these entries to global context automatically.
func (*RkMetaEntry) Bootstrap ¶
func (entry *RkMetaEntry) Bootstrap(context.Context)
Bootstrap No op.
func (*RkMetaEntry) GetDescription ¶
func (entry *RkMetaEntry) GetDescription() string
GetDescription return description of entry.
func (*RkMetaEntry) GetName ¶
func (entry *RkMetaEntry) GetName() string
GetName return name of entry.
func (*RkMetaEntry) GetType ¶
func (entry *RkMetaEntry) GetType() string
GetType return type of entry.
func (*RkMetaEntry) Interrupt ¶
func (entry *RkMetaEntry) Interrupt(context.Context)
Interrupt No op.
func (*RkMetaEntry) String ¶
func (entry *RkMetaEntry) String() string
String return string of entry.
type RkMetaEntryOption ¶
type RkMetaEntryOption func(*RkMetaEntry)
RkMetaEntryOption Option which used while registering entry from codes.
func WithMetaRkMeta ¶
func WithMetaRkMeta(meta *rkcommon.RkMeta) RkMetaEntryOption
WithMetaRkMeta provide git information.
type StaticFileHandlerEntry ¶ added in v1.0.5
type StaticFileHandlerEntry struct { EntryName string `yaml:"entryName" json:"entryName"` EntryType string `yaml:"entryType" json:"entryType"` EntryDescription string `yaml:"-" json:"-"` Path string `yaml:"path" json:"path"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` Fs http.FileSystem `yaml:"-" json:"-"` Template *template.Template `json:"-" yaml:"-"` }
StaticFileHandlerEntry Static file handler entry supports web UI for downloading static files.
func RegisterStaticFileHandlerEntry ¶ added in v1.0.5
func RegisterStaticFileHandlerEntry(opts ...StaticFileHandlerEntryOption) *StaticFileHandlerEntry
RegisterStaticFileHandlerEntry Create new static file handler entry with options.
func RegisterStaticFileHandlerEntryWithConfig ¶ added in v1.0.5
func RegisterStaticFileHandlerEntryWithConfig(config *BootConfigStaticHandler, name string, zap *ZapLoggerEntry, event *EventLoggerEntry) *StaticFileHandlerEntry
RegisterStaticFileHandlerEntryWithConfig Create new static file handler entry with config
func (*StaticFileHandlerEntry) Bootstrap ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) Bootstrap(context.Context)
Bootstrap entry.
func (*StaticFileHandlerEntry) GetDescription ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) GetDescription() string
GetDescription Get description of entry.
func (*StaticFileHandlerEntry) GetFileHandler ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) GetFileHandler() http.HandlerFunc
GetFileHandler handles requests sent from user.
func (*StaticFileHandlerEntry) GetName ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) GetName() string
GetName Get name of entry.
func (*StaticFileHandlerEntry) GetType ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) GetType() string
GetType Get entry type.
func (*StaticFileHandlerEntry) Interrupt ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) Interrupt(context.Context)
Interrupt entry.
func (*StaticFileHandlerEntry) MarshalJSON ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) MarshalJSON() ([]byte, error)
MarshalJSON Marshal entry.
func (*StaticFileHandlerEntry) String ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) String() string
String Stringfy entry.
func (*StaticFileHandlerEntry) UnmarshalJSON ¶ added in v1.0.5
func (entry *StaticFileHandlerEntry) UnmarshalJSON([]byte) error
UnmarshalJSON Not supported.
type StaticFileHandlerEntryOption ¶ added in v1.0.5
type StaticFileHandlerEntryOption func(*StaticFileHandlerEntry)
StaticFileHandlerEntryOption StaticFileHandlerEntry option.
func WithEventLoggerEntryStatic ¶ added in v1.0.5
func WithEventLoggerEntryStatic(eventLoggerEntry *EventLoggerEntry) StaticFileHandlerEntryOption
WithEventLoggerEntryCommonService Provide EventLoggerEntry.
func WithFileSystemStatic ¶ added in v1.0.5
func WithFileSystemStatic(fs http.FileSystem) StaticFileHandlerEntryOption
WithFileSystemStatic Provide file system implementation.
func WithNameStatic ¶ added in v1.0.5
func WithNameStatic(name string) StaticFileHandlerEntryOption
WithNameStatic Provide name.
func WithPathStatic ¶ added in v1.0.5
func WithPathStatic(path string) StaticFileHandlerEntryOption
WithEventLoggerEntryCommonService Provide path.
func WithZapLoggerEntryStatic ¶ added in v1.0.5
func WithZapLoggerEntryStatic(zapLoggerEntry *ZapLoggerEntry) StaticFileHandlerEntryOption
WithZapLoggerEntryCommonService Provide ZapLoggerEntry.
type SwEntry ¶ added in v1.0.5
type SwEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` JsonPath string `json:"jsonPath" yaml:"jsonPath"` Path string `json:"path" yaml:"path"` Headers map[string]string `json:"-" yaml:"-"` Port uint64 `json:"port" yaml:"port"` EnableCommonService bool `json:"-" yaml:"-"` AssetsFilePath string `json:"-" yaml:"-"` }
SwEntry implements rkentry.Entry interface. 1: Path: Swagger path accessible from restful API. 2: JsonPath: The path of where swagger JSON file was located. 3: Headers: The headers that would added into each API response. 4: Port: The port where swagger would listen to. 5: EnableCommonService: Enable common service in swagger.
func RegisterSwEntry ¶ added in v1.0.5
func RegisterSwEntryWithConfig ¶ added in v1.0.5
func RegisterSwEntryWithConfig(config *BootConfigSw, name string, port uint64, zap *ZapLoggerEntry, event *EventLoggerEntry, commonServiceEnabled bool) *SwEntry
func (*SwEntry) AssetsFileHandler ¶ added in v1.0.5
func (entry *SwEntry) AssetsFileHandler() http.HandlerFunc
AssetsFileHandler Handler for swagger assets files.
func (*SwEntry) ConfigFileHandler ¶ added in v1.0.5
func (entry *SwEntry) ConfigFileHandler() http.HandlerFunc
ConfigFileHandler handler for swagger config files.
func (*SwEntry) GetDescription ¶ added in v1.0.5
func (*SwEntry) MarshalJSON ¶ added in v1.0.5
MarshalJSON Marshal entry
func (*SwEntry) UnmarshalJSON ¶ added in v1.0.5
UnmarshalJSON Unmarshal entry
type SwOption ¶ added in v1.0.5
type SwOption func(*SwEntry)
SwOption Swagger entry option.
func WithEnableCommonServiceSw ¶ added in v1.0.5
WithEnableCommonServiceSw Provide enable common service option.
func WithEventLoggerEntrySw ¶ added in v1.0.5
func WithEventLoggerEntrySw(eventLoggerEntry *EventLoggerEntry) SwOption
WithEventLoggerEntrySw Provide rkentry.EventLoggerEntry.
func WithHeadersSw ¶ added in v1.0.5
WithHeadersSw Provide headers.
func WithJsonPathSw ¶ added in v1.0.5
WithJsonPathSw Provide JsonPath.
func WithZapLoggerEntrySw ¶ added in v1.0.5
func WithZapLoggerEntrySw(zapLoggerEntry *ZapLoggerEntry) SwOption
WithZapLoggerEntrySw Provide rkentry.ZapLoggerEntry.
type SysResponse ¶
type SysResponse struct { CpuInfo *CpuInfo `json:"cpuInfo" yaml:"cpuInfo"` MemInfo *MemInfo `json:"memInfo" yaml:"memInfo"` NetInfo *NetInfo `json:"netInfo" yaml:"netInfo"` OsInfo *OsInfo `json:"osInfo" yaml:"osInfo"` GoEnvInfo *GoEnvInfo `json:"goEnvInfo" yaml:"goEnvInfo"` }
SysResponse response of /sys
type TvEntry ¶ added in v1.0.5
type TvEntry struct { EntryName string `json:"entryName" yaml:"entryName"` EntryType string `json:"entryType" yaml:"entryType"` EntryDescription string `json:"-" yaml:"-"` ZapLoggerEntry *ZapLoggerEntry `json:"-" yaml:"-"` EventLoggerEntry *EventLoggerEntry `json:"-" yaml:"-"` Template *template.Template `json:"-" yaml:"-"` AssetsFilePath string `json:"-" yaml:"-"` BasePath string `json:"-" yaml:"-"` }
TvEntry RK TV entry supports web UI for application & process information. 1: EntryName: Name of entry. 2: EntryType: Type of entry. 2: EntryDescription: Description of entry. 3: ZapLoggerEntry: ZapLoggerEntry used for logging. 4: EventLoggerEntry: EventLoggerEntry used for logging. 5: Template: GO template for rendering web UI.
func RegisterTvEntry ¶ added in v1.0.5
func RegisterTvEntry(opts ...TvEntryOption) *TvEntry
RegisterTvEntry Create new TV entry with options.
func RegisterTvEntryWithConfig ¶ added in v1.0.5
func RegisterTvEntryWithConfig(config *BootConfigTv, name string, zap *ZapLoggerEntry, event *EventLoggerEntry) *TvEntry
func (*TvEntry) AssetsFileHandler ¶ added in v1.0.5
func (entry *TvEntry) AssetsFileHandler() http.HandlerFunc
AssetsFileHandler Handler which returns js, css, images and html files for TV web UI.
func (*TvEntry) ExecuteTemplate ¶ added in v1.0.5
func (entry *TvEntry) ExecuteTemplate(templateName string, data interface{}, logger *zap.Logger) *bytes.Buffer
Execute go template into buffer.
func (*TvEntry) GetDescription ¶ added in v1.0.5
GetDescription Get description of entry.
func (*TvEntry) MarshalJSON ¶ added in v1.0.5
MarshalJSON Marshal entry
func (*TvEntry) UnmarshalJSON ¶ added in v1.0.5
UnmarshalJSON Not supported.
type TvEntryOption ¶ added in v1.0.5
type TvEntryOption func(entry *TvEntry)
TvEntryOption TV entry option.
func WithEventLoggerEntryTv ¶ added in v1.0.5
func WithEventLoggerEntryTv(eventLoggerEntry *EventLoggerEntry) TvEntryOption
WithEventLoggerEntryTv Provide rkentry.EventLoggerEntry.
func WithNameTv ¶ added in v1.0.5
func WithNameTv(name string) TvEntryOption
WithNameTv Provide name.
func WithZapLoggerEntryTv ¶ added in v1.0.5
func WithZapLoggerEntryTv(zapLoggerEntry *ZapLoggerEntry) TvEntryOption
WithZapLoggerEntryTv Provide rkentry.ZapLoggerEntry.
type ZapLoggerEntry ¶
type ZapLoggerEntry struct { EntryName string `yaml:"entryName" json:"entryName"` EntryType string `yaml:"entryType" json:"entryType"` EntryDescription string `yaml:"entryDescription" json:"entryDescription"` Logger *zap.Logger `yaml:"-" json:"-"` LoggerConfig *zap.Config `yaml:"zapConfig" json:"zapConfig"` LumberjackConfig *lumberjack.Logger `yaml:"lumberjackConfig" json:"lumberjackConfig"` // contains filtered or unexported fields }
ZapLoggerEntry contains bellow fields.
func NoopZapLoggerEntry ¶
func NoopZapLoggerEntry() *ZapLoggerEntry
NoopZapLoggerEntry create zap logger entry with noop. Since we don't need any log rotation in case of noop, lumberjack config and logger config will be nil.
func RegisterZapLoggerEntry ¶
func RegisterZapLoggerEntry(opts ...ZapLoggerEntryOption) *ZapLoggerEntry
RegisterZapLoggerEntry create event logger entry with options.
func (*ZapLoggerEntry) AddEntryLabelToLokiSyncer ¶ added in v1.0.8
func (entry *ZapLoggerEntry) AddEntryLabelToLokiSyncer(e Entry)
AddEntryLabelToLokiSyncer add entry name entry type into loki syncer
func (*ZapLoggerEntry) AddLabelToLokiSyncer ¶ added in v1.0.8
func (entry *ZapLoggerEntry) AddLabelToLokiSyncer(k, v string)
AddLabelToLokiSyncer add key value pair as label into loki syncer
func (*ZapLoggerEntry) Bootstrap ¶
func (entry *ZapLoggerEntry) Bootstrap(ctx context.Context)
Bootstrap entry.
func (*ZapLoggerEntry) GetDescription ¶
func (entry *ZapLoggerEntry) GetDescription() string
GetDescription returns description of entry.
func (*ZapLoggerEntry) GetLogger ¶
func (entry *ZapLoggerEntry) GetLogger() *zap.Logger
GetLogger returns zap logger, refer to zap.Logger.
func (*ZapLoggerEntry) GetLoggerConfig ¶
func (entry *ZapLoggerEntry) GetLoggerConfig() *zap.Config
GetLoggerConfig returns zap logger config, refer to zap.Config.
func (*ZapLoggerEntry) GetLumberjackConfig ¶
func (entry *ZapLoggerEntry) GetLumberjackConfig() *lumberjack.Logger
GetLumberjackConfig returns lumberjack config, refer to lumberjack.Logger.
func (*ZapLoggerEntry) GetName ¶
func (entry *ZapLoggerEntry) GetName() string
GetName returns name of entry.
func (*ZapLoggerEntry) GetType ¶
func (entry *ZapLoggerEntry) GetType() string
GetType returns type of entry.
func (*ZapLoggerEntry) Interrupt ¶
func (entry *ZapLoggerEntry) Interrupt(ctx context.Context)
Interrupt entry.
func (*ZapLoggerEntry) MarshalJSON ¶
func (entry *ZapLoggerEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshal entry.
func (*ZapLoggerEntry) String ¶
func (entry *ZapLoggerEntry) String() string
String convert entry into JSON style string.
func (*ZapLoggerEntry) Sync ¶ added in v1.0.11
func (entry *ZapLoggerEntry) Sync()
Sync underlying logger
func (*ZapLoggerEntry) UnmarshalJSON ¶
func (entry *ZapLoggerEntry) UnmarshalJSON([]byte) error
UnmarshalJSON not supported.
type ZapLoggerEntryOption ¶
type ZapLoggerEntryOption func(*ZapLoggerEntry)
ZapLoggerEntryOption Option which used while registering entry from codes.
func WithDescriptionZap ¶
func WithDescriptionZap(description string) ZapLoggerEntryOption
WithDescriptionZap provide description of entry.
func WithLoggerZap ¶
func WithLoggerZap(logger *zap.Logger, loggerConfig *zap.Config, lumberjackConfig *lumberjack.Logger) ZapLoggerEntryOption
WithLoggerZap provide zap logger related entity of entry.
func WithLokiSyncerZap ¶ added in v1.0.8
func WithLokiSyncerZap(loki *rklogger.LokiSyncer) ZapLoggerEntryOption
WithLokiSyncerZap provide rklogger.LokiSyncer
func WithNameZap ¶
func WithNameZap(name string) ZapLoggerEntryOption
WithNameZap provide name of entry.
Source Files ¶
- app_info_entry.go
- cert_entry.go
- common_service_entry.go
- config_entry.go
- context.go
- cpu_info.go
- cred_entry.go
- entry.go
- event_logger_entry.go
- go_env_info.go
- mem_info.go
- model.go
- net_info.go
- os_info.go
- pkged.go
- process_info.go
- prom_entry.go
- prom_metrics_info.go
- rk_meta_entry.go
- static_file_handler_entry.go
- sw_entry.go
- tv_entry.go
- zap_logger_entry.go