localtracing

package module
v0.0.0-...-32dd021 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: LGPL-2.1 Imports: 18 Imported by: 0

README

单体应用的链路运行情况记录

静态页面添加

路由

go install github.com/go-bindata/go-bindata/...@latest


go-bindata -o=./views.go -pkg=localtracing ./views/... 


go get github.com/elazarl/go-bindata-assetfs

模板

使用go-bindata之后原来的模板函数不能直接使用了

需要包装一下先从godata从获取值然后execute

需要注意的是这里动态创建template的名字需要和模板里的名字对应上否则不能解析

示例

examples中的示例

实时日志查看: http://localhost:8080/view?file=log.txt

在对应的log.txt新建日志记录查看效果

Documentation

Overview

Code generated for package localtracing by go-bindata DO NOT EDIT. (@generated) sources: views/assets/css/tailwindcss.2.2.9.min.css views/assets/js/vue.2.6.min.js views/assets/js/websocket.js views/index.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func ExecuteBinTemplate

func ExecuteBinTemplate(wr io.Writer, name, path string, data interface{}) error

bindatatemplate 方法

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewMonitor

func NewMonitor(fn HTTPHandler)

挂载路由

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SetLogLevel

func SetLogLevel(level int)

func TracingMiddleware

func TracingMiddleware(path string) gin.HandlerFunc

链路调用的logger记录工具

Types

type AssetFunc

type AssetFunc func(string) ([]byte, error)

bindata-template包装

type HTTPHandler

type HTTPHandler interface {
	Context(val interface{}) (*http.Request, http.ResponseWriter, error) // 获取request与response
	Get(string, func(interface{}))                                       // 用于挂载路由
	Static(string, http.FileSystem)                                      // 挂载静态资源目录
}

type MonitorServer

type MonitorServer struct {
	// contains filtered or unexported fields
}

func (*MonitorServer) LogData

func (s *MonitorServer) LogData(ctx interface{})

ws: 日志实时记录

func (*MonitorServer) LogList

func (s *MonitorServer) LogList(ctx interface{})

日志文件列表

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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