service

package
v0.0.0-...-312ee99 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StrMaxSize = 1024
)

Service constants

Variables

View Source
var (
	ErrMaxSize = errors.New("maximum size of 1024 bytes exceeded")

	ErrStrValue = errors.New("maximum size of 1024 bytes exceeded")
)

Service errors

Functions

func GetTracer

func GetTracer(serviceName string) opentracing.Tracer

█ █ █ █ █ 获取单例对象的方法,引用传递返回 █ █ █ █ █ serviceName 可以把多行trace串起来的唯一标识——如考勤审查批次ID

func TraceByZipkin

func TraceByZipkin(serviceName string, SpanID string, BizCode string, ParentID string, ClassName string, MethodName string, LocationDesc string)

█ █ █ █ █ 链路跟踪主方法 █ █ █ █ █

Types

type GipkinService

type GipkinService struct {
}

ArithmeticService implement Service interface

func (GipkinService) Concat

func (s GipkinService) Concat(a, b string) (string, error)

func (GipkinService) Diff

func (s GipkinService) Diff(a, b string) (string, error)

func (GipkinService) DoTrace

func (s GipkinService) DoTrace(KeyID string, SpanID string, TraceID string, BizCode string, ParentID string, Level string, ClassName string, MethodName string, LocationDesc string) (string, error)

/██████████████████████████████████████████████████████████████████ http://127.0.0.1:21212/op/DoTrace/gauge202112301916/RabbitMQ_To_Worker/12345678-415d-40e1-987a-17a24f83f47c/ATSINSPECT/AtsTaskService/Debug/HRLink.BackendService.AtsInspectService/AtsInspectExecute/持久化完成

func (GipkinService) HealthCheck

func (s GipkinService) HealthCheck() bool

HealthCheck implement Service method 用于检查服务的健康状态,这里仅仅返回true。

type Service

type Service interface {
	/// <param name="SiteCode"></param>
	/// <param name="SpanID">链路ID:如:SpanIDEnum.RabbitMQ_To_Worker</param>
	/// <param name="TraceID">批次ID或会话ID, 从头到尾要唯一</param>
	/// <param name="BizCode">业务代码 如:  TaskSchedulerBizCodeEnum.ATSINSPECT</param>
	/// <param name="ParentID">上游服务</param>
	/// <param name="Level">级别</param>
	/// <param name="ClassName">类名 如:this.GetType().FullName</param>
	/// <param name="MethodName">方法名 如:MethodInfo.GetCurrentMethod().Name</param>
	/// <param name="LocationDesc">描述信息【可空】</param>
	DoTrace(KeyID string, SpanID string, TraceID string, BizCode string, ParentID string, Level string, ClassName string, MethodName string, LocationDesc string) (string, error)

	// Concat a and b
	Concat(a, b string) (string, error)

	// a,b pkg string value
	Diff(a, b string) (string, error)

	// HealthCheck check service health status
	HealthCheck() bool
}

Service Define a service interface

type ServiceMiddleware

type ServiceMiddleware func(Service) Service

ServiceMiddleware define service middleware

type Task_link_trace struct {
	//gorm.Model
	Key_id        string    `gorm:"size:36"`
	Span_id       string    `gorm:"size:50"`
	Trace_id      string    `gorm:"size:50"`
	Biz_code      string    `gorm:"size:50"`
	Parent_id     string    `gorm:"size:50"`
	Operate_dt    time.Time `gorm:"type:datetime"`
	Operate_by    string    `gorm:"size:50"`
	Level         string    `gorm:"size:10"`
	Node_id       string    `gorm:"size:50"`
	Thread_id     int       `gorm:"int"`
	Class_name    string    `gorm:"size:100"`
	Method_name   string    `gorm:"size:100"`
	Location_desc string    `gorm:"size:200"`
}

func BuildEntity

func BuildEntity(KeyID string, SpanID string, TraceID string, BizCode string, ParentID string, CreateDatetime time.Time, Level string, ClassName string, MethodName string, LocationDesc string) *Task_link_trace
func (this *Task_link_trace) TableName() string

Jump to

Keyboard shortcuts

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