This commit is contained in:
Anatoly Antonov 2026-05-18 02:09:07 +09:00
parent c4f355a32e
commit 7a8d5d13fa
72 changed files with 4510 additions and 4104 deletions

View file

@ -1,6 +1,6 @@
// Code generated by ogen, DO NOT EDIT.
package gsn
package rest
import (
"context"
@ -8,16 +8,15 @@ import (
"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.26.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"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/metric"
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
"go.opentelemetry.io/otel/trace"
)
type codeRecorder struct {
@ -30,6 +29,10 @@ func (c *codeRecorder) WriteHeader(status int) {
c.ResponseWriter.WriteHeader(status)
}
func (c *codeRecorder) Unwrap() http.ResponseWriter {
return c.ResponseWriter
}
// handlePerformPredictionRequest handles performPrediction operation.
//
// Perform prediction.
@ -43,6 +46,8 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
semconv.HTTPRequestMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/api/v1/prediction"),
}
// Add attributes from config.
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
// Start a span for this request.
ctx, span := s.cfg.Tracer.Start(r.Context(), PerformPredictionOperation,
@ -86,7 +91,7 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
// max redirects exceeded), in which case status MUST be set to Error.
code := statusWriter.status
if code >= 100 && code < 500 {
if code < 100 || code >= 500 {
span.SetStatus(codes.Error, stage)
}
@ -115,7 +120,9 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
return
}
var response *PredictionResult
var rawBody []byte
var response *PredictionResponse
if m := s.cfg.Middleware; m != nil {
mreq := middleware.Request{
Context: ctx,
@ -123,6 +130,7 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
OperationSummary: "Perform prediction",
OperationID: "performPrediction",
Body: nil,
RawBody: rawBody,
Params: middleware.Parameters{
{
Name: "launch_latitude",
@ -164,22 +172,6 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
Name: "stop_datetime",
In: "query",
}: params.StopDatetime,
{
Name: "ascent_curve",
In: "query",
}: params.AscentCurve,
{
Name: "descent_curve",
In: "query",
}: params.DescentCurve,
{
Name: "interpolate",
In: "query",
}: params.Interpolate,
{
Name: "format",
In: "query",
}: params.Format,
{
Name: "dataset",
In: "query",
@ -191,7 +183,7 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
type (
Request = struct{}
Params = PerformPredictionParams
Response = *PredictionResult
Response = *PredictionResponse
)
response, err = middleware.HookMiddleware[
Request,
@ -248,6 +240,8 @@ func (s *Server) handleReadinessCheckRequest(args [0]string, argsEscaped bool, w
semconv.HTTPRequestMethodKey.String("GET"),
semconv.HTTPRouteKey.String("/ready"),
}
// Add attributes from config.
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
// Start a span for this request.
ctx, span := s.cfg.Tracer.Start(r.Context(), ReadinessCheckOperation,
@ -291,7 +285,7 @@ func (s *Server) handleReadinessCheckRequest(args [0]string, argsEscaped bool, w
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
// max redirects exceeded), in which case status MUST be set to Error.
code := statusWriter.status
if code >= 100 && code < 500 {
if code < 100 || code >= 500 {
span.SetStatus(codes.Error, stage)
}
@ -306,6 +300,8 @@ func (s *Server) handleReadinessCheckRequest(args [0]string, argsEscaped bool, w
err error
)
var rawBody []byte
var response *ReadinessResponse
if m := s.cfg.Middleware; m != nil {
mreq := middleware.Request{
@ -314,6 +310,7 @@ func (s *Server) handleReadinessCheckRequest(args [0]string, argsEscaped bool, w
OperationSummary: "Readiness check",
OperationID: "readinessCheck",
Body: nil,
RawBody: rawBody,
Params: middleware.Parameters{},
Raw: r,
}