monitor

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 19 Imported by: 1

README

monitor

Documentation

Index

Constants

View Source
const (
	KeyTracingID = "tracingID"
)

Variables

View Source
var InitTracingService = func(logger *zap.Logger) *TracingRequestService {
	sr := &TracingRequestService{
		Log: logger,
	}

	settings := viper.Sub("tracing")
	if settings == nil {
		logger.Warn("tracing module loaded, but disabled.")
		return sr
	}

	settings.Unmarshal(sr)

	logger.Info("tracing service is enabled.")
	if (sr.Request || sr.Resp) && sr.Console {
		c := InitConsoleTracingService(sr.Log)
		TracingAdaptor.Subscripter("console", c.LogBody)
	}

	return sr
}

Functions

func EnabledTracing added in v0.0.4

func EnabledTracing()

func LogOutbound added in v0.1.10

func LogOutbound(rt http.RoundTripper) http.RoundTripper

func SubscribeMonitor added in v0.0.2

func SubscribeMonitor(logger *zap.Logger, item MonitorService)

func ToByte added in v0.0.4

func ToByte(obj any) []byte

Types

type AppSettings

type AppSettings struct {
	Appname string
	Version string
	Details bool
}

type ConsoleTracing added in v0.0.4

type ConsoleTracing struct {
	Log *zap.Logger
}

func InitConsoleTracingService added in v0.0.4

func InitConsoleTracingService(log *zap.Logger) *ConsoleTracing

func (*ConsoleTracing) LogBody added in v0.0.4

func (tr *ConsoleTracing) LogBody(req *TracingDetails) error

type GinTracingService added in v0.1.15

type GinTracingService struct {
	Service *TracingRequestService
}

func (*GinTracingService) LogfullRequestDetails added in v0.1.15

func (tr *GinTracingService) LogfullRequestDetails(c *gin.Context)

func (*GinTracingService) OnEngineInited added in v0.1.15

func (tr *GinTracingService) OnEngineInited(r *gin.Engine) error

func (*GinTracingService) Priority added in v0.1.15

func (tr *GinTracingService) Priority() int

type MonitorService

type MonitorService interface {
	ReportTracing(tr *TracingDetails) error
	ReportError(core.ErrorReport) error
	ReportScheduleJob(req *schedule.JobHistory) error
}

type RespLogging added in v0.0.4

type RespLogging struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (RespLogging) Write added in v0.0.4

func (w RespLogging) Write(b []byte) (int, error)

type TracingDetails added in v0.0.4

type TracingDetails struct {
	Optionname string
	Uri        string
	Method     string
	Body       any
	Durtion    time.Duration
	Status     int
	TargetID   uint
	Resp       any
	ClientIP   string
	UserAgent  string
	Device     string
	Tenant     string
	Operator   string
}

type TracingRequestService added in v0.0.4

type TracingRequestService struct {
	Log      *zap.Logger
	Console  bool
	Request  bool
	Resp     bool
	Included []string
	Excluded []string
}

func (*TracingRequestService) ShouldLogReq added in v0.1.14

func (tr *TracingRequestService) ShouldLogReq(ctx context.Context, uri string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL