diff --git a/README.md b/README.md index 17eaabc..d682a19 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ * [Official website](https://echo.labstack.com) * [All middleware docs](https://echo.labstack.com/docs/category/middleware) +## Deprecations / alternatives + +1. Prometheus middleware has a new separate repository - https://github.com/labstack/echo-prometheus +2. Jaeger middleware is deprecated, use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + [OTLP exporters](https://opentelemetry.io/docs/languages/go/exporters/). +3. Zipkin middleware is deprecated, use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + [OTLP exporters](https://opentelemetry.io/docs/languages/go/exporters/). + ## Usage For Echo `v5` support: diff --git a/echoprometheus/README.md b/echoprometheus/README.md index a565453..e7f3bb4 100644 --- a/echoprometheus/README.md +++ b/echoprometheus/README.md @@ -1,5 +1,7 @@ # Usage +Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters + ```go package main diff --git a/echoprometheus/prometheus.go b/echoprometheus/prometheus.go index b8e9c29..cb275e0 100644 --- a/echoprometheus/prometheus.go +++ b/echoprometheus/prometheus.go @@ -3,6 +3,8 @@ /* Package echoprometheus provides middleware to add Prometheus metrics. + +Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters */ package echoprometheus @@ -115,6 +117,8 @@ type PushGatewayConfig struct { } // NewHandler creates new instance of Handler using Prometheus default registry. +// +// Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters func NewHandler() echo.HandlerFunc { return NewHandlerWithConfig(HandlerConfig{}) } @@ -137,11 +141,15 @@ func NewHandlerWithConfig(config HandlerConfig) echo.HandlerFunc { } // NewMiddleware creates new instance of middleware using Prometheus default registry. +// +// Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters func NewMiddleware(subsystem string) echo.MiddlewareFunc { return NewMiddlewareWithConfig(MiddlewareConfig{Subsystem: subsystem}) } // NewMiddlewareWithConfig creates new instance of middleware using given configuration. +// +// Deprecated: use [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters func NewMiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc { mw, err := config.ToMiddleware() if err != nil { @@ -151,6 +159,8 @@ func NewMiddlewareWithConfig(config MiddlewareConfig) echo.MiddlewareFunc { } // ToMiddleware converts configuration to middleware or returns an error. +// +// Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters func (conf MiddlewareConfig) ToMiddleware() (echo.MiddlewareFunc, error) { if conf.timeNow == nil { conf.timeNow = time.Now @@ -386,6 +396,8 @@ func computeApproximateRequestSize(r *http.Request) int { // }() // // ``` +// +// Deprecated: use new repository [echo-prometheus middleware](https://github.com/labstack/echo-prometheus) or [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters func RunPushGatewayGatherer(ctx context.Context, config PushGatewayConfig) error { if config.PushGatewayURL == "" { return errors.New("push gateway URL is missing") diff --git a/jaegertracing/jaegertracing.go b/jaegertracing/jaegertracing.go index 6d2690c..a0ab3be 100644 --- a/jaegertracing/jaegertracing.go +++ b/jaegertracing/jaegertracing.go @@ -24,6 +24,8 @@ import ( } ``` + +Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go */ package jaegertracing @@ -90,6 +92,8 @@ var ( // New creates an Opentracing tracer and attaches it to Echo middleware. // Returns Closer do be added to caller function as `defer closer.Close()` +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func New(e *echo.Echo, skipper middleware.Skipper) io.Closer { // Add Opentracing instrumentation defcfg := config.Configuration{ @@ -122,6 +126,8 @@ func New(e *echo.Echo, skipper middleware.Skipper) io.Closer { // Trace returns a Trace middleware. // Trace middleware traces http requests and reporting errors. +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func Trace(tracer opentracing.Tracer) echo.MiddlewareFunc { c := DefaultTraceConfig c.Tracer = tracer @@ -131,6 +137,8 @@ func Trace(tracer opentracing.Tracer) echo.MiddlewareFunc { // TraceWithConfig returns a Trace middleware with config. // See: `Trace()`. +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func TraceWithConfig(config TraceConfig) echo.MiddlewareFunc { if config.Tracer == nil { panic("echo: trace middleware requires opentracing tracer") @@ -279,6 +287,8 @@ func defaultOperationName(c *echo.Context) string { } // TraceFunction wraps funtion with opentracing span adding tags for the function name and caller details +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func TraceFunction(ctx *echo.Context, fn interface{}, params ...interface{}) (result []reflect.Value) { // Get function name name := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name() @@ -314,6 +324,8 @@ func TraceFunction(ctx *echo.Context, fn interface{}, params ...interface{}) (re // CreateChildSpan creates a new opentracing span adding tags for the span name and caller details. // User must call defer `sp.Finish()` +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func CreateChildSpan(ctx *echo.Context, name string) opentracing.Span { parentSpan := opentracing.SpanFromContext(ctx.Request().Context()) sp := opentracing.StartSpan( @@ -333,6 +345,8 @@ func CreateChildSpan(ctx *echo.Context, name string) opentracing.Span { } // NewTracedRequest generates a new traced HTTP request with opentracing headers injected into it +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/jaegertracing/jaeger-client-go func NewTracedRequest(method string, url string, body io.Reader, span opentracing.Span) (*http.Request, error) { req, err := http.NewRequest(method, url, body) if err != nil { diff --git a/zipkintracing/README.md b/zipkintracing/README.md index 18a2477..43e8579 100644 --- a/zipkintracing/README.md +++ b/zipkintracing/README.md @@ -1,5 +1,8 @@ # Tracing Library for Go +> Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter +> `Go app -> OTLP -> OpenTelemetry Collector -> Zipkin` + This library provides tracing for go using [Zipkin](https://zipkin.io/) ## Usage diff --git a/zipkintracing/tracing.go b/zipkintracing/tracing.go index 97fd38d..caaadd1 100644 --- a/zipkintracing/tracing.go +++ b/zipkintracing/tracing.go @@ -51,12 +51,16 @@ var ( ) // DoHTTP is a http zipkin tracer implementation of HTTPDoer +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func DoHTTP(c *echo.Context, r *http.Request, client *zipkinhttp.Client) (*http.Response, error) { req := r.WithContext(c.Request().Context()) return client.DoWithAppSpan(req, req.Method) } // TraceFunc wraps function call with span so that we can trace time taken by func, eventContext only provided if we want to store trace headers +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func TraceFunc(c *echo.Context, spanName string, spanTags Tags, tracer *zipkin.Tracer) func() { span, _ := tracer.StartSpanFromContext(c.Request().Context(), spanName) for key, value := range spanTags(c) { @@ -71,6 +75,8 @@ func TraceFunc(c *echo.Context, spanName string, spanTags Tags, tracer *zipkin.T } // TraceProxy middleware that traces reverse proxy +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func TraceProxy(tracer *zipkin.Tracer) echo.MiddlewareFunc { config := DefaultTraceProxyConfig config.Tracer = tracer @@ -78,6 +84,8 @@ func TraceProxy(tracer *zipkin.Tracer) echo.MiddlewareFunc { } // TraceProxyWithConfig middleware that traces reverse proxy +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func TraceProxyWithConfig(config TraceProxyConfig) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c *echo.Context) error { @@ -116,6 +124,8 @@ func TraceProxyWithConfig(config TraceProxyConfig) echo.MiddlewareFunc { } // TraceServer middleware that traces server calls +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func TraceServer(tracer *zipkin.Tracer) echo.MiddlewareFunc { config := DefaultTraceServerConfig config.Tracer = tracer @@ -123,6 +133,8 @@ func TraceServer(tracer *zipkin.Tracer) echo.MiddlewareFunc { } // TraceServerWithConfig middleware that traces server calls +// +// Deprecated: use [OpenTelemetry middleware](https://github.com/labstack/echo-opentelemetry) instead + OTLP exporters. Read this: https://github.com/openzipkin-contrib/zipkin-otel and https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/zipkinexporter func TraceServerWithConfig(config TraceServerConfig) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c *echo.Context) error {