rename ExporterWithConfig to be less confusing and closer to otel

This commit is contained in:
2024-05-17 15:36:35 +02:00
parent 3c51f5575b
commit d4dc790298
2 changed files with 18 additions and 14 deletions

View File

@ -11,7 +11,7 @@ import (
"git.ma-al.com/gora_filip/observer/pkg/tracer"
"git.ma-al.com/gora_filip/pkg/attr/layer_attr"
"git.ma-al.com/gora_filip/pkg/exporters"
"git.ma-al.com/gora_filip/pkg/fiber_tracing"
tracing "git.ma-al.com/gora_filip/pkg/fiber_tracing"
"git.ma-al.com/gora_filip/pkg/level"
"github.com/gofiber/fiber/v2"
)
@ -31,17 +31,21 @@ func main() {
if err == nil {
exps = append(exps, gelfExp)
}
jaegerExp, err := exporters.OtlpHTTPExporter()
if err == nil {
exps = append(exps, jaegerExp)
}
main.Use(fiber_tracing.NewMiddleware(fiber_tracing.Config{
main.Use(tracing.NewMiddleware(tracing.Config{
AppName: "example",
Version: "0.0.0",
ServiceProvider: "maal",
Exporters: exps,
}))
defer fiber_tracing.ShutdownTracer()
defer tracing.ShutdownTracer()
main.Get("/", func(c *fiber.Ctx) error {
ctx, span := fiber_tracing.FStart(c, layer_attr.Handler{
ctx, span := tracing.FStart(c, layer_attr.Handler{
Level: level.DEBUG,
}.AsOpts())
defer span.End()