diff --git a/go.mod b/go.mod index 9fedf593..768fa3f0 100644 --- a/go.mod +++ b/go.mod @@ -57,14 +57,11 @@ require ( github.com/xtaci/smux v1.5.24 gitlab.com/yawning/obfs4.git v0.0.0-20220204003609-77af0cba934d go.opentelemetry.io/otel v1.28.0 - go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 - go.opentelemetry.io/otel/log v0.4.0 go.opentelemetry.io/otel/metric v1.28.0 go.opentelemetry.io/otel/sdk v1.28.0 - go.opentelemetry.io/otel/sdk/log v0.4.0 go.opentelemetry.io/otel/sdk/metric v1.28.0 go.opentelemetry.io/otel/trace v1.28.0 go.uber.org/mock v0.3.0 @@ -181,7 +178,6 @@ require ( go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect diff --git a/go.sum b/go.sum index 5f49be8e..09a297a0 100644 --- a/go.sum +++ b/go.sum @@ -505,28 +505,16 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1: go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo= go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 h1:zBPZAISA9NOc5cE8zydqDiS0itvg/P/0Hn9m72a5gvM= -go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0/go.mod h1:gcj2fFjEsqpV3fXuzAA+0Ze1p2/4MJ4T7d77AmkvueQ= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 h1:ZtfnDL+tUrs1F0Pzfwbg2d59Gru9NCH3bgSHBM6LDwU= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0/go.mod h1:hG4Fj/y8TR/tlEDREo8tWstl9fO9gcFkn4xrx0Io8xU= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.42.0 h1:wNMDy/LVGLj2h3p6zg4d0gypKfWKSWI14E1C4smOgl8= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.42.0/go.mod h1:YfbDdXAAkemWJK3H/DshvlrxqFB2rtW4rY6ky/3x/H0= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 h1:aLmmtjRke7LPDQ3lvpFz+kNEH43faFhzW7v8BFIEydg= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0/go.mod h1:TC1pyCt6G9Sjb4bQpShH+P5R53pO6ZuGnHuuln9xMeE= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= -go.opentelemetry.io/otel/log v0.4.0 h1:/vZ+3Utqh18e8TPjuc3ecg284078KWrR8BRz+PQAj3o= -go.opentelemetry.io/otel/log v0.4.0/go.mod h1:DhGnQvky7pHy82MIRV43iXh3FlKN8UUKftn0KbLOq6I= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/sdk/log v0.4.0 h1:1mMI22L82zLqf6KtkjrRy5BbagOTWdJsqMY/HSqILAA= -go.opentelemetry.io/otel/sdk/log v0.4.0/go.mod h1:AYJ9FVF0hNOgAVzUG/ybg/QttnXhUePWAupmCqtdESo= -go.opentelemetry.io/otel/sdk/metric v1.19.0 h1:EJoTO5qysMsYCa+w4UghwFV/ptQgqSL/8Ni+hx+8i1k= -go.opentelemetry.io/otel/sdk/metric v1.19.0/go.mod h1:XjG0jQyFJrv2PbMvwND7LwCEhsJzCzV5210euduKcKY= go.opentelemetry.io/otel/sdk/metric v1.28.0 h1:OkuaKgKrgAbYrrY0t92c+cC+2F6hsFNnCQArXCKlg08= go.opentelemetry.io/otel/sdk/metric v1.28.0/go.mod h1:cWPjykihLAPvXKi4iZc1dpER3Jdq2Z0YLse3moQUCpg= go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= diff --git a/http-proxy/main.go b/http-proxy/main.go index 2c2bd5ad..a4cbb241 100644 --- a/http-proxy/main.go +++ b/http-proxy/main.go @@ -43,8 +43,8 @@ var ( // Use our own S3 bucket distribution which fetches the origin at most once per // day to avoid hitting the 2000 downloads/day limit imposed by MaxMind. - geolite2CityURL = "https://storage.googleapis.com/lanterngeo/GeoLite2-City.mmdb.tar.gz" - geoip2ISPURL = "https://storage.googleapis.com/lanterngeo/GeoIP2-ISP.mmdb.tar.gz" + geolite2CityURL = "https://lanterngeo.lantern.io/GeoLite2-City.mmdb.tar.gz" + geoip2ISPURL = "https://lanterngeo.lantern.io/GeoIP2-ISP.mmdb.tar.gz" hostname, _ = os.Hostname() diff --git a/instrument/instrument.go b/instrument/instrument.go index 077ab862..e76a1c10 100644 --- a/instrument/instrument.go +++ b/instrument/instrument.go @@ -2,7 +2,6 @@ package instrument import ( "context" - "fmt" "math/rand" "net" "regexp" @@ -11,7 +10,6 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - otlpLog "go.opentelemetry.io/otel/log" "go.opentelemetry.io/otel/metric" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" @@ -20,7 +18,6 @@ import ( "github.com/getlantern/geo" "github.com/getlantern/http-proxy-lantern/v2/common" "github.com/getlantern/http-proxy-lantern/v2/instrument/otelinstrument" - "github.com/getlantern/http-proxy-lantern/v2/otel" "github.com/getlantern/multipath" "github.com/getlantern/proxy/v3/filters" ) @@ -106,7 +103,6 @@ type defaultInstrument struct { originStats map[originDetails]*usage statsMx sync.Mutex proxyName string - logger otlpLog.Logger } func NewDefault(countryLookup geo.CountryLookup, ispLookup geo.ISPLookup, proxyName string) (*defaultInstrument, error) { @@ -114,8 +110,6 @@ func NewDefault(countryLookup geo.CountryLookup, ispLookup geo.ISPLookup, proxyN return nil, err } - lP := otel.BuildLogProvider() - p := &defaultInstrument{ countryLookup: countryLookup, ispLookup: ispLookup, @@ -124,7 +118,6 @@ func NewDefault(countryLookup geo.CountryLookup, ispLookup geo.ISPLookup, proxyN clientStats: make(map[clientDetails]*usage), originStats: make(map[originDetails]*usage), proxyName: proxyName, - logger: lP.Logger("intrument-logger"), } return p, nil @@ -241,14 +234,6 @@ func (ins *defaultInstrument) ProxiedBytes(ctx context.Context, sent, recv int, otelinstrument.DistinctClients1h.Add(deviceID) country := ins.countryLookup.CountryCode(clientIP) - if country == "" { - var record otlpLog.Record - record.SetTimestamp(time.Now()) - msg := fmt.Sprintf("Geolookup failed for IP: %s, platform: %s, platformVersion: %s, appVersion: %s", clientIP, platform, platformVersion, appVersion) - record.SetBody(otlpLog.StringValue(msg)) - record.SetSeverity(otlpLog.SeverityInfo) - ins.logger.Emit(ctx, record) - } isp := ins.ispLookup.ISP(clientIP) asn := ins.ispLookup.ASN(clientIP) diff --git a/otel/otel.go b/otel/otel.go index f45e0d49..93524259 100644 --- a/otel/otel.go +++ b/otel/otel.go @@ -2,16 +2,13 @@ package otel import ( "context" - "crypto/tls" "time" sdkotel "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - otlpLog "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" - otelLogSdk "go.opentelemetry.io/otel/sdk/log" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -89,29 +86,6 @@ func (opts *Opts) buildResource() *resource.Resource { return resource.NewWithAttributes(semconv.SchemaURL, attributes...) } -func BuildLogProvider() *otelLogSdk.LoggerProvider { - endPoint := "ops.lantr.net:443" - - res := resource.NewWithAttributes(semconv.SchemaURL, []attribute.KeyValue{semconv.ServiceNameKey.String("http-proxy-lantern")}...) - - exporter, err := otlpLog.New(context.Background(), - otlpLog.WithEndpoint(endPoint), - otlpLog.WithTLSClientConfig(&tls.Config{InsecureSkipVerify: true}), // this is just to debug a geolocation issue - ) - - if err != nil { - log.Errorf("Unable to initialize OpenTelemetry, will not report logs to %v", endPoint) - return nil - } - - loggerProvider := otelLogSdk.NewLoggerProvider( - otelLogSdk.WithResource(res), - otelLogSdk.WithProcessor(otelLogSdk.NewBatchProcessor(exporter)), - ) - - return loggerProvider -} - func BuildTracerProvider(opts *Opts) (*sdktrace.TracerProvider, func()) { // Create HTTP client to talk to OTEL collector client := otlptracehttp.NewClient(