diff --git a/README.md b/README.md index fe00372..4f77dc2 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ plugins: enabled: true # default true enable_register: true # register metrics endpoint to etcd, default true registry_endpoints: ["your.own.registry.addr:port"] - server_owner: # server owners seperated by ;. + server_owner: # server owners separated by ;. client_histogram_buckets: [.005, .01, .1, .5, 1, 5] # optional config for client histogram buckets(Requires incrementing values, with a maximum length of 10 elements, and the data type should be float64.) server_histogram_buckets: [.005, .01, .025, .05, .1, .25, .5, 1, 5] # optional config for server histogram buckets(Requires incrementing values, with a maximum length of 10 elements, and the data type should be float64.) disable_rpc_method_mapping: false # Optional configuration (default false). When set to true, the original interface name will be reported as-is when reporting metrics. @@ -140,8 +140,8 @@ plugins: enable_zpage: false # Default false, when enabled, the processor exports span locally and can be viewed at /debug/tracez ``` -3. metrcs plugin setup -default registerd to etcd cluster, can be turned off. +3. metrics plugin setup +default registered to etcd cluster, can be turned off. support prometheus gateway, require program sending delete request to push gateway before exit, add defer metric.DeletePrometheusPush() in main function, e.g., ```go package main diff --git a/go.mod b/go.mod index 41fa8b9..ff7a573 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/golang/protobuf v1.5.3 github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 github.com/guillermo/go.procmeminfo v0.0.0-20131127224636-be4355a9fb0e github.com/json-iterator/go v1.1.12 @@ -45,6 +44,7 @@ require ( github.com/go-ole/go-ole v1.2.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/btree v1.0.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect diff --git a/oteltrpc/README_cn.md b/oteltrpc/README_cn.md index 7f57297..9f47356 100644 --- a/oteltrpc/README_cn.md +++ b/oteltrpc/README_cn.md @@ -16,7 +16,7 @@ * caller_service: 主调方服务名,取msg.CallerServiceName() * caller_method: 主调方方法名,取msg.CallerMethod() * callee_service: 被调方服务名,取msg.CalleeServiceName() - * callee_method: 被调方方法名,取msg.CalleMethod() + * callee_method: 被调方方法名,取msg.CalleeMethod() ### 被调 @@ -108,7 +108,7 @@ * tps.tenant.id: 租户id * telemetry.sdk.language: SDK语言,hardcode "go" * telemetry.sdk.name: SDK名, hardcode "opentelemetry" -* service.name(optional): service名,trpc.yaml中第一个serivce的name +* service.name(optional): service名,trpc.yaml中第一个service的name #### common attributes diff --git a/oteltrpc/metrics/prometheus/filter.go b/oteltrpc/metrics/prometheus/filter.go index 0d0a37e..9282f01 100644 --- a/oteltrpc/metrics/prometheus/filter.go +++ b/oteltrpc/metrics/prometheus/filter.go @@ -128,7 +128,7 @@ func calcMetaDataSize(md codec.MetaData) int { // monitorRequestSize monitor request size func monitorRequestSize(req interface{}, md codec.MetaData) { ObserveRequestBodyBytes(calcBodySize(req)) - ObserveRequestMataDataBytes(calcMetaDataSize(md)) + ObserveRequestMetaDataBytes(calcMetaDataSize(md)) } type serverFilterOption struct { diff --git a/oteltrpc/metrics/prometheus/metrics.go b/oteltrpc/metrics/prometheus/metrics.go index 9aeaeb5..2054e2b 100644 --- a/oteltrpc/metrics/prometheus/metrics.go +++ b/oteltrpc/metrics/prometheus/metrics.go @@ -50,7 +50,7 @@ var ( requestMetaDataBodyBytes = promauto.NewHistogram(prometheus.HistogramOpts{ Subsystem: "rpc", - Name: "request_matadata_bytes", + Name: "request_metadata_bytes", Help: "Request Metadata Bytes", Buckets: []float64{1024, 10240, 102400, 1024_000, 10240_000}, }) @@ -83,8 +83,8 @@ func ObserveRequestBodyBytes(s int) { requestBodyBytes.Observe(float64(s)) } -// ObserveRequestMataDataBytes observe request metadata bytes -func ObserveRequestMataDataBytes(s int) { +// ObserveRequestMetaDataBytes observe request metadata bytes +func ObserveRequestMetaDataBytes(s int) { requestMetaDataBodyBytes.Observe(float64(s)) } diff --git a/otelzap/writer.go b/otelzap/writer.go index 88e8f4f..8a4a55f 100644 --- a/otelzap/writer.go +++ b/otelzap/writer.go @@ -21,7 +21,6 @@ import ( "sync/atomic" "time" - v1proto "github.com/golang/protobuf/proto" jsoniter "github.com/json-iterator/go" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/sdk/resource" @@ -29,6 +28,7 @@ import ( logsproto "go.opentelemetry.io/proto/otlp/logs/v1" resourceproto "go.opentelemetry.io/proto/otlp/resource/v1" "go.uber.org/zap/zapcore" + "google.golang.org/protobuf/proto" "trpc-system/go-opentelemetry/pkg/metrics" sdklog "trpc-system/go-opentelemetry/sdk/log" @@ -472,7 +472,7 @@ func (bp *BatchWriteSyncer) shouldProcessInBatch() bool { // calcLogSize calculates the packet size of a ScopeLogs func calcLogSize(sl *logsproto.ScopeLogs) int { - return v1proto.Size(sl) + return proto.Size(sl) } // BatchSyncerOption apply changes to internalOptions. diff --git a/otelzap/zap_benchmark_test.go b/otelzap/zap_benchmark_test.go index 8cf303c..1b0dd59 100644 --- a/otelzap/zap_benchmark_test.go +++ b/otelzap/zap_benchmark_test.go @@ -21,9 +21,8 @@ import ( sdklog "trpc-system/go-opentelemetry/sdk/log" "go.uber.org/zap" - - "github.com/golang/protobuf/proto" "go.uber.org/zap/zapcore" + "google.golang.org/protobuf/proto" commonproto "go.opentelemetry.io/proto/otlp/common/v1" logsproto "go.opentelemetry.io/proto/otlp/logs/v1" diff --git a/sdk/metric/config.go b/sdk/metric/config.go index 07184e7..f8d5db5 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -104,7 +104,6 @@ func newTLSConfig(tlsCert TLSCert) *tls.Config { Certificates: []tls.Certificate{cert}, RootCAs: caCertPool, } - tlsConfig.BuildNameToCertificate() return tlsConfig } return nil diff --git a/sdk/remote/configurator.go b/sdk/remote/configurator.go index 85db779..530b727 100644 --- a/sdk/remote/configurator.go +++ b/sdk/remote/configurator.go @@ -23,6 +23,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" "trpc-system/go-opentelemetry/pkg/protocol/opentelemetry-ext/proto/operation" @@ -84,7 +85,7 @@ func (rc *remoteConfigurator) syncDaemon() { func (rc *remoteConfigurator) sync() { if rc.client == nil { - cc, err := grpc.Dial(rc.remoteServiceAddr, grpc.WithInsecure()) + cc, err := grpc.Dial(rc.remoteServiceAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { if rc.debug { log.Printf("opentelemetry: remote dial err:%v", err) diff --git a/sdk/trace/dyeing_sampler.go b/sdk/trace/dyeing_sampler.go index c33251b..a547ecf 100644 --- a/sdk/trace/dyeing_sampler.go +++ b/sdk/trace/dyeing_sampler.go @@ -27,6 +27,7 @@ import ( sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" "trpc-system/go-opentelemetry/pkg/protocol/opentelemetry-ext/proto/sampler" @@ -149,7 +150,7 @@ func (ws *Sampler) updateDyeingMetadataDaemon() { func (ws *Sampler) updateDyeingMetadata() { if ws.client == nil { - cc, err := grpc.Dial(ws.samplerConfig.SamplerServiceAddr, grpc.WithInsecure()) + cc, err := grpc.Dial(ws.samplerConfig.SamplerServiceAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return } diff --git a/sdk/trace/noop.go b/sdk/trace/noop.go index 33e0e7e..63bfbc9 100644 --- a/sdk/trace/noop.go +++ b/sdk/trace/noop.go @@ -21,7 +21,7 @@ import ( // NoopTracerProvider implementation a tracer provider that will do nothing // use code lines blow to set a noop tracer -// otel.SetTracerProvider(NooTracerProvider) +// otel.SetTracerProvider(NoopTracerProvider) var NoopTracerProvider = trace.NewNoopTracerProvider() // SetNoopTracerProvider set the global trace provider as noop diff --git a/tag.sh b/tag.sh index 180d504..4955950 100755 --- a/tag.sh +++ b/tag.sh @@ -47,7 +47,7 @@ if [ "${COMMIT_FOUND}" != "${COMMIT_HASH}" ] ; then exit -1 fi -# Check if the tag doesn't alread exists. +# Check if the tag doesn't already exists. TAG_FOUND=`git tag --list ${TAG}` if [ "${TAG_FOUND}" = "${TAG}" ] ; then printf "Tag ${TAG} already exists\n"