fix invalid span name
This commit is contained in:
		@@ -155,7 +155,9 @@ func ShutdownTracer() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Handler(fc *fiber.Ctx) (context.Context, trace.Span) {
 | 
			
		||||
	simpleCtx, span := fiberOpentelemetry.Tracer.Start(fc.UserContext(), fc.OriginalURL())
 | 
			
		||||
	spanName := fmt.Sprint(fc.OriginalURL())
 | 
			
		||||
	simpleCtx, span := fiberOpentelemetry.Tracer.Start(fc.UserContext(), spanName)
 | 
			
		||||
 | 
			
		||||
	fc.SetUserContext(simpleCtx)
 | 
			
		||||
 | 
			
		||||
	_, file, line, _ := runtime.Caller(1)
 | 
			
		||||
@@ -168,14 +170,13 @@ func Handler(fc *fiber.Ctx) (context.Context, trace.Span) {
 | 
			
		||||
	return simpleCtx, span
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Service(c context.Context, serviceName string, spanName string) (context.Context, trace.Span) {
 | 
			
		||||
func Service(c context.Context, spanName string) (context.Context, trace.Span) {
 | 
			
		||||
	simpleCtx, span := fiberOpentelemetry.Tracer.Start(c, spanName)
 | 
			
		||||
	var attribs []attribute.KeyValue
 | 
			
		||||
 | 
			
		||||
	_, file, line, _ := runtime.Caller(1)
 | 
			
		||||
	attribs = append(
 | 
			
		||||
		attribs,
 | 
			
		||||
		attribute.String("service.name", serviceName),
 | 
			
		||||
		attribute.String("service.layer", "service"),
 | 
			
		||||
		attribute.String("file", file),
 | 
			
		||||
		attribute.String("line", fmt.Sprintf("%d", line)),
 | 
			
		||||
@@ -186,13 +187,12 @@ func Service(c context.Context, serviceName string, spanName string) (context.Co
 | 
			
		||||
	return simpleCtx, span
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Repository(c context.Context, repositoryName string, spanName string) (context.Context, trace.Span) {
 | 
			
		||||
func Repository(c context.Context, spanName string) (context.Context, trace.Span) {
 | 
			
		||||
	ctx2, span := fiberOpentelemetry.Tracer.Start(c, spanName)
 | 
			
		||||
	var attribs []attribute.KeyValue
 | 
			
		||||
 | 
			
		||||
	_, file, line, _ := runtime.Caller(1)
 | 
			
		||||
	attribs = append(attribs,
 | 
			
		||||
		attribute.String("service.repository", repositoryName),
 | 
			
		||||
		attribute.String("file", file),
 | 
			
		||||
		attribute.String("line", fmt.Sprintf("%d", line)),
 | 
			
		||||
	)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user