1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-02-03 13:11:53 +02:00
This commit is contained in:
Nathan Baulch 2024-09-09 16:53:15 +10:00 committed by GitHub
parent b37e8a9860
commit 506a9baf5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
53 changed files with 100 additions and 102 deletions

View File

@ -9,7 +9,7 @@ assignees: ''
<!-- markdownlint-disable MD034 -->
<!--- The current milestones can be found at https://github.com/open-telemetry/opentelemetry-go/milestones -->
- [ ] Complete [Milestone](https://github.com/open-telemetry/opentelemetry-go/milestone/<Release Milesone>)
- [ ] Complete [Milestone](https://github.com/open-telemetry/opentelemetry-go/milestone/<Release Milestone>)
<!-- markdownlint-enable MD034 -->
- [ ] [Update contrib codebase to support changes about to be released (use a git sha version)](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#verify-changes-for-contrib-repository)
- [ ] [Pre-release](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#pre-release)

View File

@ -64,12 +64,12 @@ issues:
- path: _test\.go
linters:
- gosec
# Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand)
# Ignoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand)
# as we commonly use it in tests and examples.
- text: "G404:"
linters:
- gosec
# Igonoring gosec G402: TLS MinVersion too low
# Ignoring gosec G402: TLS MinVersion too low
# as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well.
- text: "G402: TLS MinVersion too low."
linters:

View File

@ -1911,7 +1911,7 @@ with major version 0.
- Setting error status while recording error with Span from oteltest package. (#1729)
- The concept of a remote and local Span stored in a context is unified to just the current Span.
Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed.
Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContex` can be used to return the current Span.
Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContext` can be used to return the current Span.
If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731)
- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed.
This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749)
@ -2485,7 +2485,7 @@ This release migrates the default OpenTelemetry SDK into its own Go module, deco
- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903)
- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905)
- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913)
- Update otel-colector example to use the v0.5.0 collector. (#915)
- Update otel-collector example to use the v0.5.0 collector. (#915)
- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922)
- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922)
- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists.

View File

