Proxy observability updates
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build and Publish / release (push) Successful in 2m51s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build and Publish / release (push) Successful in 2m51s
				
			This commit is contained in:
		| @@ -8,6 +8,7 @@ import ( | ||||
|  | ||||
| 	"gitea.libretechconsulting.com/rmcguire/go-app/pkg/otel" | ||||
| 	"github.com/go-resty/resty/v2" | ||||
| 	"github.com/rs/zerolog/log" | ||||
| 	"go.opentelemetry.io/otel/attribute" | ||||
| 	"go.opentelemetry.io/otel/codes" | ||||
|  | ||||
| @@ -43,12 +44,18 @@ func (awn *AWNProvider) ProxyReq(ctx context.Context, update *weather.WeatherUpd | ||||
| 		Get(awnURL) | ||||
| 	if err != nil { | ||||
| 		span.RecordError(err) | ||||
| 		span.SetAttributes( | ||||
| 			attribute.String("query", resp.Request.QueryParam.Encode()), | ||||
| 			attribute.String("body", string(resp.Body())), | ||||
| 		) | ||||
| 		span.SetStatus(codes.Error, err.Error()) | ||||
| 		log.Err(err).Any("query", resp.Request.PathParams). | ||||
| 			Int("statusCode", resp.StatusCode()). | ||||
| 			Msg("awn proxy failed") | ||||
| 	} | ||||
|  | ||||
| 	span.SetAttributes( | ||||
| 		attribute.Int("statusCode", resp.StatusCode()), | ||||
| 		attribute.String("body", string(resp.Body())), | ||||
| 	) | ||||
|  | ||||
| 	return err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user