A Minimalist Mesh-Native Microservice Framework for Golang
By using generics, summer
allows you to use the basic summer.Context
, or create your own Context
type, without changing programming paradigm.
- Support
opentelemetry-go
- Support standard
OTEL_
environment variables - Using
zipkin
as default exporter - Support
TraceContext
,Baggage
andB3
propagation - Support
otelhttp
instrument
- Support standard
- Support
prometheus/promhttp
- Expose at
/debug/metrics
- Expose at
- Support
Readiness Check
- Expose at
/debug/ready
- Component readiness registration with
App#Check()
- Expose at
- Support
Liveness Check
- Expose at
/debug/alive
- Cascade
Liveness Check
failure from continuousReadiness Check
failure
- Expose at
- Support
debug/pprof
- Expose at
/debug/pprof
- Expose at
- Bind request data
- Unmarshal
header
,query
,json body
andform body
into any structure withjson
tag
- Unmarshal
OpenTelemetry
setup is left to end-user
Example:
package summer
import (
"github.com/guoyk93/rg"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/contrib/propagators/b3"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/zipkin"
"go.opentelemetry.io/otel/propagation"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"net/http"
)
// BootTracing setup OpenTelemetry tracing best practice
func BootTracing() {
otel.SetTracerProvider(sdktrace.NewTracerProvider(
sdktrace.WithBatcher(rg.Must(zipkin.New(""))),
))
otel.SetTextMapPropagator(
propagation.NewCompositeTextMapPropagator(
propagation.TraceContext{},
propagation.Baggage{},
b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader|b3.B3SingleHeader)),
),
)
// re-initialize otelhttp.DefaultClient and http.DefaultClient
otelhttp.DefaultClient = &http.Client{
Transport: otelhttp.NewTransport(http.DefaultTransport),
}
http.DefaultClient = otelhttp.DefaultClient
}
See https://guoyk.xyz/donation
Guo Y.K., MIT License