mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 23:47:44 +00:00
update reddit http client
This commit is contained in:
parent
9341e08123
commit
af538e6f42
3 changed files with 9 additions and 4 deletions
2
go.mod
2
go.mod
|
@ -9,6 +9,7 @@ require (
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/go-co-op/gocron v1.17.1
|
github.com/go-co-op/gocron v1.17.1
|
||||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
|
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
|
||||||
|
github.com/go-redis/redis/extra/redisotel/v8 v8.11.5
|
||||||
github.com/go-redis/redis/v8 v8.11.5
|
github.com/go-redis/redis/v8 v8.11.5
|
||||||
github.com/gofrs/uuid v4.3.0+incompatible
|
github.com/gofrs/uuid v4.3.0+incompatible
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
|
@ -41,7 +42,6 @@ require (
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||||
github.com/go-redis/redis/extra/rediscmd/v8 v8.11.5 // indirect
|
github.com/go-redis/redis/extra/rediscmd/v8 v8.11.5 // indirect
|
||||||
github.com/go-redis/redis/extra/redisotel/v8 v8.11.5 // indirect
|
|
||||||
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
|
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
|
|
|
@ -95,8 +95,13 @@ func NewClient(id, secret string, tracer trace.Tracer, statsd statsd.ClientInter
|
||||||
pool.Put(parsers[i])
|
pool.Put(parsers[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t := http.DefaultTransport.(*http.Transport).Clone()
|
||||||
|
t.MaxIdleConns = 100
|
||||||
|
t.MaxConnsPerHost = 100
|
||||||
|
t.MaxIdleConnsPerHost = 100
|
||||||
|
|
||||||
httpClient := &http.Client{
|
httpClient := &http.Client{
|
||||||
Transport: otelhttp.NewTransport(http.DefaultTransport),
|
Transport: otelhttp.NewTransport(t),
|
||||||
Timeout: 4 * time.Second,
|
Timeout: 4 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/jackc/pgconn"
|
"github.com/jackc/pgconn"
|
||||||
"github.com/jackc/pgx/v4"
|
"github.com/jackc/pgx/v4"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ type Connection interface {
|
||||||
|
|
||||||
func spanWithQuery(ctx context.Context, tracer trace.Tracer, query string) (context.Context, trace.Span) {
|
func spanWithQuery(ctx context.Context, tracer trace.Tracer, query string) (context.Context, trace.Span) {
|
||||||
ctx, span := tracer.Start(ctx, "db:query")
|
ctx, span := tracer.Start(ctx, "db:query")
|
||||||
span.SetAttributes(attribute.String("db.query", query))
|
span.SetAttributes(semconv.DBStatementKey.String(query))
|
||||||
return ctx, span
|
return ctx, span
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue