diff --git a/internal/api/oas_client_gen.go b/internal/api/oas_client_gen.go index 91ea82e..4d74b0e 100644 --- a/internal/api/oas_client_gen.go +++ b/internal/api/oas_client_gen.go @@ -12,6 +12,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" + semconv "go.opentelemetry.io/otel/semconv/v1.19.0" "go.opentelemetry.io/otel/trace" "github.com/ogen-go/ogen/conv" @@ -80,6 +81,8 @@ func (c *Client) GetRoot(ctx context.Context) error { func (c *Client) sendGetRoot(ctx context.Context) (res *GetRootOK, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("getRoot"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/"), } // Run stopwatch. @@ -151,6 +154,8 @@ func (c *Client) GetWallpaper(ctx context.Context, params GetWallpaperParams) (G func (c *Client) sendGetWallpaper(ctx context.Context, params GetWallpaperParams) (res GetWallpaperRes, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("getWallpaper"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/wallpapers/{id}"), } // Run stopwatch. @@ -243,6 +248,8 @@ func (c *Client) GetWallpaperTags(ctx context.Context) (GetWallpaperTagsRes, err func (c *Client) sendGetWallpaperTags(ctx context.Context) (res GetWallpaperTagsRes, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("getWallpaperTags"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/wallpapers/tags"), } // Run stopwatch. @@ -314,6 +321,8 @@ func (c *Client) GetWallpapers(ctx context.Context, params GetWallpapersParams) func (c *Client) sendGetWallpapers(ctx context.Context, params GetWallpapersParams) (res GetWallpapersRes, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("getWallpapers"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/wallpapers"), } // Run stopwatch. @@ -463,6 +472,8 @@ func (c *Client) GetWallpapersByTag(ctx context.Context, params GetWallpapersByT func (c *Client) sendGetWallpapersByTag(ctx context.Context, params GetWallpapersByTagParams) (res GetWallpapersByTagRes, err error) { otelAttrs := []attribute.KeyValue{ otelogen.OperationID("getWallpapersByTag"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/wallpapers/tags/{tag}"), } // Run stopwatch. diff --git a/internal/api/oas_handlers_gen.go b/internal/api/oas_handlers_gen.go index 9916819..2db25a4 100644 --- a/internal/api/oas_handlers_gen.go +++ b/internal/api/oas_handlers_gen.go @@ -7,12 +7,14 @@ import ( "net/http" "time" + "github.com/go-faster/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" semconv "go.opentelemetry.io/otel/semconv/v1.19.0" "go.opentelemetry.io/otel/trace" + ht "github.com/ogen-go/ogen/http" "github.com/ogen-go/ogen/middleware" "github.com/ogen-go/ogen/ogenerrors" "github.com/ogen-go/ogen/otelogen" @@ -95,7 +97,9 @@ func (s *Server) handleGetRootRequest(args [0]string, argsEscaped bool, w http.R if err := encodeGetRootResponse(response, w, span); err != nil { recordError("EncodeResponse", err) - s.cfg.ErrorHandler(ctx, w, r, err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } return } } @@ -198,7 +202,9 @@ func (s *Server) handleGetWallpaperRequest(args [1]string, argsEscaped bool, w h if err := encodeGetWallpaperResponse(response, w, span); err != nil { recordError("EncodeResponse", err) - s.cfg.ErrorHandler(ctx, w, r, err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } return } } @@ -282,7 +288,9 @@ func (s *Server) handleGetWallpaperTagsRequest(args [0]string, argsEscaped bool, if err := encodeGetWallpaperTagsResponse(response, w, span); err != nil { recordError("EncodeResponse", err) - s.cfg.ErrorHandler(ctx, w, r, err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } return } } @@ -397,7 +405,9 @@ func (s *Server) handleGetWallpapersRequest(args [0]string, argsEscaped bool, w if err := encodeGetWallpapersResponse(response, w, span); err != nil { recordError("EncodeResponse", err) - s.cfg.ErrorHandler(ctx, w, r, err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } return } } @@ -504,7 +514,9 @@ func (s *Server) handleGetWallpapersByTagRequest(args [1]string, argsEscaped boo if err := encodeGetWallpapersByTagResponse(response, w, span); err != nil { recordError("EncodeResponse", err) - s.cfg.ErrorHandler(ctx, w, r, err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } return } } diff --git a/internal/api/oas_response_encoders_gen.go b/internal/api/oas_response_encoders_gen.go index ee52523..86e186d 100644 --- a/internal/api/oas_response_encoders_gen.go +++ b/internal/api/oas_response_encoders_gen.go @@ -30,6 +30,7 @@ func encodeGetWallpaperResponse(response GetWallpaperRes, w http.ResponseWriter, if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } + return nil case *GetWallpaperNotFound: @@ -55,6 +56,7 @@ func encodeGetWallpaperTagsResponse(response GetWallpaperTagsRes, w http.Respons if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } + return nil case *GetWallpaperTagsNotFound: @@ -80,6 +82,7 @@ func encodeGetWallpapersResponse(response GetWallpapersRes, w http.ResponseWrite if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } + return nil case *GetWallpapersNotFound: @@ -105,6 +108,7 @@ func encodeGetWallpapersByTagResponse(response GetWallpapersByTagRes, w http.Res if _, err := e.WriteTo(w); err != nil { return errors.Wrap(err, "write") } + return nil case *GetWallpapersByTagNotFound: diff --git a/internal/api/oas_schemas_gen.go b/internal/api/oas_schemas_gen.go index 972cb8f..646d58a 100644 --- a/internal/api/oas_schemas_gen.go +++ b/internal/api/oas_schemas_gen.go @@ -46,6 +46,13 @@ const ( GetWallpapersPrev1 GetWallpapersPrev = 1 ) +// AllValues returns all GetWallpapersPrev values. +func (GetWallpapersPrev) AllValues() []GetWallpapersPrev { + return []GetWallpapersPrev{ + GetWallpapersPrev1, + } +} + type ID string // Ref: #/components/schemas/Links