From 24b4f9e87ec407f31a1b3c439dbc0324ca61e292 Mon Sep 17 00:00:00 2001 From: tdakkota Date: Wed, 4 Dec 2024 06:07:41 +0300 Subject: [PATCH] chore: commit generated files --- internal/lokiapi/oas_client_gen.go | 14 +-- internal/lokiapi/oas_handlers_gen.go | 56 +++--------- internal/otelbotapi/oas_client_gen.go | 6 +- internal/otelbotapi/oas_handlers_gen.go | 24 ++--- internal/promapi/oas_client_gen.go | 26 +++--- internal/promapi/oas_handlers_gen.go | 104 ++++++---------------- internal/pyroscopeapi/oas_client_gen.go | 10 +-- internal/pyroscopeapi/oas_handlers_gen.go | 40 +++------ internal/sentryapi/oas_client_gen.go | 4 +- internal/sentryapi/oas_handlers_gen.go | 16 +--- internal/tempoapi/oas_client_gen.go | 16 ++-- internal/tempoapi/oas_handlers_gen.go | 64 ++++--------- 12 files changed, 114 insertions(+), 266 deletions(-) diff --git a/internal/lokiapi/oas_client_gen.go b/internal/lokiapi/oas_client_gen.go index 69798758..454e40d0 100644 --- a/internal/lokiapi/oas_client_gen.go +++ b/internal/lokiapi/oas_client_gen.go @@ -142,7 +142,7 @@ func (c *Client) sendIndexStats(ctx context.Context, params IndexStatsParams) (r defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -272,7 +272,7 @@ func (c *Client) sendLabelValues(ctx context.Context, params LabelValuesParams) defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -445,7 +445,7 @@ func (c *Client) sendLabels(ctx context.Context, params LabelsParams) (res *Labe defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -581,7 +581,7 @@ func (c *Client) sendPush(ctx context.Context, request PushReq) (res *PushNoCont defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -656,7 +656,7 @@ func (c *Client) sendQuery(ctx context.Context, params QueryParams) (res *QueryR defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -800,7 +800,7 @@ func (c *Client) sendQueryRange(ctx context.Context, params QueryRangeParams) (r defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1004,7 +1004,7 @@ func (c *Client) sendSeries(ctx context.Context, params SeriesParams) (res *Maps defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/lokiapi/oas_handlers_gen.go b/internal/lokiapi/oas_handlers_gen.go index a4302d6e..910ab91e 100644 --- a/internal/lokiapi/oas_handlers_gen.go +++ b/internal/lokiapi/oas_handlers_gen.go @@ -74,7 +74,7 @@ func (s *Server) handleIndexStatsRequest(args [0]string, argsEscaped bool, w htt s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -85,12 +85,8 @@ func (s *Server) handleIndexStatsRequest(args [0]string, argsEscaped bool, w htt // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -235,7 +231,7 @@ func (s *Server) handleLabelValuesRequest(args [1]string, argsEscaped bool, w ht s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -246,12 +242,8 @@ func (s *Server) handleLabelValuesRequest(args [1]string, argsEscaped bool, w ht // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -405,7 +397,7 @@ func (s *Server) handleLabelsRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -416,12 +408,8 @@ func (s *Server) handleLabelsRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -566,7 +554,7 @@ func (s *Server) handlePushRequest(args [0]string, argsEscaped bool, w http.Resp s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -577,12 +565,8 @@ func (s *Server) handlePushRequest(args [0]string, argsEscaped bool, w http.Resp // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -719,7 +703,7 @@ func (s *Server) handleQueryRequest(args [0]string, argsEscaped bool, w http.Res s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -730,12 +714,8 @@ func (s *Server) handleQueryRequest(args [0]string, argsEscaped bool, w http.Res // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -884,7 +864,7 @@ func (s *Server) handleQueryRangeRequest(args [0]string, argsEscaped bool, w htt s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -895,12 +875,8 @@ func (s *Server) handleQueryRangeRequest(args [0]string, argsEscaped bool, w htt // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1061,7 +1037,7 @@ func (s *Server) handleSeriesRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1072,12 +1048,8 @@ func (s *Server) handleSeriesRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } diff --git a/internal/otelbotapi/oas_client_gen.go b/internal/otelbotapi/oas_client_gen.go index 8374633b..3495260f 100644 --- a/internal/otelbotapi/oas_client_gen.go +++ b/internal/otelbotapi/oas_client_gen.go @@ -117,7 +117,7 @@ func (c *Client) sendGetStatus(ctx context.Context) (res *GetStatusOK, err error defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -220,7 +220,7 @@ func (c *Client) sendPing(ctx context.Context) (res *PingNoContent, err error) { defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -292,7 +292,7 @@ func (c *Client) sendSubmitReport(ctx context.Context, request *SubmitReportReq) defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/otelbotapi/oas_handlers_gen.go b/internal/otelbotapi/oas_handlers_gen.go index 891e2ad5..8b56f8f1 100644 --- a/internal/otelbotapi/oas_handlers_gen.go +++ b/internal/otelbotapi/oas_handlers_gen.go @@ -74,7 +74,7 @@ func (s *Server) handleGetStatusRequest(args [0]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -85,12 +85,8 @@ func (s *Server) handleGetStatusRequest(args [0]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -256,7 +252,7 @@ func (s *Server) handlePingRequest(args [0]string, argsEscaped bool, w http.Resp s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -267,12 +263,8 @@ func (s *Server) handlePingRequest(args [0]string, argsEscaped bool, w http.Resp // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -390,7 +382,7 @@ func (s *Server) handleSubmitReportRequest(args [0]string, argsEscaped bool, w h s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -401,12 +393,8 @@ func (s *Server) handleSubmitReportRequest(args [0]string, argsEscaped bool, w h // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } diff --git a/internal/promapi/oas_client_gen.go b/internal/promapi/oas_client_gen.go index 5590ac36..c290e7f3 100644 --- a/internal/promapi/oas_client_gen.go +++ b/internal/promapi/oas_client_gen.go @@ -165,7 +165,7 @@ func (c *Client) sendGetLabelValues(ctx context.Context, params GetLabelValuesPa defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -341,7 +341,7 @@ func (c *Client) sendGetLabels(ctx context.Context, params GetLabelsParams) (res defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -498,7 +498,7 @@ func (c *Client) sendGetMetadata(ctx context.Context, params GetMetadataParams) defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -625,7 +625,7 @@ func (c *Client) sendGetQuery(ctx context.Context, params GetQueryParams) (res * defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -769,7 +769,7 @@ func (c *Client) sendGetQueryExemplars(ctx context.Context, params GetQueryExemp defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -893,7 +893,7 @@ func (c *Client) sendGetQueryRange(ctx context.Context, params GetQueryRangePara defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1063,7 +1063,7 @@ func (c *Client) sendGetRules(ctx context.Context, params GetRulesParams) (res * defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1234,7 +1234,7 @@ func (c *Client) sendGetSeries(ctx context.Context, params GetSeriesParams) (res defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1388,7 +1388,7 @@ func (c *Client) sendPostLabels(ctx context.Context, request *LabelsForm) (res * defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1463,7 +1463,7 @@ func (c *Client) sendPostQuery(ctx context.Context, request *QueryForm) (res *Qu defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1538,7 +1538,7 @@ func (c *Client) sendPostQueryExemplars(ctx context.Context, request *ExemplarsF defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1613,7 +1613,7 @@ func (c *Client) sendPostQueryRange(ctx context.Context, request *QueryRangeForm defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1688,7 +1688,7 @@ func (c *Client) sendPostSeries(ctx context.Context, request *SeriesForm) (res * defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/promapi/oas_handlers_gen.go b/internal/promapi/oas_handlers_gen.go index 477f1b39..d790b01f 100644 --- a/internal/promapi/oas_handlers_gen.go +++ b/internal/promapi/oas_handlers_gen.go @@ -72,7 +72,7 @@ func (s *Server) handleGetLabelValuesRequest(args [1]string, argsEscaped bool, w s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -83,12 +83,8 @@ func (s *Server) handleGetLabelValuesRequest(args [1]string, argsEscaped bool, w // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -239,7 +235,7 @@ func (s *Server) handleGetLabelsRequest(args [0]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -250,12 +246,8 @@ func (s *Server) handleGetLabelsRequest(args [0]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -402,7 +394,7 @@ func (s *Server) handleGetMetadataRequest(args [0]string, argsEscaped bool, w ht s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -413,12 +405,8 @@ func (s *Server) handleGetMetadataRequest(args [0]string, argsEscaped bool, w ht // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -563,7 +551,7 @@ func (s *Server) handleGetQueryRequest(args [0]string, argsEscaped bool, w http. s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -574,12 +562,8 @@ func (s *Server) handleGetQueryRequest(args [0]string, argsEscaped bool, w http. // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -728,7 +712,7 @@ func (s *Server) handleGetQueryExemplarsRequest(args [0]string, argsEscaped bool s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -739,12 +723,8 @@ func (s *Server) handleGetQueryExemplarsRequest(args [0]string, argsEscaped bool // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -889,7 +869,7 @@ func (s *Server) handleGetQueryRangeRequest(args [0]string, argsEscaped bool, w s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -900,12 +880,8 @@ func (s *Server) handleGetQueryRangeRequest(args [0]string, argsEscaped bool, w // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1060,7 +1036,7 @@ func (s *Server) handleGetRulesRequest(args [0]string, argsEscaped bool, w http. s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1071,12 +1047,8 @@ func (s *Server) handleGetRulesRequest(args [0]string, argsEscaped bool, w http. // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1225,7 +1197,7 @@ func (s *Server) handleGetSeriesRequest(args [0]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1236,12 +1208,8 @@ func (s *Server) handleGetSeriesRequest(args [0]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1388,7 +1356,7 @@ func (s *Server) handlePostLabelsRequest(args [0]string, argsEscaped bool, w htt s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1399,12 +1367,8 @@ func (s *Server) handlePostLabelsRequest(args [0]string, argsEscaped bool, w htt // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1541,7 +1505,7 @@ func (s *Server) handlePostQueryRequest(args [0]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1552,12 +1516,8 @@ func (s *Server) handlePostQueryRequest(args [0]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1694,7 +1654,7 @@ func (s *Server) handlePostQueryExemplarsRequest(args [0]string, argsEscaped boo s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1705,12 +1665,8 @@ func (s *Server) handlePostQueryExemplarsRequest(args [0]string, argsEscaped boo // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1847,7 +1803,7 @@ func (s *Server) handlePostQueryRangeRequest(args [0]string, argsEscaped bool, w s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1858,12 +1814,8 @@ func (s *Server) handlePostQueryRangeRequest(args [0]string, argsEscaped bool, w // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -2000,7 +1952,7 @@ func (s *Server) handlePostSeriesRequest(args [0]string, argsEscaped bool, w htt s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -2011,12 +1963,8 @@ func (s *Server) handlePostSeriesRequest(args [0]string, argsEscaped bool, w htt // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } diff --git a/internal/pyroscopeapi/oas_client_gen.go b/internal/pyroscopeapi/oas_client_gen.go index daeaac29..160f60d7 100644 --- a/internal/pyroscopeapi/oas_client_gen.go +++ b/internal/pyroscopeapi/oas_client_gen.go @@ -132,7 +132,7 @@ func (c *Client) sendGetApps(ctx context.Context) (res []ApplicationMetadata, er defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -204,7 +204,7 @@ func (c *Client) sendIngest(ctx context.Context, request *IngestReqWithContentTy defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -425,7 +425,7 @@ func (c *Client) sendLabelValues(ctx context.Context, params LabelValuesParams) defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -572,7 +572,7 @@ func (c *Client) sendLabels(ctx context.Context, params LabelsParams) (res Label defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -706,7 +706,7 @@ func (c *Client) sendRender(ctx context.Context, params RenderParams) (res *Flam defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/pyroscopeapi/oas_handlers_gen.go b/internal/pyroscopeapi/oas_handlers_gen.go index e521caac..c89c52d2 100644 --- a/internal/pyroscopeapi/oas_handlers_gen.go +++ b/internal/pyroscopeapi/oas_handlers_gen.go @@ -75,7 +75,7 @@ func (s *Server) handleGetAppsRequest(args [0]string, argsEscaped bool, w http.R s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -86,12 +86,8 @@ func (s *Server) handleGetAppsRequest(args [0]string, argsEscaped bool, w http.R // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -209,7 +205,7 @@ func (s *Server) handleIngestRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -220,12 +216,8 @@ func (s *Server) handleIngestRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -405,7 +397,7 @@ func (s *Server) handleLabelValuesRequest(args [0]string, argsEscaped bool, w ht s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -416,12 +408,8 @@ func (s *Server) handleLabelValuesRequest(args [0]string, argsEscaped bool, w ht // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -570,7 +558,7 @@ func (s *Server) handleLabelsRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -581,12 +569,8 @@ func (s *Server) handleLabelsRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -732,7 +716,7 @@ func (s *Server) handleRenderRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -743,12 +727,8 @@ func (s *Server) handleRenderRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } diff --git a/internal/sentryapi/oas_client_gen.go b/internal/sentryapi/oas_client_gen.go index d9401993..561df052 100644 --- a/internal/sentryapi/oas_client_gen.go +++ b/internal/sentryapi/oas_client_gen.go @@ -110,7 +110,7 @@ func (c *Client) sendDummy(ctx context.Context) (res *Event, err error) { defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -182,7 +182,7 @@ func (c *Client) sendEnvelope(ctx context.Context, request *EnvelopeReqWithConte defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/sentryapi/oas_handlers_gen.go b/internal/sentryapi/oas_handlers_gen.go index c136eb26..b285bd05 100644 --- a/internal/sentryapi/oas_handlers_gen.go +++ b/internal/sentryapi/oas_handlers_gen.go @@ -74,7 +74,7 @@ func (s *Server) handleDummyRequest(args [0]string, argsEscaped bool, w http.Res s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -85,12 +85,8 @@ func (s *Server) handleDummyRequest(args [0]string, argsEscaped bool, w http.Res // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -208,7 +204,7 @@ func (s *Server) handleEnvelopeRequest(args [0]string, argsEscaped bool, w http. s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -219,12 +215,8 @@ func (s *Server) handleEnvelopeRequest(args [0]string, argsEscaped bool, w http. // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } diff --git a/internal/tempoapi/oas_client_gen.go b/internal/tempoapi/oas_client_gen.go index 824226da..060135d3 100644 --- a/internal/tempoapi/oas_client_gen.go +++ b/internal/tempoapi/oas_client_gen.go @@ -150,7 +150,7 @@ func (c *Client) sendBuildInfo(ctx context.Context) (res *PrometheusVersion, err defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -222,7 +222,7 @@ func (c *Client) sendEcho(ctx context.Context) (res EchoOK, err error) { defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -294,7 +294,7 @@ func (c *Client) sendSearch(ctx context.Context, params SearchParams) (res *Trac defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -506,7 +506,7 @@ func (c *Client) sendSearchTagValues(ctx context.Context, params SearchTagValues defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -653,7 +653,7 @@ func (c *Client) sendSearchTagValuesV2(ctx context.Context, params SearchTagValu defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -799,7 +799,7 @@ func (c *Client) sendSearchTags(ctx context.Context, params SearchTagsParams) (r defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -926,7 +926,7 @@ func (c *Client) sendSearchTagsV2(ctx context.Context, params SearchTagsV2Params defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. @@ -1053,7 +1053,7 @@ func (c *Client) sendTraceByID(ctx context.Context, params TraceByIDParams) (res defer func() { // Use floating point division here for higher precision (instead of Millisecond method). elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + c.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. diff --git a/internal/tempoapi/oas_handlers_gen.go b/internal/tempoapi/oas_handlers_gen.go index cbecc6e9..99cc5eba 100644 --- a/internal/tempoapi/oas_handlers_gen.go +++ b/internal/tempoapi/oas_handlers_gen.go @@ -75,7 +75,7 @@ func (s *Server) handleBuildInfoRequest(args [0]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -86,12 +86,8 @@ func (s *Server) handleBuildInfoRequest(args [0]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -209,7 +205,7 @@ func (s *Server) handleEchoRequest(args [0]string, argsEscaped bool, w http.Resp s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -220,12 +216,8 @@ func (s *Server) handleEchoRequest(args [0]string, argsEscaped bool, w http.Resp // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -343,7 +335,7 @@ func (s *Server) handleSearchRequest(args [0]string, argsEscaped bool, w http.Re s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -354,12 +346,8 @@ func (s *Server) handleSearchRequest(args [0]string, argsEscaped bool, w http.Re // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -524,7 +512,7 @@ func (s *Server) handleSearchTagValuesRequest(args [1]string, argsEscaped bool, s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -535,12 +523,8 @@ func (s *Server) handleSearchTagValuesRequest(args [1]string, argsEscaped bool, // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -690,7 +674,7 @@ func (s *Server) handleSearchTagValuesV2Request(args [1]string, argsEscaped bool s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -701,12 +685,8 @@ func (s *Server) handleSearchTagValuesV2Request(args [1]string, argsEscaped bool // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -855,7 +835,7 @@ func (s *Server) handleSearchTagsRequest(args [0]string, argsEscaped bool, w htt s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -866,12 +846,8 @@ func (s *Server) handleSearchTagsRequest(args [0]string, argsEscaped bool, w htt // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1016,7 +992,7 @@ func (s *Server) handleSearchTagsV2Request(args [0]string, argsEscaped bool, w h s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1027,12 +1003,8 @@ func (s *Server) handleSearchTagsV2Request(args [0]string, argsEscaped bool, w h // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) } @@ -1177,7 +1149,7 @@ func (s *Server) handleTraceByIDRequest(args [1]string, argsEscaped bool, w http s.requests.Add(ctx, 1, attrOpt) // Use floating point division here for higher precision (instead of Millisecond method). - s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt) }() var ( @@ -1188,12 +1160,8 @@ func (s *Server) handleTraceByIDRequest(args [1]string, argsEscaped bool, w http // Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges, // 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. - setStatus := true code := statusWriter.status - if code >= 100 && code < 400 { - setStatus = false - } - if setStatus { + if code >= 100 && code < 500 { span.SetStatus(codes.Error, stage) }