diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 00000000000..6299dcf9273 --- /dev/null +++ b/.codespellignore @@ -0,0 +1,3 @@ +ot +fo + diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..e2cb3ea944b --- /dev/null +++ b/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,go.mod,go.sum,go.work,go.work.sum,semconv,venv,.tools +uri-ignore-words-list = * +write = diff --git a/.github/ISSUE_TEMPLATE/owner.md b/.github/ISSUE_TEMPLATE/owner.md index 834b66c10f0..39506162c67 100644 --- a/.github/ISSUE_TEMPLATE/owner.md +++ b/.github/ISSUE_TEMPLATE/owner.md @@ -20,7 +20,7 @@ Module: [e.g. go.opentelemetry.io/contrib/zpages] [member of the OpenTelemetry organization]: https://github.com/open-telemetry/community/blob/main/community-membership.md#member -### Relvant experience +### Relevant experience List any PRs/Issues you have interacted with in this repository for this module. diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 29c95172f97..2cd1e4d2676 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,6 @@ # This action requires that any PR targeting the main branch should touch at # least one CHANGELOG file. If a CHANGELOG entry is not required, or if -# performing maintance on the Changelog, add either \"[chore]\" to the title of +# performing maintenance on the Changelog, add either \"[chore]\" to the title of # the pull request or add the \"Skip Changelog\" label to disable this action. name: changelog diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d370e3be27..43fa8765428 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,7 +105,7 @@ jobs: go-version: ["~1.22.3", "~1.21.10"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default - # runners. It is possible to acomplish this with a self-hosted runner + # runners. It is possible to accomplish this with a self-hosted runner # if we want to add this in the future: # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow arch: ["386", amd64] diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000000..865596f9f27 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,14 @@ +name: codespell +on: + push: + branches: + - main + pull_request: +jobs: + codespell: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Codespell + run: make codespell \ No newline at end of file diff --git a/.gitignore b/.gitignore index becf2605870..fcbbf1441d5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ Thumbs.db .tools/ +venv/ .idea/ .vscode/ *.iml diff --git a/.golangci.yml b/.golangci.yml index 4691ddbf412..e3962bf918f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -106,7 +106,7 @@ linters-settings: - name: constant-logical-expr disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument - # TODO (#2877) reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 + # TODO (#2877) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - name: context-as-argument disabled: true arguments: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9fa7b46748..f474e2a3356 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,7 +104,7 @@ A pull request is considered ready to merge when the following criteria are meet Any Maintainer can merge the pull request once it is ready to merge. [^1]: The `go.opentelemetry.io/contrib/instrgen` module is exempt from the two approvals and one day requirement. - Only one approval is needed to merge a Pull Request for that module and there is no minimum amout of time required for the PR to be open before merging. + Only one approval is needed to merge a Pull Request for that module and there is no minimum amount of time required for the PR to be open before merging. This exemption is to be removed when that package makes its first tagged release. ### Draft Pull Requests diff --git a/Makefile b/Makefile index f80154fc4b9..9404d8203a6 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,39 @@ $(GOVULNCHECK): PACKAGE=golang.org/x/vuln/cmd/govulncheck tools: $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(MULTIMOD) $(CROSSLINK) $(GOTMPL) $(GORELEASE) $(GOJSONSCHEMA) $(GOVULNCHECK) +# Virtualized python tools via docker + +# The directory where the virtual environment is created. +VENVDIR := venv + +# The directory where the python tools are installed. +PYTOOLS := $(VENVDIR)/bin + +# The pip executable in the virtual environment. +PIP := $(PYTOOLS)/pip + +# The directory in the docker image where the current directory is mounted. +WORKDIR := /workdir + +# The python image to use for the virtual environment. +PYTHONIMAGE := python:3.11.3-slim-bullseye + +# Run the python image with the current directory mounted. +DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) + +# Create a virtual environment for Python tools. +$(PYTOOLS): +# The `--upgrade` flag is needed to ensure that the virtual environment is +# created with the latest pip version. + @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" + +# Install python packages into the virtual environment. +$(PYTOOLS)/%: $(PYTOOLS) + @$(DOCKERPY) $(PIP) install -r requirements.txt + +CODESPELL = $(PYTOOLS)/codespell +$(CODESPELL): PACKAGE=codespell + # Generate .PHONY: generate @@ -315,3 +348,7 @@ genjsonschema: genjsonschema-cleanup $(GOJSONSCHEMA) mv ${GENERATED_CONFIG}.tmp ${GENERATED_CONFIG} $(MAKE) lint $(MAKE) genjsonschema-cleanup + +.PHONY: codespell +codespell: $(CODESPELL) + @$(DOCKERPY) $(CODESPELL) \ No newline at end of file diff --git a/RELEASING.md b/RELEASING.md index ccc340f1d5f..b2b5700a147 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -15,7 +15,7 @@ go.opentelemetry.io/otel packages are compatible with the contrib repository. Follow the following steps to verify the changes. 1. Pick the GIT SHA on the [main branch](https://github.com/open-telemetry/opentelemetry-go/commits/main) that you want to verify. -2. Run the following command to update the OTel depencies with the GIT SHA picked in step 1. +2. Run the following command to update the OTel dependencies with the GIT SHA picked in step 1. ```sh export GITSHA= diff --git a/config/metric.go b/config/metric.go index 4763406b529..fade5e56fe7 100644 --- a/config/metric.go +++ b/config/metric.go @@ -222,7 +222,7 @@ func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmet mux := http.NewServeMux() mux.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg})) server := http.Server{ - // Timeouts are necessary to make a server resilent to attacks, but ListenAndServe doesn't set any. + // Timeouts are necessary to make a server resilient to attacks, but ListenAndServe doesn't set any. // We use values from this example: https://blog.cloudflare.com/exposing-go-on-the-internet/#:~:text=There%20are%20three%20main%20timeouts ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index f4f54b6ffb7..fe8c5539a3e 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -220,7 +220,7 @@ func TestLogsAttributesAlternatePartition(t *testing.T) { ContainerARN: "arn:arn-partition:arn-svc:arn-region:arn-account:arn-resource", } actualAttributes, err := detector.getLogsAttributes(containerMetadata) - assert.NoError(t, err, "failure with nonstandard partitition") + assert.NoError(t, err, "failure with nonstandard partition") expectedAttributes := []attribute.KeyValue{ semconv.AWSLogGroupNames(containerMetadata.LogOptions.AwsLogsGroup), diff --git a/doc.go b/doc.go index 97b4b02e33c..7e55ed00182 100644 --- a/doc.go +++ b/doc.go @@ -2,6 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // Package contrib is a collection of extensions for the opentelemetry-go -// project. It provides 3rd parth resource detectors, propagators, samplers, +// project. It provides 3rd party resource detectors, propagators, samplers, // bridges, and instrumentation as submodules. package contrib // import "go.opentelemetry.io/contrib" diff --git a/exporters/autoexport/metrics.go b/exporters/autoexport/metrics.go index 0dcb6c0cc53..25270de7f9a 100644 --- a/exporters/autoexport/metrics.go +++ b/exporters/autoexport/metrics.go @@ -65,7 +65,7 @@ func WithFallbackMetricReader(metricReaderFactory func(ctx context.Context) (met // Use [WithFallbackMetricReader] option to change the returned exporter // when OTEL_METRICS_EXPORTER is unset or empty. // -// Use [IsNoneMetricReader] to check if the retured exporter is a "no operation" exporter. +// Use [IsNoneMetricReader] to check if the returned exporter is a "no operation" exporter. func NewMetricReader(ctx context.Context, opts ...MetricOption) (metric.Reader, error) { return metricsSignal.create(ctx, opts...) } @@ -172,7 +172,7 @@ func init() { mux := http.NewServeMux() mux.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg})) server := http.Server{ - // Timeouts are necessary to make a server resilent to attacks, but ListenAndServe doesn't set any. + // Timeouts are necessary to make a server resilient to attacks, but ListenAndServe doesn't set any. // We use values from this example: https://blog.cloudflare.com/exposing-go-on-the-internet/#:~:text=There%20are%20three%20main%20timeouts ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, diff --git a/exporters/autoexport/spans.go b/exporters/autoexport/spans.go index c25dc9b0ae7..0a627ae8be5 100644 --- a/exporters/autoexport/spans.go +++ b/exporters/autoexport/spans.go @@ -49,7 +49,7 @@ func WithFallbackSpanExporter(spanExporterFactory func(ctx context.Context) (tra // Use [WithFallbackSpanExporter] option to change the returned exporter // when OTEL_TRACES_EXPORTER is unset or empty. // -// Use [IsNoneSpanExporter] to check if the retured exporter is a "no operation" exporter. +// Use [IsNoneSpanExporter] to check if the returned exporter is a "no operation" exporter. func NewSpanExporter(ctx context.Context, opts ...SpanOption) (trace.SpanExporter, error) { return tracesSignal.create(ctx, opts...) } diff --git a/instrgen/lib/analysis.go b/instrgen/lib/analysis.go index 395fe50ed26..f13d9f10121 100644 --- a/instrgen/lib/analysis.go +++ b/instrgen/lib/analysis.go @@ -14,7 +14,7 @@ import ( "golang.org/x/tools/go/packages" ) -// PackageAnalysis analyze all package set accrding to passed +// PackageAnalysis analyze all package set according to passed // pattern. It requires an information about path, pattern, // root functions - entry points, function declarations, // and so on. diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/README.md b/instrumentation/github.com/aws/aws-lambda-go/otellambda/README.md index 8cb985b9e34..a469a85f73b 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/README.md +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/README.md @@ -73,7 +73,7 @@ type mockHTTPRequest struct { func mockEventToCarrier(eventJSON []byte) propagation.TextMapCarrier{ var request mockHTTPRequest _ = json.unmarshal(eventJSON, &request) - return propogation.HeaderCarrier{someHeaderKey: []string{request.Headers[someHeaderKey]}} + return propagation.HeaderCarrier{someHeaderKey: []string{request.Headers[someHeaderKey]}} } type mockPropagator struct{} diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/mock_collector_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/mock_collector_test.go index c1cff33f4ec..538a199b2f7 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/mock_collector_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/mock_collector_test.go @@ -185,7 +185,7 @@ func (l *listener) Accept() (net.Conn, error) { return conn, nil } -// WaitForConn will wait indefintely for a connection to be estabilished with +// WaitForConn will wait indefintely for a connection to be established with // the listener before returning. func (l *listener) WaitForConn() { for { diff --git a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/version.go b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/version.go index 8146a3beaf1..c2a0ad4d952 100644 --- a/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/version.go +++ b/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test/version.go @@ -3,7 +3,7 @@ package test // import "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws/test" -// Version is the current release version of the AWS intstrumentation test module. +// Version is the current release version of the AWS instrumentation test module. func Version() string { return "0.52.0" // This string is updated by the pre_release.sh script during release diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go index 82cfcbc0bc4..870fdbbf3ef 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go @@ -59,7 +59,7 @@ func WithTracerProvider(provider oteltrace.TracerProvider) Option { }) } -// WithPublicEndpointFn runs with every request, and allows conditionnally +// WithPublicEndpointFn runs with every request, and allows conditionally // configuring the Handler to link the span with an incoming span context. If // this option is not provided or returns false, then the association is a // child association instead of a link. diff --git a/instrumentation/github.com/gorilla/mux/otelmux/config.go b/instrumentation/github.com/gorilla/mux/otelmux/config.go index 2900924838b..0f9b24242a0 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/config.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/config.go @@ -44,7 +44,7 @@ func WithPublicEndpoint() Option { }) } -// WithPublicEndpointFn runs with every request, and allows conditionnally +// WithPublicEndpointFn runs with every request, and allows conditionally // configuring the Handler to link the span with an incoming span context. If // this option is not provided or returns false, then the association is a // child association instead of a link. diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/doc.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/doc.go index 6930cc15e9e..8df3cb766c8 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/doc.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/doc.go @@ -3,7 +3,7 @@ // Package otelmongo instruments go.mongodb.org/mongo-driver/mongo. // -// This package is compatable with v0.2.0 of +// This package is compatible with v0.2.0 of // go.mongodb.org/mongo-driver/mongo. // // `NewMonitor` will return an event.CommandMonitor which is used to trace diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go index 4fdd270536b..b3c56ccc1bf 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go @@ -95,7 +95,7 @@ func (m *monitor) Finished(evt *event.CommandFinishedEvent, err error) { span.End() } -// TODO sanitize values where possible, then reenable `db.statement` span attributes default. +// TODO sanitize values where possible, then re-enable `db.statement` span attributes default. // TODO limit maximum size. func sanitizeCommand(command bson.Raw) string { b, _ := bson.MarshalExtJSON(command, false, false) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/instrumentation/google.golang.org/grpc/otelgrpc/config.go index a199b36b4fa..ab091cf6ade 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -30,7 +30,7 @@ const ( type InterceptorFilter func(*InterceptorInfo) bool // Filter is a predicate used to determine whether a given request in -// should be instrumented by the attatched RPC tag info. +// should be instrumented by the attached RPC tag info. // A Filter must return true if the request should be instrumented. type Filter func(*stats.RPCTagInfo) bool diff --git a/instrumentation/net/http/otelhttp/client.go b/instrumentation/net/http/otelhttp/client.go index deea149645c..6aae83bfd20 100644 --- a/instrumentation/net/http/otelhttp/client.go +++ b/instrumentation/net/http/otelhttp/client.go @@ -12,7 +12,7 @@ import ( ) // DefaultClient is the default Client and is used by Get, Head, Post and PostForm. -// Please be careful of intitialization order - for example, if you change +// Please be careful of initialization order - for example, if you change // the global propagator, the DefaultClient might still be using the old one. var DefaultClient = &http.Client{Transport: NewTransport(http.DefaultTransport)} diff --git a/instrumentation/net/http/otelhttp/config.go b/instrumentation/net/http/otelhttp/config.go index c1015a9eccf..f0a9bb9efeb 100644 --- a/instrumentation/net/http/otelhttp/config.go +++ b/instrumentation/net/http/otelhttp/config.go @@ -100,7 +100,7 @@ func WithPublicEndpoint() Option { }) } -// WithPublicEndpointFn runs with every request, and allows conditionnally +// WithPublicEndpointFn runs with every request, and allows conditionally // configuring the Handler to link the span with an incoming span context. If // this option is not provided or returns false, then the association is a // child association instead of a link. diff --git a/instrumentation/runtime/runtime.go b/instrumentation/runtime/runtime.go index e4384cd8347..45d387dbb50 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -24,7 +24,7 @@ type runtime struct { // config contains optional settings for reporting runtime metrics. type config struct { - // MinimumReadMemStatsInterval sets the mininum interval + // MinimumReadMemStatsInterval sets the minimum interval // between calls to runtime.ReadMemStats(). Negative values // are ignored. MinimumReadMemStatsInterval time.Duration diff --git a/propagators/autoprop/registry_test.go b/propagators/autoprop/registry_test.go index e790ad585bb..4f448aae5dd 100644 --- a/propagators/autoprop/registry_test.go +++ b/propagators/autoprop/registry_test.go @@ -56,7 +56,7 @@ func TestRegistryConcurrentSafe(t *testing.T) { assert.NotPanics(t, func() { v, ok := r.load(propName) assert.True(t, ok, "missing propagator in registry") - assert.Equal(t, noop, v, "wrong propagator retuned") + assert.Equal(t, noop, v, "wrong propagator returned") }) }() diff --git a/propagators/b3/b3_data_test.go b/propagators/b3/b3_data_test.go index 36aedbd18e5..35a92775565 100644 --- a/propagators/b3/b3_data_test.go +++ b/propagators/b3/b3_data_test.go @@ -1010,7 +1010,7 @@ var injectInvalidHeaderGenerator = []injectTest{ var injectInvalidHeader []injectTest func init() { - // Preform a test for each invalid injectTest with all combinations of + // Perform a test for each invalid injectTest with all combinations of // encoding values. injectInvalidHeader = make([]injectTest, 0, len(injectInvalidHeaderGenerator)*4) allHeaders := []string{ diff --git a/renovate.json b/renovate.json index 6559d3c655a..208cd49a7e6 100644 --- a/renovate.json +++ b/renovate.json @@ -21,6 +21,11 @@ "matchManagers": ["gomod"], "matchDepTypes": ["indirect"], "enabled": false + }, + { + "matchManagers": ["pip"], + "packageNames": ["codespell"], + "enabled": true } ] } diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000000..9991a8c25b0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +codespell==2.3.0 \ No newline at end of file diff --git a/samplers/aws/xray/internal/reservoir_test.go b/samplers/aws/xray/internal/reservoir_test.go index c60c5031e25..cfb4eee371a 100644 --- a/samplers/aws/xray/internal/reservoir_test.go +++ b/samplers/aws/xray/internal/reservoir_test.go @@ -200,7 +200,7 @@ func TestResetQuotaUsageRotation(t *testing.T) { nowTime: 1500000001, } - // take() should be true since ununsed quota is available + // take() should be true since unused quota is available assert.True(t, r.take(clock.now(), false, 1.0)) }