feat: Update project structure and configuration files

This commit is contained in:
rogeecn
2025-03-24 09:29:38 +08:00
parent ea15a51556
commit 8de43c2861
159 changed files with 498 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package tracing
import (
"github.com/sirupsen/logrus"
"go.ipao.vip/atom/container"
"go.ipao.vip/atom/opt"
)
const DefaultPrefix = "Tracing"
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(DefaultPrefix),
},
}
}
// 自定义的 Logger 实现
type jaegerLogrus struct {
logger *logrus.Logger
}
func (l *jaegerLogrus) Error(msg string) {
l.logger.Error(msg)
}
func (l *jaegerLogrus) Infof(msg string, args ...interface{}) {
l.logger.Infof(msg, args...)
}
type Config struct {
Name string
Reporter_LocalAgentHostPort string //: "127.0.0.1:6831",
Reporter_CollectorEndpoint string //: "http://127.0.0.1:14268/api/traces",
}
func (c *Config) format() {
if c.Reporter_LocalAgentHostPort == "" {
c.Reporter_LocalAgentHostPort = "127.0.0.1:6831"
}
if c.Reporter_CollectorEndpoint == "" {
c.Reporter_CollectorEndpoint = "http://127.0.0.1:14268/api/traces"
}
if c.Name == "" {
c.Name = "default"
}
}