@ -37,7 +37,7 @@ func (o *Tracer) StartSpan(ctx context.Context, name string, s ...octrace.StartO
// StartSpanWithRemoteParent starts a new child span of the span from the
// given parent.
func (o *Tracer) StartSpanWithRemoteParent(ctx context.Context, name string, parent octrace.SpanContext, s ...octrace.StartOption) (context.Context, *octrace.Span) {
// make sure span context is zero'd out so we use the remote parent
// make sure span context is zeroed out so we use the remote parent
ctx = trace.ContextWithSpan(ctx, nil)
ctx = trace.ContextWithRemoteSpanContext(ctx, oc2otel.SpanContext(parent))
return o.StartSpan(ctx, name, s...)

View File

@ -108,7 +108,7 @@ func TestTracerFromContext(t *testing.T) {
ctx, _ = tracer.Start(ctx, "test")
got := internal.NewTracer(tracer).FromContext(ctx).SpanContext()
// Do not test the convedsion, only that the propagtion.
// Do not test the conversion, only the propagation.
want := otel2oc.SpanContext(sc)
if got != want {
t.Errorf("tracer.FromContext returned wrong context: %#v", got)

View File

@ -396,7 +396,7 @@ func TestBridgeTracer_StartSpan(t *testing.T) {
expectWarnings: []string(nil),
},
{
name: "with a non-defered wrapper tracer",
name: "with a non-deferred wrapper tracer",
before: func(t *testing.T, bridge *BridgeTracer) {
wTracer := &nonDeferWrapperTracer{
NewWrapperTracer(bridge, otel.Tracer("test")),

View File

@ -27,7 +27,7 @@ type Handler struct {
// to next.
func New(next func(r *http.Request)) *Handler {
// Like most instrumentation packages, this handler defaults to using the
// global progatators and tracer providers.
// global propagators and tracer providers.
return &Handler{
propagators: otel.GetTextMapPropagator(),
tracer: otel.Tracer("go.opentelemetry.io/otel/example/passthrough/handler"),

View File

@ -472,7 +472,7 @@ func convDuration(s string) (time.Duration, error) {
return time.Duration(d) * time.Millisecond, nil
}
// loadEnvTLS returns a resolver that loads a *tls.Config from files defeind by
// loadEnvTLS returns a resolver that loads a *tls.Config from files defined by
// the OTLP TLS environment variables. This will load both the rootCAs and
// certificates used for mTLS.
//

View File

@ -191,7 +191,7 @@ func TestNewConfig(t *testing.T) {
},
},
{
name: "LogEnpointEnvironmentVariablesDefaultPath",
name: "LogEndpointEnvironmentVariablesDefaultPath",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "http://env.endpoint",
},
@ -224,7 +224,7 @@ func TestNewConfig(t *testing.T) {
},
},
{
name: "OTLPEnpointEnvironmentVariablesDefaultPath",
name: "OTLPEndpointEnvironmentVariablesDefaultPath",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint",
},

View File

@ -66,7 +66,7 @@ func resourceLogsMap(dst *map[attribute.Distinct]*lpb.ResourceLogs, records []lo
}
}
// ScopeLogs returns a slice of OTLP ScopeLogs generated from recoreds.
// ScopeLogs returns a slice of OTLP ScopeLogs generated from records.
func ScopeLogs(records []log.Record) []*lpb.ScopeLogs {
scopeMap := scopeLogsMapPool.Get().(map[instrumentation.Scope]*lpb.ScopeLogs)
defer func() {

View File

@ -224,7 +224,7 @@ type httpCollector struct {
// default OTLP log endpoint path ("/v1/logs"). If the endpoint contains a
// prefix of "https" the server will generate weak self-signed TLS certificates
// and use them to server data. If the endpoint contains a path, that path will
// be used instead of the default OTLP metri endpoint path.
// be used instead of the default OTLP metric endpoint path.
//
// If errCh is not nil, the collector will respond to HTTP requests with errors
// sent on that channel. This means that if errCh is not nil Export calls will

View File

@ -377,7 +377,7 @@ func (s setting[T]) Resolve(fn ...resolver[T]) setting[T] {
return s
}
// loadEnvTLS returns a resolver that loads a *tls.Config from files defeind by
// loadEnvTLS returns a resolver that loads a *tls.Config from files defined by
// the OTLP TLS environment variables. This will load both the rootCAs and
// certificates used for mTLS.
//

View File

@ -190,7 +190,7 @@ func TestNewConfig(t *testing.T) {
},
},
{
name: "LogEnpointEnvironmentVariablesDefaultPath",
name: "LogEndpointEnvironmentVariablesDefaultPath",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "http://env.endpoint",
},
@ -225,7 +225,7 @@ func TestNewConfig(t *testing.T) {
},
},
{
name: "OTLPEnpointEnvironmentVariablesDefaultPath",
name: "OTLPEndpointEnvironmentVariablesDefaultPath",
envars: map[string]string{
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://env.endpoint",
},

View File

@ -22,7 +22,7 @@ target URL to which the exporter sends telemetry.
The value must contain a scheme ("http" or "https") and host.
The value may additionally contain a port and a path.
The value should not contain a query string or fragment.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithURLPath] options.
OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_LOGS_HEADERS (default: none) -
key-value pairs used as headers associated with HTTP requests.

View File

@ -66,7 +66,7 @@ func resourceLogsMap(dst *map[attribute.Distinct]*lpb.ResourceLogs, records []lo
}
}
// ScopeLogs returns a slice of OTLP ScopeLogs generated from recoreds.
// ScopeLogs returns a slice of OTLP ScopeLogs generated from records.
func ScopeLogs(records []log.Record) []*lpb.ScopeLogs {
scopeMap := scopeLogsMapPool.Get().(map[instrumentation.Scope]*lpb.ScopeLogs)
defer func() {

View File

@ -139,7 +139,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Metrics.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials))
} else if cfg.Metrics.Insecure {

View File

@ -14,7 +14,7 @@ import (
)
// ReadTLSConfigFromFile reads a PEM certificate file and creates
// a tls.Config that will use this certifate to verify a server certificate.
// a tls.Config that will use this certificate to verify a server certificate.
func ReadTLSConfigFromFile(path string) (*tls.Config, error) {
b, err := os.ReadFile(path)
if err != nil {

View File

@ -22,7 +22,7 @@ target URL to which the exporter sends telemetry.
The value must contain a scheme ("http" or "https") and host.
The value may additionally contain a port and a path.
The value should not contain a query string or fragment.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithURLPath] options.
OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS (default: none) -
key-value pairs used as headers associated with HTTP requests.

View File

@ -139,7 +139,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Metrics.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials))
} else if cfg.Metrics.Insecure {

View File

@ -14,7 +14,7 @@ import (
)
// ReadTLSConfigFromFile reads a PEM certificate file and creates
// a tls.Config that will use this certifate to verify a server certificate.
// a tls.Config that will use this certificate to verify a server certificate.
func ReadTLSConfigFromFile(path string) (*tls.Config, error) {
b, err := os.ReadFile(path)
if err != nil {

View File

@ -125,7 +125,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Traces.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials))
} else if cfg.Traces.Insecure {

View File

@ -35,7 +35,7 @@ var (
}
customUserAgentHeader = map[string]string{
"user-agent": "custome-user-agent",
"user-agent": "custom-user-agent",
}
customProxyHeader = map[string]string{

View File

@ -22,7 +22,7 @@ target URL to which the exporter sends telemetry.
The value must contain a scheme ("http" or "https") and host.
The value may additionally contain a port and a path.
The value should not contain a query string or fragment.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options.
The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithURLPath] options.
OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) -
key-value pairs used as headers associated with HTTP requests.

View File

@ -125,7 +125,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Traces.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials))
} else if cfg.Traces.Insecure {

View File

@ -28,12 +28,12 @@ import (
func TestPrometheusExporter(t *testing.T) {
testCases := []struct {
name string
emptyResource bool
customResouceAttrs []attribute.KeyValue
recordMetrics func(ctx context.Context, meter otelmetric.Meter)
options []Option
expectedFile string
name string
emptyResource bool
customResourceAttrs []attribute.KeyValue
recordMetrics func(ctx context.Context, meter otelmetric.Meter)
options []Option
expectedFile string
}{
{
name: "counter",
@ -264,7 +264,7 @@ func TestPrometheusExporter(t *testing.T) {
},
{
name: "custom resource",
customResouceAttrs: []attribute.KeyValue{
customResourceAttrs: []attribute.KeyValue{
attribute.Key("A").String("B"),
attribute.Key("C").String("D"),
},
@ -417,7 +417,7 @@ func TestPrometheusExporter(t *testing.T) {
resource.WithAttributes(semconv.ServiceName("prometheus_test")),
// Overwrite the semconv.TelemetrySDKVersionKey value so we don't need to update every version
resource.WithAttributes(semconv.TelemetrySDKVersion("latest")),
resource.WithAttributes(tc.customResouceAttrs...),
resource.WithAttributes(tc.customResourceAttrs...),
)
require.NoError(t, err)
@ -536,7 +536,7 @@ func TestDuplicateMetrics(t *testing.T) {
withTypeFoo := otelmetric.WithAttributeSet(typeFoo)
testCases := []struct {
name string
customResouceAttrs []attribute.KeyValue
customResourceAttrs []attribute.KeyValue
recordMetrics func(ctx context.Context, meterA, meterB otelmetric.Meter)
options []Option
possibleExpectedFiles []string

View File

@ -234,7 +234,7 @@ func TestMeterProviderDelegatesCalls(t *testing.T) {
assert.Equal(t, 1, tMeter.siHist)
assert.Equal(t, 1, len(tMeter.callbacks))
// Because the Meter was provided by testmeterProvider it should also return our test instrument
// Because the Meter was provided by testMeterProvider it should also return our test instrument
require.IsType(t, &testCountingFloatInstrument{}, ctr, "the meter did not delegate calls to the meter")
assert.Equal(t, 1, ctr.(*testCountingFloatInstrument).count)
@ -283,11 +283,11 @@ func TestMeterDelegatesCalls(t *testing.T) {
assert.Equal(t, 1, tMeter.siUDCount)
assert.Equal(t, 1, tMeter.siHist)
// Because the Meter was provided by testmeterProvider it should also return our test instrument
// Because the Meter was provided by testMeterProvider it should also return our test instrument
require.IsType(t, &testCountingFloatInstrument{}, ctr, "the meter did not delegate calls to the meter")
assert.Equal(t, 1, ctr.(*testCountingFloatInstrument).count)
// Because the Meter was provided by testmeterProvider it should also return our test instrument
// Because the Meter was provided by testMeterProvider it should also return our test instrument
require.IsType(t, &testCountingFloatInstrument{}, actr, "the meter did not delegate calls to the meter")
assert.Equal(t, 1, actr.(*testCountingFloatInstrument).count)

View File

@ -66,7 +66,7 @@ func resourceLogsMap(dst *map[attribute.Distinct]*lpb.ResourceLogs, records []lo
}
}
// ScopeLogs returns a slice of OTLP ScopeLogs generated from recoreds.
// ScopeLogs returns a slice of OTLP ScopeLogs generated from records.
func ScopeLogs(records []log.Record) []*lpb.ScopeLogs {
scopeMap := scopeLogsMapPool.Get().(map[instrumentation.Scope]*lpb.ScopeLogs)
defer func() {

View File

@ -139,7 +139,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Metrics.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials))
} else if cfg.Metrics.Insecure {

View File

@ -14,7 +14,7 @@ import (
)
// ReadTLSConfigFromFile reads a PEM certificate file and creates
// a tls.Config that will use this certifate to verify a server certificate.
// a tls.Config that will use this certificate to verify a server certificate.
func ReadTLSConfigFromFile(path string) (*tls.Config, error) {
b, err := os.ReadFile(path)
if err != nil {

View File

@ -125,7 +125,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
if cfg.ServiceConfig != "" {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig))
}
// Priroritize GRPCCredentials over Insecure (passing both is an error).
// Prioritize GRPCCredentials over Insecure (passing both is an error).
if cfg.Traces.GRPCCredentials != nil {
cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials))
} else if cfg.Traces.Insecure {

View File

@ -105,16 +105,16 @@ is defined as `Record` struct in [record.go](record.go).
is accessed using following methods:
```go
func (r *Record) Timestamp() time.Time
func (r *Record) SetTimestamp(t time.Time)
func (r *Record) Timestamp() time.Time
func (r *Record) SetTimestamp(t time.Time)
```
[`ObservedTimestamp`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-observedtimestamp)
is accessed using following methods:
```go
func (r *Record) ObservedTimestamp() time.Time
func (r *Record) SetObservedTimestamp(t time.Time)
func (r *Record) ObservedTimestamp() time.Time
func (r *Record) SetObservedTimestamp(t time.Time)
```
[`SeverityNumber`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitynumber)
@ -307,7 +307,7 @@ The API needs to evolve orthogonally to `slog`.
`slog` is not compliant with the [Logs Bridge API](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/).
and we cannot expect the Go team to make `slog` compliant with it.
The interoperabilty can be achieved using [a log bridge](https://opentelemetry.io/docs/specs/otel/glossary/#log-appender--bridge).
The interoperability can be achieved using [a log bridge](https://opentelemetry.io/docs/specs/otel/glossary/#log-appender--bridge).
You can read more about OpenTelemetry Logs design on [opentelemetry.io](https://opentelemetry.io/docs/concepts/signals/logs/).

View File

@ -213,7 +213,7 @@ type Float64Observer interface {
}
// Float64Callback is a function registered with a Meter that makes
// observations for a Float64Observerable instrument it is registered with.
// observations for a Float64Observable instrument it is registered with.
// Calls to the Float64Observer record measurement values for the
// Float64Observable.
//

View File

@ -212,7 +212,7 @@ type Int64Observer interface {
}
// Int64Callback is a function registered with a Meter that makes observations
// for an Int64Observerable instrument it is registered with. Calls to the
// for an Int64Observable instrument it is registered with. Calls to the
// Int64Observer record measurement values for the Int64Observable.
//
// The function needs to complete in a finite amount of time and the deadline

View File

@ -122,12 +122,12 @@ The benchmark results can be found in [the prototype](https://github.com/open-te
## Rejected alternatives
### Represent both LogRecordProcessor and LogRecordExporter as Expoter
### Represent both LogRecordProcessor and LogRecordExporter as Exporter
Because the [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordprocessor)
and the [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordexporter)
abstractions are so similar, there was a proposal to unify them under
single `Expoter` interface.[^3]
single `Exporter` interface.[^3]
However, introducing a `Processor` interface makes it easier
to create custom processor decorators[^4]
@ -170,7 +170,7 @@ parameters.
[^1]: [A Guide to the Go Garbage Collector](https://tip.golang.org/doc/gc-guide)
[^2]: [OpenTelemetry Logging](https://opentelemetry.io/docs/specs/otel/logs)
[^3]: [Conversation on representing LogRecordProcessor and LogRecordExporter via a single Expoter interface](https://github.com/open-telemetry/opentelemetry-go/pull/4954#discussion_r1515050480)
[^3]: [Conversation on representing LogRecordProcessor and LogRecordExporter via a single Exporter interface](https://github.com/open-telemetry/opentelemetry-go/pull/4954#discussion_r1515050480)
[^4]: [Introduce Processor](https://github.com/pellared/opentelemetry-go/pull/9)
[^5]: [Log record mutations do not have to be visible in next registered processors](https://github.com/open-telemetry/opentelemetry-specification/pull/4067)
[^6]: [Profile-guided optimization](https://go.dev/doc/pgo)

View File

@ -70,12 +70,12 @@ func ExampleProcessor_filtering() {
type key struct{}
var igoreLogsKey key
var ignoreLogsKey key
// WithIgnoreLogs returns a context which is used by [ContextFilterProcessor]
// to filter out log records.
func WithIgnoreLogs(ctx context.Context) context.Context {
return context.WithValue(ctx, igoreLogsKey, true)
return context.WithValue(ctx, ignoreLogsKey, true)
}
// ContextFilterProcessor filters out logs when a context deriving from
@ -110,7 +110,7 @@ func (p *ContextFilterProcessor) Enabled(ctx context.Context, record log.Record)
}
func ignoreLogs(ctx context.Context) bool {
_, ok := ctx.Value(igoreLogsKey).(bool)
_, ok := ctx.Value(ignoreLogsKey).(bool)
return ok
}

View File

@ -58,7 +58,7 @@ func (s *SimpleProcessor) OnEmit(ctx context.Context, r *Record) error {
return s.exporter.Export(ctx, *records)
}
// Shutdown shuts down the expoter.
// Shutdown shuts down the exporter.
func (s *SimpleProcessor) Shutdown(ctx context.Context) error {
if s.exporter == nil {
return nil

View File

@ -234,8 +234,8 @@ func (i *float64Inst) aggregate(ctx context.Context, val float64, s attribute.Se
}
}
// observablID is a comparable unique identifier of an observable.
type observablID[N int64 | float64] struct {
// observableID is a comparable unique identifier of an observable.
type observableID[N int64 | float64] struct {
name string
description string
kind InstrumentKind
@ -287,7 +287,7 @@ func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string) int
type observable[N int64 | float64] struct {
metric.Observable
observablID[N]
observableID[N]
meter *meter
measures measures[N]
@ -296,7 +296,7 @@ type observable[N int64 | float64] struct {
func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, u string) *observable[N] {
return &observable[N]{
observablID: observablID[N]{
observableID: observableID[N]{
name: name,
description: desc,
kind: kind,

View File

@ -326,7 +326,7 @@ func TestHistogramImmutableBounds(t *testing.T) {
assert.Equal(t, cpB, h.bounds, "modifying the Aggregation bounds should not change the bounds")
}
func TestCumulativeHistogramImutableCounts(t *testing.T) {
func TestCumulativeHistogramImmutableCounts(t *testing.T) {
h := newHistogram[int64](bounds, noMinMax, false, 0, dropExemplars[int64])
h.measure(context.Background(), 5, alice, nil)

View File

@ -142,7 +142,7 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int {
}
// newPrecomputedSum returns an aggregator that summarizes a set of
// observatrions as their arithmetic sum. Each sum is scoped by attributes and
// observations as their arithmetic sum. Each sum is scoped by attributes and
// the aggregation cycle the measurements were made in.
func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func() exemplar.FilteredReservoir[N]) *precomputedSum[N] {
return &precomputedSum[N]{
@ -152,7 +152,7 @@ func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func() ex
}
}
// precomputedSum summarizes a set of observatrions as their arithmetic sum.
// precomputedSum summarizes a set of observations as their arithmetic sum.
type precomputedSum[N int64 | float64] struct {
*valueMap[N]

View File

@ -19,7 +19,7 @@ var (
// Do not use crypto/rand. There is no reason for the decrease in performance
// given this is not a security sensitive decision.
rng = rand.New(rand.NewSource(time.Now().UnixNano()))
// Ensure concurrent safe accecess to rng and its underlying source.
// Ensure concurrent safe access to rng and its underlying source.
rngMu sync.Mutex
)

View File

@ -18,7 +18,7 @@ import (
// Sat Jan 01 2000 00:00:00 GMT+0000.
var staticTime = time.Unix(946684800, 0)
type factory func(requstedCap int) (r Reservoir, actualCap int)
type factory func(requestedCap int) (r Reservoir, actualCap int)
func ReservoirTest[N int64 | float64](f factory) func(*testing.T) {
return func(t *testing.T) {

View File

@ -459,7 +459,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable)
}
continue
}
reg.registerInt64(o.observablID)
reg.registerInt64(o.observableID)
case float64Observable:
if err := o.registerable(m); err != nil {
if !errors.Is(err, errEmptyAgg) {
@ -467,7 +467,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable)
}
continue
}
reg.registerFloat64(o.observablID)
reg.registerFloat64(o.observableID)
default:
// Instrument external to the SDK.
return nil, fmt.Errorf("invalid observable: from different implementation")
@ -488,14 +488,14 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable)
type observer struct {
embedded.Observer
float64 map[observablID[float64]]struct{}
int64 map[observablID[int64]]struct{}
float64 map[observableID[float64]]struct{}
int64 map[observableID[int64]]struct{}
}
func newObserver() observer {
return observer{
float64: make(map[observablID[float64]]struct{}),
int64: make(map[observablID[int64]]struct{}),
float64: make(map[observableID[float64]]struct{}),
int64: make(map[observableID[int64]]struct{}),
}
}
@ -503,11 +503,11 @@ func (r observer) len() int {
return len(r.float64) + len(r.int64)
}
func (r observer) registerFloat64(id observablID[float64]) {
func (r observer) registerFloat64(id observableID[float64]) {
r.float64[id] = struct{}{}
}
func (r observer) registerInt64(id observablID[int64]) {
func (r observer) registerInt64(id observableID[int64]) {
r.int64[id] = struct{}{}
}
@ -536,7 +536,7 @@ func (r observer) ObserveFloat64(o metric.Float64Observable, v float64, opts ...
return
}
if _, registered := r.float64[oImpl.observablID]; !registered {
if _, registered := r.float64[oImpl.observableID]; !registered {
if !oImpl.dropAggregation {
global.Error(errUnregObserver, "failed to record",
"name", oImpl.name,
@ -571,7 +571,7 @@ func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric
return
}
if _, registered := r.int64[oImpl.observablID]; !registered {
if _, registered := r.int64[oImpl.observableID]; !registered {
if !oImpl.dropAggregation {
global.Error(errUnregObserver, "failed to record",
"name", oImpl.name,

View File

@ -1171,13 +1171,13 @@ func TestUnregisterUnregisters(t *testing.T) {
int64Gauge, err := m.Int64ObservableGauge("int64.gauge")
require.NoError(t, err)
floag64Counter, err := m.Float64ObservableCounter("floag64.counter")
float64Counter, err := m.Float64ObservableCounter("float64.counter")
require.NoError(t, err)
floag64UpDownCounter, err := m.Float64ObservableUpDownCounter("floag64.up_down_counter")
float64UpDownCounter, err := m.Float64ObservableUpDownCounter("float64.up_down_counter")
require.NoError(t, err)
floag64Gauge, err := m.Float64ObservableGauge("floag64.gauge")
float64Gauge, err := m.Float64ObservableGauge("float64.gauge")
require.NoError(t, err)
var called bool
@ -1189,9 +1189,9 @@ func TestUnregisterUnregisters(t *testing.T) {
int64Counter,
int64UpDownCounter,
int64Gauge,
floag64Counter,
floag64UpDownCounter,
floag64Gauge,
float64Counter,
float64UpDownCounter,
float64Gauge,
)
require.NoError(t, err)
@ -1225,13 +1225,13 @@ func TestRegisterCallbackDropAggregations(t *testing.T) {
int64Gauge, err := m.Int64ObservableGauge("int64.gauge")
require.NoError(t, err)
floag64Counter, err := m.Float64ObservableCounter("floag64.counter")
float64Counter, err := m.Float64ObservableCounter("float64.counter")
require.NoError(t, err)
floag64UpDownCounter, err := m.Float64ObservableUpDownCounter("floag64.up_down_counter")
float64UpDownCounter, err := m.Float64ObservableUpDownCounter("float64.up_down_counter")
require.NoError(t, err)
floag64Gauge, err := m.Float64ObservableGauge("floag64.gauge")
float64Gauge, err := m.Float64ObservableGauge("float64.gauge")
require.NoError(t, err)
var called bool
@ -1243,9 +1243,9 @@ func TestRegisterCallbackDropAggregations(t *testing.T) {
int64Counter,
int64UpDownCounter,
int64Gauge,
floag64Counter,
floag64UpDownCounter,
floag64Gauge,
float64Counter,
float64UpDownCounter,
float64Gauge,
)
require.NoError(t, err)

View File

@ -425,7 +425,7 @@ func BenchmarkPeriodicReader(b *testing.B) {
require.NoError(b, r.Shutdown(context.Background()))
}
func TestPeriodiclReaderTemporality(t *testing.T) {
func TestPeriodicReaderTemporality(t *testing.T) {
tests := []struct {
name string
exporter *fnExporter

View File

@ -10,17 +10,16 @@ import (
"golang.org/x/sys/windows/registry"
)
// implements hostIDReader
// implements hostIDReader.
type hostIDReaderWindows struct{}
// read reads MachineGuid from the windows registry key:
// SOFTWARE\Microsoft\Cryptography
// read reads MachineGuid from the Windows registry key:
// SOFTWARE\Microsoft\Cryptography.
func (*hostIDReaderWindows) read() (string, error) {
k, err := registry.OpenKey(
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`,
registry.QUERY_VALUE|registry.WOW64_64KEY,
)
if err != nil {
return "", err
}

View File

@ -96,7 +96,7 @@ ESCAPED4="\\var"
=line with missing key should be skipped
PROP1=name=john
PROP2 = Value
PROP2 = Value
PROP3='This value will be overwritten by the next one'
PROP3='Final value'`)

View File

@ -17,7 +17,6 @@ import (
func platformOSDescription() (string, error) {
k, err := registry.OpenKey(
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
if err != nil {
return "", err
}

View File

@ -452,7 +452,7 @@ func TestNew(t *testing.T) {
}
}
func TestNewWrapedError(t *testing.T) {
func TestNewWrappedError(t *testing.T) {
localErr := errors.New("local error")
_, err := resource.New(
context.Background(),

View File

@ -297,7 +297,7 @@ func TestRequestHeader(t *testing.T) {
}, got)
}
func TestReponseHeader(t *testing.T) {
func TestResponseHeader(t *testing.T) {
ips := []string{"127.0.0.5", "127.0.0.9"}
user := []string{"alice"}
h := http.Header{"ips": ips, "user": user}

View File

@ -297,7 +297,7 @@ func TestRequestHeader(t *testing.T) {
}, got)
}
func TestReponseHeader(t *testing.T) {
func TestResponseHeader(t *testing.T) {
ips := []string{"127.0.0.5", "127.0.0.9"}
user := []string{"alice"}
h := http.Header{"ips": ips, "user": user}

View File

@ -323,7 +323,7 @@ func TestRequestHeader(t *testing.T) {
}, got)
}
func TestReponseHeader(t *testing.T) {
func TestResponseHeader(t *testing.T) {
ips := []string{"127.0.0.5", "127.0.0.9"}
user := []string{"alice"}
h := http.Header{"ips": ips, "user": user}

View File

@ -22,7 +22,7 @@ func ContextWithSpanContext(parent context.Context, sc SpanContext) context.Cont
return ContextWithSpan(parent, nonRecordingSpan{sc: sc})
}
// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicly
// ContextWithRemoteSpanContext returns a copy of parent with rsc set explicitly
// as a remote SpanContext and as the current Span. The Span implementation
// that wraps rsc is non-recording and performs no operations other than to
// return rsc as the SpanContext from the SpanContext method.

View File

@ -96,7 +96,7 @@ can embed the API interface directly.
This option is not recommended. It will lead to publishing packages that
contain runtime panics when users update to newer versions of
[go.opentelemetry.io/otel/trace], which may be done with a trasitive
[go.opentelemetry.io/otel/trace], which may be done with a transitive
dependency.
Finally, an author can embed another implementation in theirs. The embedded