dogapm

package module
v0.0.0-...-a3e0587 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 43 Imported by: 11

Documentation

Index

Constants

View Source
const (
	MetricTypeHTTP = "http"
	MetricTypeGRPC = "grpc"

	LibraryTypeMySQL = "mysql"
	LibraryTypeRedis = "redis"
)

Variables

View Source
var DBUtils = &dbUtils{}
View Source
var EndPoint = &endPoint{
	stop: make(chan struct{}, 1),
}
View Source
var HttpStatus = httpStatus{}
View Source
var Infra = &infra{}
View Source
var Logger = &logger{}
View Source
var (
	MetricsReg = newCustomMetricRegistry(map[string]string{
		"host": internal.BuildInfo.Hostname(),
		"app":  internal.BuildInfo.AppName(),
	})
)
View Source
var RedisLimiter = &redisLimit{}
View Source
var SQLParser = &sqlParser{}
View Source
var Tracer trace.Tracer

Functions

This section is empty.

Types

type AutoPProfOpt

type AutoPProfOpt struct {
	EnableCPU       bool
	EnableMem       bool
	EnableGoroutine bool
}

type Conn

type Conn struct {
	driver.Conn
	// contains filtered or unexported fields
}

func (*Conn) BeginTx

func (conn *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

BeginTx starts and returns a new transaction. If the context is canceled by the user the sql package will call Tx.Rollback before discarding and closing the connection.

This must check opts.Isolation to determine if there is a set isolation level. If the driver does not support a non-default level and one is set or if there is a non-default isolation level that is not supported, an error must be returned.

This must also check opts.ReadOnly to determine if the read-only value is true to either set the read-only transaction property if supported or return an error if it is not supported.

func (*Conn) ExecContext

func (conn *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)

nolint:dupl

func (*Conn) PrepareContext

func (conn *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

func (*Conn) QueryContext

func (conn *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)

nolint:dupl

type Driver

type Driver struct {
	driver.Driver
	// contains filtered or unexported fields
}

func (*Driver) Open

func (drv *Driver) Open(name string) (driver.Conn, error)

type DriverTx

type DriverTx struct {
	driver.Tx
	// contains filtered or unexported fields
}

func (*DriverTx) Commit

func (tx *DriverTx) Commit() error

func (*DriverTx) Rollback

func (tx *DriverTx) Rollback() error

type GrpcClient

type GrpcClient struct {
	*grpc.ClientConn
}

func NewGrpcClient

func NewGrpcClient(addr, server string) *GrpcClient

type GrpcServer

type GrpcServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

func NewGrpcServer

func NewGrpcServer(addr string) *GrpcServer

func (*GrpcServer) Close

func (s *GrpcServer) Close()

func (*GrpcServer) Start

func (s *GrpcServer) Start()

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewHTTPServer

func NewHTTPServer(addr string) *HTTPServer

func (*HTTPServer) Close

func (s *HTTPServer) Close()

func (*HTTPServer) Handle

func (s *HTTPServer) Handle(pattern string, handler http.Handler)

func (*HTTPServer) HandleFunc

func (s *HTTPServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*HTTPServer) Start

func (s *HTTPServer) Start()

func (*HTTPServer) Stop

func (s *HTTPServer) Stop()

type Hooks

type Hooks struct {
	Before  func(ctx context.Context, query string, args ...any) (context.Context, error)
	After   func(ctx context.Context, query string, args ...any) (context.Context, error)
	OnError func(ctx context.Context, err error, query string, args ...any) error
}

type InfraOption

type InfraOption func(i *infra)

func WithAutoPProf

func WithAutoPProf(autoPProfOpts *AutoPProfOpt, opts ...holmes.Option) InfraOption

func WithEnableAPM

func WithEnableAPM(otelEndpoint, logPathPrefix string, maxLogCnt uint) InfraOption

func WithMetric

func WithMetric(collectors ...prometheus.Collector) InfraOption

func WithMySQL

func WithMySQL(url string) InfraOption

func WithRedis

func WithRedis(url string) InfraOption

type Status

type Status struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Body    any    `json:"body"`
}

type Stmt

type Stmt struct {
	driver.Stmt
	// contains filtered or unexported fields
}

func (*Stmt) ExecContext

func (stmt *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)

nolint:dupl

func (*Stmt) QueryContext

func (stmt *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)

nolint:dupl

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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