diff --git a/.golangci.yml b/.golangci.yml index 7a5fdc07abf..affba1f8378 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,7 @@ linters: - goimports - gosimple - govet + - godot - ineffassign - misspell - revive @@ -45,3 +46,9 @@ linters-settings: - cancelled goimports: local-prefixes: go.opentelemetry.io + godot: + exclude: + # Exclude sentence fragments for lists. + - '^[ ]*[-•]' + # Exclude sentences prefixing a list. + - ':$' diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index 9ec375d3a44..e5d0410629e 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -40,7 +40,7 @@ import ( var errConversion = errors.New("Unable to convert from OpenCensus to OpenTelemetry") // NewMetricExporter returns an OpenCensus exporter that exports to an -// OpenTelemetry exporter +// OpenTelemetry exporter. func NewMetricExporter(base export.Exporter) metricexport.Exporter { return &exporter{base: base} } @@ -51,7 +51,7 @@ type exporter struct { base export.Exporter } -// ExportMetrics implements the OpenCensus metric Exporter interface +// ExportMetrics implements the OpenCensus metric Exporter interface. func (e *exporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { res := resource.Empty() if len(metrics) != 0 { @@ -147,7 +147,7 @@ func convertResource(res *ocresource.Resource) *resource.Resource { return resource.NewSchemaless(attrs...) } -// convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor +// convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor. func convertDescriptor(ocDescriptor metricdata.Descriptor) (sdkapi.Descriptor, error) { var ( nkind number.Kind diff --git a/example/opencensus/main.go b/example/opencensus/main.go index ceccb82d083..536cce597fa 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -40,7 +40,7 @@ import ( var ( // instrumenttype differentiates between our gauge and view metrics. keyType = tag.MustNewKey("instrumenttype") - // Counts the number of lines read in from standard input + // Counts the number of lines read in from standard input. countMeasure = stats.Int64("test_count", "A count of something", stats.UnitDimensionless) countView = &view.View{ Name: "test_count", diff --git a/example/passthrough/handler/handler.go b/example/passthrough/handler/handler.go index 10664baec6f..1ba439deac2 100644 --- a/example/passthrough/handler/handler.go +++ b/example/passthrough/handler/handler.go @@ -44,7 +44,7 @@ func New(next func(r *http.Request)) *Handler { } } -// HandleHTTPReq mimics what an instrumented http server does +// HandleHTTPReq mimics what an instrumented http server does. func (h *Handler) HandleHTTPReq(r *http.Request) { ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) var span trace.Span @@ -58,7 +58,7 @@ func (h *Handler) HandleHTTPReq(r *http.Request) { h.makeOutgoingRequest(ctx) } -// makeOutgoingRequest mimics what an instrumented http client does +// makeOutgoingRequest mimics what an instrumented http client does. func (h *Handler) makeOutgoingRequest(ctx context.Context) { // make a new http request r, err := http.NewRequest("", "", nil) diff --git a/example/passthrough/main.go b/example/passthrough/main.go index 0d5a2d98322..cfab1dabb21 100644 --- a/example/passthrough/main.go +++ b/example/passthrough/main.go @@ -73,7 +73,7 @@ func initPassthroughGlobals() { } // nonGlobalTracer creates a trace provider instance for testing, but doesn't -// set it as the global tracer provider +// set it as the global tracer provider. func nonGlobalTracer() *sdktrace.TracerProvider { var err error exp, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go index 17692fb570e..ed002b83f7a 100644 --- a/exporters/jaeger/agent.go +++ b/exporters/jaeger/agent.go @@ -29,7 +29,7 @@ import ( ) const ( - // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent + // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent. udpPacketMaxLength = 65000 // emitBatchOverhead is the additional overhead bytes used for enveloping the datagram, // synced with jaeger-agent https://github.com/jaegertracing/jaeger-client-go/blob/master/transport_udp.go#L37 diff --git a/exporters/jaeger/env.go b/exporters/jaeger/env.go index 94518980695..a7253e48311 100644 --- a/exporters/jaeger/env.go +++ b/exporters/jaeger/env.go @@ -18,13 +18,13 @@ import ( "os" ) -// Environment variable names +// Environment variable names. const ( // Hostname for the Jaeger agent, part of address where exporter sends spans - // i.e. "localhost" + // i.e. "localhost". envAgentHost = "OTEL_EXPORTER_JAEGER_AGENT_HOST" // Port for the Jaeger agent, part of address where exporter sends spans - // i.e. 6831 + // i.e. 6831. envAgentPort = "OTEL_EXPORTER_JAEGER_AGENT_PORT" // The HTTP endpoint for sending spans directly to a collector, // i.e. http://jaeger-collector:14268/api/traces. @@ -35,7 +35,7 @@ const ( envPassword = "OTEL_EXPORTER_JAEGER_PASSWORD" ) -// envOr returns an env variable's value if it is exists or the default if not +// envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { if v, ok := os.LookupEnv(key); ok && v != "" { return v diff --git a/exporters/jaeger/reconnecting_udp_client.go b/exporters/jaeger/reconnecting_udp_client.go index ae4bf87f586..fa2c68ead42 100644 --- a/exporters/jaeger/reconnecting_udp_client.go +++ b/exporters/jaeger/reconnecting_udp_client.go @@ -134,7 +134,7 @@ func (c *reconnectingUDPConn) attemptDialNewAddr(newAddr *net.UDPAddr) error { return nil } -// Write calls net.udpConn.Write, if it fails an attempt is made to connect to a new addr, if that succeeds the write is retried before returning +// Write calls net.udpConn.Write, if it fails an attempt is made to connect to a new addr, if that succeeds the write is retried before returning. func (c *reconnectingUDPConn) Write(b []byte) (int, error) { var bytesWritten int var err error @@ -167,7 +167,7 @@ func (c *reconnectingUDPConn) Write(b []byte) (int, error) { return bytesWritten, err } -// Close stops the reconnectLoop, then closes the connection via net.udpConn 's implementation +// Close stops the reconnectLoop, then closes the connection via net.udpConn 's implementation. func (c *reconnectingUDPConn) Close() error { close(c.closeChan) @@ -183,7 +183,7 @@ func (c *reconnectingUDPConn) Close() error { } // SetWriteBuffer defers to the net.udpConn SetWriteBuffer implementation wrapped with a RLock. if no conn is currently held -// and SetWriteBuffer is called store bufferBytes to be set for new conns +// and SetWriteBuffer is called store bufferBytes to be set for new conns. func (c *reconnectingUDPConn) SetWriteBuffer(bytes int) error { var err error diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index d907f74b9f3..c5cdb0040c0 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" ) -// batchUploader send a batch of spans to Jaeger +// batchUploader send a batch of spans to Jaeger. type batchUploader interface { upload(context.Context, *gen.Batch) error shutdown(context.Context) error diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go index b696338ec9a..67003c4a2fa 100644 --- a/exporters/otlp/internal/envconfig/envconfig.go +++ b/exporters/otlp/internal/envconfig/envconfig.go @@ -25,17 +25,17 @@ import ( "time" ) -// ConfigFn is the generic function used to set a config +// ConfigFn is the generic function used to set a config. type ConfigFn func(*EnvOptionsReader) -// EnvOptionsReader reads the required environment variables +// EnvOptionsReader reads the required environment variables. type EnvOptionsReader struct { GetEnv func(string) string ReadFile func(string) ([]byte, error) Namespace string } -// Apply runs every ConfigFn +// Apply runs every ConfigFn. func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { for _, o := range opts { o(e) @@ -50,7 +50,7 @@ func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { return v, v != "" } -// WithString retrieves the specified config and passes it to ConfigFn as a string +// WithString retrieves the specified config and passes it to ConfigFn as a string. func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -59,7 +59,7 @@ func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { } } -// WithDuration retrieves the specified config and passes it to ConfigFn as a duration +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -70,7 +70,7 @@ func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { } } -// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -79,7 +79,7 @@ func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) } } -// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -90,7 +90,7 @@ func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { } } -// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config +// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config. func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index 854b271d1fb..c3c514d5a6c 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -40,7 +40,7 @@ var ( // ErrIncompatibleAgg is returned when // aggregation.Kind implies an interface conversion that has - // failed + // failed. ErrIncompatibleAgg = errors.New("incompatible aggregation type") // ErrUnknownValueType is returned when a transformation of an unknown value diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index d59912ddb6e..36737c9c0e7 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -26,14 +26,14 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -// DefaultEnvOptionsReader is the default environments reader +// DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, ReadFile: ioutil.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } -// ApplyGRPCEnvConfigs applies the env configurations for gRPC +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. func ApplyGRPCEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -42,7 +42,7 @@ func ApplyGRPCEnvConfigs(cfg Config) Config { return cfg } -// ApplyHTTPEnvConfigs applies the env configurations for HTTP +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. func ApplyHTTPEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -104,7 +104,7 @@ func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { } } -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index c81e51e4fe9..694bb3c270a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -163,7 +163,7 @@ func TestNewExporterInvokeStartThenStopManyTimes(t *testing.T) { } } -// This test takes a long time to run: to skip it, run tests using: -short +// This test takes a long time to run: to skip it, run tests using: -short. func TestNewExporterCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go index 3eecfef39c0..96e5303320a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go @@ -139,7 +139,7 @@ func (mc *mockCollector) GetMetrics() []*metricpb.Metric { return mc.getMetrics() } -// runMockCollector is a helper function to create a mock Collector +// runMockCollector is a helper function to create a mock Collector. func runMockCollector(t *testing.T) *mockCollector { return runMockCollectorAtEndpoint(t, "localhost:0") } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index dab28ff8fb2..dcc57ceb05f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -98,7 +98,7 @@ func NewClient(opts ...Option) otlpmetric.Client { } } -// Start does nothing in a HTTP client +// Start does nothing in a HTTP client. func (d *client) Start(ctx context.Context) error { // nothing to do select { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 1ff8b1d5fc9..c2c56595985 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -26,14 +26,14 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -// DefaultEnvOptionsReader is the default environments reader +// DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, ReadFile: ioutil.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } -// ApplyGRPCEnvConfigs applies the env configurations for gRPC +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. func ApplyGRPCEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -42,7 +42,7 @@ func ApplyGRPCEnvConfigs(cfg Config) Config { return cfg } -// ApplyHTTPEnvConfigs applies the env configurations for HTTP +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. func ApplyHTTPEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -113,7 +113,7 @@ func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { } } -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go index d4331e8749f..c2d6c036152 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go @@ -37,7 +37,7 @@ const ( GzipCompression ) -// Marshaler describes the kind of message format sent to the collector +// Marshaler describes the kind of message format sent to the collector. type Marshaler int const ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 9228001a78c..8f62e393c46 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -167,7 +167,7 @@ func TestNewInvokeStartThenStopManyTimes(t *testing.T) { } } -// This test takes a long time to run: to skip it, run tests using: -short +// This test takes a long time to run: to skip it, run tests using: -short. func TestNewCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") diff --git a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go index 359202aed05..d3ebd8357c7 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go @@ -150,7 +150,7 @@ func (mc *mockCollector) getHeaders() metadata.MD { return mc.traceSvc.getHeaders() } -// runMockCollector is a helper function to create a mock Collector +// runMockCollector is a helper function to create a mock Collector. func runMockCollector(t *testing.T) *mockCollector { return runMockCollectorAtEndpoint(t, "localhost:0") } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 9a1428b444c..45b4b70f1ad 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -100,7 +100,7 @@ func NewClient(opts ...Option) otlptrace.Client { } } -// Start does nothing in a HTTP client +// Start does nothing in a HTTP client. func (d *client) Start(ctx context.Context) error { // nothing to do select { diff --git a/exporters/prometheus/sanitize.go b/exporters/prometheus/sanitize.go index cc9eff358cc..b5588435359 100644 --- a/exporters/prometheus/sanitize.go +++ b/exporters/prometheus/sanitize.go @@ -40,7 +40,7 @@ func sanitize(s string) string { return s } -// converts anything that is not a letter or digit to an underscore +// converts anything that is not a letter or digit to an underscore. func sanitizeRune(r rune) rune { if unicode.IsLetter(r) || unicode.IsDigit(r) { return r diff --git a/exporters/zipkin/env.go b/exporters/zipkin/env.go index 5c072ee67b5..7f1b60fa4f0 100644 --- a/exporters/zipkin/env.go +++ b/exporters/zipkin/env.go @@ -16,13 +16,13 @@ package zipkin // import "go.opentelemetry.io/otel/exporters/zipkin" import "os" -// Environment variable names +// Environment variable names. const ( - // Endpoint for Zipkin collector + // Endpoint for Zipkin collector. envEndpoint = "OTEL_EXPORTER_ZIPKIN_ENDPOINT" ) -// envOr returns an env variable's value if it is exists or the default if not +// envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { if v, ok := os.LookupEnv(key); ok && v != "" { return v diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index b32291d8852..e3a84ba6ac9 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -168,7 +168,7 @@ func attributesToJSONMapString(attributes []attribute.KeyValue) string { return (string)(jsonBytes) } -// attributeToStringPair serializes each attribute to a string pair +// attributeToStringPair serializes each attribute to a string pair. func attributeToStringPair(kv attribute.KeyValue) (string, string) { switch kv.Value.Type() { // For slice attributes, serialize as JSON list string. @@ -189,7 +189,7 @@ func attributeToStringPair(kv attribute.KeyValue) (string, string) { } } -// extraZipkinTags are those that may be added to every outgoing span +// extraZipkinTags are those that may be added to every outgoing span. var extraZipkinTags = []string{ "otel.status_code", keyInstrumentationLibraryName, diff --git a/handler.go b/handler.go index 35263e01ac2..b5797bceaa9 100644 --- a/handler.go +++ b/handler.go @@ -92,7 +92,7 @@ func SetErrorHandler(h ErrorHandler) { globalErrorHandler.setDelegate(h) } -// Handle is a convenience function for ErrorHandler().Handle(err) +// Handle is a convenience function for ErrorHandler().Handle(err). func Handle(err error) { GetErrorHandler().Handle(err) } diff --git a/internal/global/internal_logging.go b/internal/global/internal_logging.go index 0a378476b0f..ccb3258711a 100644 --- a/internal/global/internal_logging.go +++ b/internal/global/internal_logging.go @@ -33,7 +33,7 @@ var globalLoggerLock = &sync.RWMutex{} // SetLogger overrides the globalLogger with l. // // To see Info messages use a logger with `l.V(1).Enabled() == true` -// To see Debug messages use a logger with `l.V(5).Enabled() == true` +// To see Debug messages use a logger with `l.V(5).Enabled() == true`. func SetLogger(l logr.Logger) { globalLoggerLock.Lock() defer globalLoggerLock.Unlock() @@ -41,7 +41,7 @@ func SetLogger(l logr.Logger) { } // Info prints messages about the general state of the API or SDK. -// This should usually be less then 5 messages a minute +// This should usually be less then 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { globalLoggerLock.RLock() defer globalLoggerLock.RUnlock() diff --git a/internal/global/util_test.go b/internal/global/util_test.go index b066a74a20e..d0bca92f6c6 100644 --- a/internal/global/util_test.go +++ b/internal/global/util_test.go @@ -20,7 +20,7 @@ import ( ) // ResetForTest configures the test to restores the initial global state during -// its Cleanup step +// its Cleanup step. func ResetForTest(t testing.TB) { t.Cleanup(func() { globalTracer = defaultTracerValue() diff --git a/metric/example_test.go b/metric/example_test.go index 92e0e2cd958..ed5c80e208a 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -110,7 +110,7 @@ func ExampleMeter_asynchronous_multiple() { } } -//This is just an example, see the the contrib runtime instrumentation for real implementation +//This is just an example, see the the contrib runtime instrumentation for real implementation. func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) { } diff --git a/metric/global/global.go b/metric/global/global.go index 25071bb88ed..05a67c2e999 100644 --- a/metric/global/global.go +++ b/metric/global/global.go @@ -25,7 +25,7 @@ import ( // that code provides built-in instrumentation. If the instrumentationName is // empty, then a implementation defined default name will be used instead. // -// This is short for MeterProvider().Meter(name) +// This is short for MeterProvider().Meter(name). func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { return MeterProvider().Meter(instrumentationName, opts...) } diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index c98dfdf7c99..605771d105f 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -226,7 +226,7 @@ func (i *aiGauge) unwrap() instrument.Asynchronous { return nil } -//Sync Instruments +//Sync Instruments. type sfCounter struct { name string opts []instrument.Option diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 1acac5c20cc..0fa924f397c 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -201,7 +201,7 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async return out } -// SyncInt64 is the namespace for the Synchronous Integer instruments +// SyncInt64 is the namespace for the Synchronous Integer instruments. func (m *meter) SyncInt64() syncint64.InstrumentProvider { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.SyncInt64() @@ -209,7 +209,7 @@ func (m *meter) SyncInt64() syncint64.InstrumentProvider { return (*siInstProvider)(m) } -// SyncFloat64 is the namespace for the Synchronous Float instruments +// SyncFloat64 is the namespace for the Synchronous Float instruments. func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.SyncFloat64() diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index acd07de1847..ac6e93ebe38 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -69,19 +69,19 @@ func (m *testMeter) RegisterCallback(insts []instrument.Asynchronous, function f return nil } -// SyncInt64 is the namespace for the Synchronous Integer instruments +// SyncInt64 is the namespace for the Synchronous Integer instruments. func (m *testMeter) SyncInt64() syncint64.InstrumentProvider { m.siCount++ return &testSIInstrumentProvider{} } -// SyncFloat64 is the namespace for the Synchronous Float instruments +// SyncFloat64 is the namespace for the Synchronous Float instruments. func (m *testMeter) SyncFloat64() syncfloat64.InstrumentProvider { m.sfCount++ return &testSFInstrumentProvider{} } -// This enables async collection +// This enables async collection. func (m *testMeter) collect() { ctx := context.Background() for _, f := range m.callbacks { diff --git a/schema/v1.0/types/types.go b/schema/v1.0/types/types.go index 8d7e0583c1f..02caa4485a1 100644 --- a/schema/v1.0/types/types.go +++ b/schema/v1.0/types/types.go @@ -14,7 +14,7 @@ package types // import "go.opentelemetry.io/otel/schema/v1.0/types" -// TelemetryVersion is a version number key in the schema file (e.g. "1.7.0") +// TelemetryVersion is a version number key in the schema file (e.g. "1.7.0"). type TelemetryVersion string // SpanName is span name string. diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index 1a03bf7af49..5e94b8ae521 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -21,56 +21,47 @@ import ( "go.opentelemetry.io/otel/internal/global" ) -// Environment variable names +// Environment variable names. const ( - // BatchSpanProcessorScheduleDelayKey - // Delay interval between two consecutive exports. - // i.e. 5000 + // BatchSpanProcessorScheduleDelayKey is the delay interval between two + // consecutive exports (i.e. 5000). BatchSpanProcessorScheduleDelayKey = "OTEL_BSP_SCHEDULE_DELAY" - // BatchSpanProcessorExportTimeoutKey - // Maximum allowed time to export data. - // i.e. 3000 + // BatchSpanProcessorExportTimeoutKey is the maximum allowed time to + // export data (i.e. 3000). BatchSpanProcessorExportTimeoutKey = "OTEL_BSP_EXPORT_TIMEOUT" - // BatchSpanProcessorMaxQueueSizeKey - // Maximum queue size - // i.e. 2048 + // BatchSpanProcessorMaxQueueSizeKey is the maximum queue size (i.e. 2048). BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE" - // BatchSpanProcessorMaxExportBatchSizeKey - // Maximum batch size - // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize - // i.e. 512 + // BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e. + // 512). Note: it must be less than or equal to + // EnvBatchSpanProcessorMaxQueueSize. BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" - // AttributeValueLengthKey - // Maximum allowed attribute value size. + // AttributeValueLengthKey is the maximum allowed attribute value size. AttributeValueLengthKey = "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT" - // AttributeCountKey - // Maximum allowed span attribute count + // AttributeCountKey is the maximum allowed span attribute count. AttributeCountKey = "OTEL_ATTRIBUTE_COUNT_LIMIT" - // SpanAttributeValueLengthKey - // Maximum allowed attribute value size for a span. + // SpanAttributeValueLengthKey is the maximum allowed attribute value size + // for a span. SpanAttributeValueLengthKey = "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT" - // SpanAttributeCountKey - // Maximum allowed span attribute count for a span. + // SpanAttributeCountKey is the maximum allowed span attribute count for a + // span. SpanAttributeCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" - // SpanEventCountKey - // Maximum allowed span event count. + // SpanEventCountKey is the maximum allowed span event count. SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT" - // SpanEventAttributeCountKey - // Maximum allowed attribute per span event count. + // SpanEventAttributeCountKey is the maximum allowed attribute per span + // event count. SpanEventAttributeCountKey = "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT" - // SpanLinkCountKey - // Maximum allowed span link count. + // SpanLinkCountKey is the maximum allowed span link count. SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT" - // SpanLinkAttributeCountKey - // Maximum allowed attribute per span link count. + // SpanLinkAttributeCountKey is the maximum allowed attribute per span + // link count. SpanLinkAttributeCountKey = "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT" ) diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go index 6deb81192de..41fd45025ba 100644 --- a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go +++ b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go @@ -29,11 +29,11 @@ const ( SignificandMask = 1<