| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -9,6 +9,7 @@ import (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"git.blauwelle.com/go/crate/log/logsdk"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"git.blauwelle.com/go/crate/log/logsdk/logjson"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"go.opentelemetry.io/otel"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"go.opentelemetry.io/otel/attribute"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"go.opentelemetry.io/otel/codes"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -19,7 +20,8 @@ import (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func New(opts ...Option) *Processor {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					cfg := newConfig(opts...)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return &Processor{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						bufferPool: cfg.bytesBufferPool,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						bufferPool:  cfg.bytesBufferPool,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defaultSpan: cfg.defaultSpan,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -27,11 +29,18 @@ var _ logsdk.EntryProcessor = &Processor{}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// Processor 用于把日志和 opentelemetry 对接
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				type Processor struct {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					bufferPool logjson.BytesBufferPool
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					bufferPool  logjson.BytesBufferPool
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defaultSpan bool
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (processor *Processor) Process(ctx context.Context, entry logsdk.ReadonlyEntry) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					span := trace.SpanFromContext(ctx)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !span.IsRecording() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if processor.defaultSpan {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							ctx, span = otel.Tracer("git.blauwelle.com/go/crate/logotel").Start(ctx, "default") //nolint:ineffassign,staticcheck,wastedassign
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							defer span.End()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !span.IsRecording() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |