Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate obsolete instrumentation #3440

Merged
merged 2 commits into from Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions go.mod
Expand Up @@ -7,15 +7,15 @@ require (
github.com/dimfeld/httppath v0.0.0-20170720192232-ee938bf73598
github.com/getkin/kin-openapi v0.122.0
github.com/go-chi/chi/v5 v5.0.11
github.com/google/uuid v1.4.0
github.com/google/uuid v1.5.0
github.com/gorilla/websocket v1.5.1
github.com/manveru/faker v0.0.0-20171103152722-9fbc68a78c4d
github.com/pkg/errors v0.9.1
github.com/sergi/go-diff v1.3.1
github.com/stretchr/testify v1.8.4
golang.org/x/text v0.14.0
golang.org/x/tools v0.16.0
google.golang.org/grpc v1.59.0
golang.org/x/tools v0.16.1
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -34,6 +34,6 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
golang.org/x/sys v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Expand Up @@ -21,8 +21,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
Expand Down Expand Up @@ -67,17 +67,17 @@ golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM=
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU=
google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU=
google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
Expand Down
7 changes: 7 additions & 0 deletions http/middleware/capture.go
Expand Up @@ -10,13 +10,20 @@ import (

// ResponseCapture is a http.ResponseWriter which captures the response status
// code and content length.
//
// Deprecated: this type is deprecated and will be removed in a future version
// of Goa.
type ResponseCapture struct {
http.ResponseWriter
StatusCode int
ContentLength int
}

// CaptureResponse creates a ResponseCapture that wraps the given ResponseWriter.
//
// Deprecated: Use OpenTelemetry instead, see for example
// github.com/goadesign/clue. This function will be removed in a future version
// of Goa.
func CaptureResponse(w http.ResponseWriter) *ResponseCapture {
return &ResponseCapture{ResponseWriter: w}
}
Expand Down
25 changes: 4 additions & 21 deletions http/middleware/doc.go
@@ -1,23 +1,6 @@
/*Package middleware contains HTTP middlewares that wrap a HTTP handler to
provide additional functionality.

The package contains the following middlewares:

* Logging server middleware for logging requests and responses.
* Request ID server middleware to include a unique request ID on receiving
a HTTP request.
* Tracing middleware for server and client.
* AWS X-Ray middleware for server and client that produce X-Ray segments.

Example to use the server middleware:

var handler http.Handler = goahttp.NewMuxer()
handler = middleware.RequestID()(handler)

Example to use the client middleware:

var doer goahttp.Doer = &http.Client{}
doer = xray.WrapDoer(doer)

/*
Package middleware contains HTTP middlewares that wrap a HTTP handler to provide
ancilliary functionality such as capturing HTTP details into the request
context or printing debug information on incoming requests.
*/
package middleware
8 changes: 8 additions & 0 deletions http/middleware/log.go
Expand Up @@ -19,6 +19,10 @@ import (
// X-Forwarded-For HTTP header or - absent of that - the originating IP. The
// middleware also logs the response HTTP status code, body length (in bytes) and
// timing information.
//
// Deprecated: use OpenTelemetry instead, see for example
// github.com/goadesign/clue. This function will be removed in a future version
// of Goa.
func Log(l middleware.Logger) func(h http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -30,6 +34,10 @@ func Log(l middleware.Logger) func(h http.Handler) http.Handler {
// LogContext returns a middleware that logs the incoming requests similarly to
// Log. LogContext calls the given function with the request context to extract
// the logger.
//
// Deprecated: use OpenTelemetry instead, see for example
// github.com/goadesign/clue. This function will be removed in a future version
// of Goa.
func LogContext(logFromCtx func(context.Context) middleware.Logger) func(http.Handler) http.Handler {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down
4 changes: 4 additions & 0 deletions http/middleware/requestid.go
Expand Up @@ -23,6 +23,10 @@ import (
//
// // enable options for using "Custom-Id" header.
// service.Use(middleware.RequestID(middleware.RequestIDHeaderOption("Custom-Id"))
//
// Deprecated: use OpenTelemetry instead, see for example
// github.com/goadesign/clue. This function will be removed in a future version
// of Goa.
func RequestID(options ...middleware.RequestIDOption) func(http.Handler) http.Handler {
o := middleware.NewRequestIDOptions(options...)
useReqID := o.IsUseRequestID()
Expand Down
3 changes: 3 additions & 0 deletions http/middleware/trace.go
Expand Up @@ -32,6 +32,9 @@ const (

// Trace returns a trace middleware that initializes the trace information in
// the request context.
// Deprecated: use OpenTelemetry instead, see for example
// https://github.com/goadesign/clue. This function will be removed in a future
// version of Goa.
func Trace(opts ...middleware.TraceOption) func(http.Handler) http.Handler {
o := middleware.NewTraceOptions(opts...)
sampler := o.NewSampler()
Expand Down
7 changes: 6 additions & 1 deletion http/middleware/xray/doc.go
@@ -1,4 +1,5 @@
/*Package xray contains middleware that creates AWS X-Ray segments from the
/*
Package xray contains middleware that creates AWS X-Ray segments from the
HTTP requests and responses and send the segments to an AWS X-ray daemon.

The server middleware works by extracting the trace information from the
Expand All @@ -10,5 +11,9 @@ version or record an error.
The client middleware wraps the client Doer and works by extracing the
segment from the request context. It creates a new sub-segment and updates
the request context with the latest segment before making the request.

Deprecated: use OpenTelemetry instead, see for example
https://github.com/goadesign/clue. This package will be removed in a future
version of Goa.
*/
package xray