Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code spell task, fix issues and run the task in CI #1661

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ot
te
10 changes: 10 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -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,venv,coverage,doc,docs
uri-ignore-words-list = *
write =
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,9 @@ jobs:
with:
gem: "${{ matrix.gem }}"
ruby: "truffleruby"

codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make codespell
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
# rbenv configuration
.ruby-version

# Python virtual env for codespell
venv

tags
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ All notable changes to this project were documented in this file. This is of his

* [#286](https://github.com/open-telemetry/opentelemetry-ruby/pull/286) Update Schedule. ([@fbogsany](https://github.com/fbogsany))

* [#288](https://github.com/open-telemetry/opentelemetry-ruby/pull/288) Fix api/sdk gem install instuctions. ([@mwlang](https://github.com/mwlang))
* [#288](https://github.com/open-telemetry/opentelemetry-ruby/pull/288) Fix api/sdk gem install instructions. ([@mwlang](https://github.com/mwlang))

* [#294](https://github.com/open-telemetry/opentelemetry-ruby/pull/294) Add CHANGELOG. ([@ericmustin](https://github.com/ericmustin))
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ to ensure that your code complies before opening a pull request.
We also use Yard to generate class documentation automatically. Among other
things, this means:

* Methods and arguments should include the appropraite type annotations
* Methods and arguments should include the appropriate type annotations
* You can use markdown formatting in your documentation comments

You can generate the docs locally to see the results, by running:
Expand Down
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Virtualized python tools via docker

# The directory where the virtual environment is created.
VENVDIR := venv

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

.PHONY: codespell
codespell: $(CODESPELL)
@$(DOCKERPY) $(CODESPELL)
2 changes: 1 addition & 1 deletion api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

* BREAKING CHANGE: Remove optional parent_context from in_span [729](https://github.com/open-telemetry/opentelemetry-ruby/pull/729)
* BREAKING CHANGE: Refactor Baggage to remove Noop* [800](https://github.com/open-telemetry/opentelemetry-ruby/pull/800)
- The noop baggage manger has been removed.
- The noop baggage manager has been removed.
- The baggage management methods are now available through OpenTelemetry::Baggage#method, previously OpenTelemetry.baggage#method
* BREAKING CHANGE: Total order constraint on span.status= [805](https://github.com/open-telemetry/opentelemetry-ruby/pull/805)
- The OpenTelemetry::Trace::Util::HttpToStatus module has been removed as it was incorrectly setting the span status to OK for codes codes in the range 100..399
Expand Down
5 changes: 4 additions & 1 deletion api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ OpenTelemetry provides a single set of APIs, libraries, agents, and collector se

The `opentelemetry-api` gem defines the core OpenTelemetry interfaces in the form of abstract classes and no-op implementations. That is, it defines interfaces and data types sufficient for a library or application to code against to produce telemetry data, but does not actually collect, analyze, or export the data.

To collect and analyze telemetry data, *applications* should also install a concrete implementation of the API, such as the `opentelemetry-sdk` gem. However, *libraries* that produce telemetry data should depend only on `opentelemetry-api`, deferring the choise of concrete implementation to the application developer.
To collect and analyze telemetry data, *applications* should also
install a concrete implementation of the API, such as the
`opentelemetry-sdk` gem. However, *libraries* that produce telemetry
data should depend only on `opentelemetry-api`, deferring the choice of concrete implementation to the application developer.

## How do I get started?

Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/baggage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def raw_entries(context: Context.current)
# @param [String] key The key to store this value under
# @param [String] value String value to be stored under key
# @param [optional String] metadata This is here to store properties
# received from other W3C Baggage impelmentations but is not exposed in
# received from other W3C Baggage implementations but is not exposed in
# OpenTelemetry. This is condsidered private API and not for use by
# end-users.
# @param [optional Context] context The context to update with new
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/baggage/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def initialize(entries)
# @param [String] key The key to store this value under
# @param [String] value String value to be stored under key
# @param [optional String] metadata This is here to store properties
# received from other W3C Baggage impelmentations but is not exposed in
# received from other W3C Baggage implementations but is not exposed in
# OpenTelemetry. This is condsidered private API and not for use by
# end-users.
def set_value(key, value, metadata: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def encode(baggage)

def encode_value(key, entry)
result = +"#{CGI.escape(key.to_s)}=#{CGI.escape(entry.value.to_s)}"
# We preserve metadata recieved on extract and assume it's already formatted
# We preserve metadata received on extract and assume it's already formatted
# for transport. It's sent as-is without further processing.
result << ";#{entry.metadata}" if entry.metadata
result
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/trace/propagation/trace_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
module OpenTelemetry
module Trace
module Propagation
# The TraceContext module contains injectors, extractors, and utilties
# The TraceContext module contains injectors, extractors, and utilities
# for context propagation in the W3C Trace Context format.
module TraceContext
extend self
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/trace/span_kind.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module SpanKind
# spans.
PRODUCER = :producer

# Indicates that the span describes consumer recieving a message from a broker. Unlike client
# Indicates that the span describes consumer receiving a message from a broker. Unlike client
# and server, there is no direct critical path latency relationship between producer and
# consumer spans.
CONSUMER = :consumer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
_(getter.get(carrier, 'x-source-id')).must_equal('123')
end

it 'returns nil for non-existant key' do
it 'returns nil for non-existent key' do
_(getter.get(carrier, 'not-here')).must_be_nil
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
_(tp.to_s).must_equal(expected)
end

it 'must ignore flags it doesnt know (use the mask)' do
it 'must ignore flags it doesn\'t know (use the mask)' do
value = '00-0000000000000000000000000000000a-000000000000000a-ff'
assert TraceParent.from_string(value).sampled?
value = '00-0000000000000000000000000000000a-000000000000000a-04'
Expand Down
4 changes: 2 additions & 2 deletions exporter/jaeger/thrift/gen-rb/zipkincore_types.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions exporter/jaeger/thrift/zipkincore.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ struct Span {
3: string name,
4: i64 id, # unique span id, only used for this span
5: optional i64 parent_id, # parent span id
6: list<Annotation> annotations, # all annotations/events that occured, sorted by timestamp
6: list<Annotation> annotations, # all annotations/events that occurred, sorted by timestamp
8: list<BinaryAnnotation> binary_annotations # any binary annotations
9: optional bool debug = 0 # if true, we DEMAND that this span passes all samplers
/**
Expand All @@ -302,7 +302,7 @@ struct Span {
* precise value possible. For example, gettimeofday or syncing nanoTime
* against a tick of currentTimeMillis.
*
* For compatibilty with instrumentation that precede this field, collectors
* For compatibility with instrumentation that precede this field, collectors
* or span stores can derive this via Annotation.timestamp.
* For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
*
Expand All @@ -317,7 +317,7 @@ struct Span {
* precise measurement decoupled from problems of clocks, such as skew or NTP
* updates causing time to move backwards.
*
* For compatibilty with instrumentation that precede this field, collectors
* For compatibility with instrumentation that precede this field, collectors
* or span stores can derive this by subtracting Annotation.timestamp.
* For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
*
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp-metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The `opentelemetry-exporter-otlp-metrics` gem is distributed under the Apache 2.

## Working with Proto Definitions

The OTel community maintains a [repository with protobuf definitions][otel-proto-github] that language and collector implementors use to generate code.
The OTel community maintains a [repository with protobuf definitions][otel-proto-github] that language and collector implementers use to generate code.

Maintainers are expected to keep up to date with the latest version of protos. This guide will provide you with step-by-step instructions on updating the OTLP Exporter gem with the latest definitions.

Expand Down
4 changes: 2 additions & 2 deletions exporter/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The `opentelemetry-exporter-otlp` gem is distributed under the Apache 2.0 licens

## Working with Proto Definitions

The OTel community maintains a [repository with protobuf definitions][otel-proto-github] that language and collector implementors use to generate code.
The OTel community maintains a [repository with protobuf definitions][otel-proto-github] that language and collector implementers use to generate code.

Maintainers are expected to keep up to date with the latest version of protos. This guide will provide you with step-by-step instructions on updating the OTLP Exporter gem with the latest definitions.

Expand Down Expand Up @@ -138,7 +138,7 @@ $> bundle exec rake test

```

**Commit the chnages and open a PR!**
**Commit the changes and open a PR!**

[opentelemetry-collector-home]: https://opentelemetry.io/docs/collector/about/
[opentelemetry-home]: https://opentelemetry.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def send_spans(zipkin_spans, timeout: nil) # rubocop:disable Metrics/MethodLengt

response = measure_request_duration { @http.request(request) }
response.body # Read and discard body
# in opentelemetry-js 200-399 is succcess, in opentelemetry-collector zipkin exporter,200-299 is a success
# in opentelemetry-js 200-399 is success, in opentelemetry-collector zipkin exporter,200-299 is a success
# zipkin api docs list 202 as default success code
# https://zipkin.io/zipkin-api/#/default/post_spans
# TODO: redirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def to_zipkin_span(span_d, resource)
add_status_tags(span_d, tags)
tags = aggregate_span_tags(span_d, tags)

# TOOO: set debug flag? (is that represented in tracestate?)
# TODO: set debug flag? (is that represented in tracestate?)
# https://github.com/openzipkin/b3-propagation#why-is-debug-encoded-as-x-b3-flags-1
# https://github.com/openzipkin/zipkin-api/blob/7692ca7be4dc3be9225db550d60c4d30e6e9ec59/zipkin2-api.yaml#L475
# TODO: shared key mapping
Expand Down
2 changes: 1 addition & 1 deletion logs_sdk/lib/opentelemetry/sdk/logs/log_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LogRecord < OpenTelemetry::Logs::LogRecord
# current context.
# @param [optional OpenTelemetry::Trace::TraceFlags] trace_flags The
# trace flags associated with the current context.
# @param [optional OpenTelemetry::SDK::Resources::Resource] recource The
# @param [optional OpenTelemetry::SDK::Resources::Resource] resource The
# source of the log, desrived from the LoggerProvider.
# @param [optional OpenTelemetry::SDK::InstrumentationScope] instrumentation_scope
# The instrumentation scope, derived from the emitting Logger
Expand Down
6 changes: 5 additions & 1 deletion metrics_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ OpenTelemetry provides a single set of APIs, libraries, agents, and collector se

The `opentelemetry-metrics-api` gem defines the core OpenTelemetry interfaces in the form of abstract classes and no-op implementations. That is, it defines interfaces and data types sufficient for a library or application to code against to produce telemetry data, but does not actually collect, analyze, or export the data.

To collect and analyze telemetry data, _applications_ should also install a concrete implementation of the API, such as the `opentelemetry-metrics-sdk` gem. However, _libraries_ that produce telemetry data should depend only on `opentelemetry-metrics-api`, deferring the choise of concrete implementation to the application developer.
To collect and analyze telemetry data, _applications_ should also
install a concrete implementation of the API, such as the
`opentelemetry-metrics-sdk` gem. However, _libraries_ that produce
telemetry data should depend only on `opentelemetry-metrics-api`,
deferring the choice of concrete implementation to the application developer.

This code is still under development and is not a complete implementation of the Metrics API. Until the code becomes stable, Metrics API functionality will live outside the `opentelemetry-api` library.

Expand Down
2 changes: 1 addition & 1 deletion metrics_api/test/opentelemetry/opentelemetry_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

describe OpenTelemetry do
after do
# TODO: After Metrics SDK is incoporated into OpenTelemetry SDK, move this
# TODO: After Metrics SDK is incorporated into OpenTelemetry SDK, move this
# to OpenTelemetry::TestHelpers.reset_opentelemetry
OpenTelemetry.instance_variable_set(
:@meter_provider,
Expand Down
2 changes: 1 addition & 1 deletion propagator/b3/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

### v0.18.0 / 2021-05-21

* ADDED: Updated API depedency for 1.0.0.rc1
* ADDED: Updated API dependency for 1.0.0.rc1

### v0.17.0 / 2021-04-22

Expand Down
2 changes: 1 addition & 1 deletion propagator/jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

### v0.18.0 / 2021-05-21

* ADDED: Updated API depedency for 1.0.0.rc1
* ADDED: Updated API dependency for 1.0.0.rc1

### v0.17.0 / 2021-04-22

Expand Down
2 changes: 1 addition & 1 deletion registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

### v0.2.0 / 2022-09-14

* Bump minimum API version depedency to 1.1
* Bump minimum API version dependency to 1.1

### v0.1.0 / 2022-04-11

Expand Down
2 changes: 1 addition & 1 deletion registry/lib/opentelemetry/instrumentation/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Instrumentation
# The instrumentation Registry contains information about instrumentation
# available and facilitates discovery, installation and
# configuration. This functionality is primarily useful for SDK
# implementors.
# implementers.
class Registry
def initialize
@lock = Mutex.new
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.3.0
8 changes: 7 additions & 1 deletion sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ OpenTelemetry provides a single set of APIs, libraries, agents, and collector se

The `opentelemetry-sdk` gem provides the reference implementation of the OpenTelemetry Ruby interfaces defined in the `opentelemetry-api` gem. That is, it includes the *functionality* needed to collect, analyze, and export telemetry data produced using the API.

Generally, Ruby *applications* should install `opentelemetry-sdk` (or other concrete implementation of the OpenTelemetry API). Using the SDK, an application can configure how it wants telemetry data to be handled, including which data should be persisted, how it should be formatted, and where it should be recorded or exported. However, *libraries* that produce telemetry data should generally depend only on `opentelemetry-api`, deferring the choise of concrete implementation to the application developer.
Generally, Ruby *applications* should install `opentelemetry-sdk` (or
other concrete implementation of the OpenTelemetry API). Using the SDK,
an application can configure how it wants telemetry data to be handled,
including which data should be persisted, how it should be formatted,
and where it should be recorded or exported. However, *libraries* that
produce telemetry data should generally depend only on
`opentelemetry-api`, deferring the choice of concrete implementation to the application developer.

## How do I get started?

Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/opentelemetry/sdk/configurator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def service_version=(service_version)
)
end

# Install an instrumentation with specificied optional +config+.
# Install an instrumentation with specified optional +config+.
# Use can be called multiple times to install multiple instrumentation.
# Only +use+ or +use_all+, but not both when installing
# instrumentation. A call to +use_all+ after +use+ will result in an
Expand Down
2 changes: 1 addition & 1 deletion sdk/opentelemetry-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Gem::Specification.new do |spec|

# This is an intentionally loose dependency, since we want to be able to
# release new versions of opentelemetry-semantic_conventions without requiring
# a new SDK release. The requirements of the SDK have been satisifed since the
# a new SDK release. The requirements of the SDK have been satisfied since the
# initial release of opentelemetry-semantic_conventions, so we feel it is safe.
spec.add_dependency 'opentelemetry-semantic_conventions'

Expand Down
2 changes: 1 addition & 1 deletion sdk/test/opentelemetry/sdk/configurator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
)
end

it 'accepts comma separated list with preceeding or trailing spaces as an environment variable' do
it 'accepts comma separated list with preceding or trailing spaces as an environment variable' do
OpenTelemetry::TestHelpers.with_env('OTEL_TRACES_EXPORTER' => 'zipkin , console') do
configurator.configure
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

it 'accepts an Enumerable of SpanDatas as argument to #export' do
# An anonymous Struct serves as a handy implementor of Enumerable
# An anonymous Struct serves as a handy implementer of Enumerable
enumerable = Struct.new(:span_data1, :span_data2).new
enumerable.span_data1 = span_data1
enumerable.span_data2 = span_data2
Expand Down
2 changes: 1 addition & 1 deletion sdk/test/opentelemetry/sdk/trace/span_limits_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
_(span_limits.link_attribute_count_limit).must_equal 128
end

it 'prioritizes specific environment varibles for attribute value length limits' do
it 'prioritizes specific environment variables for attribute value length limits' do
OpenTelemetry::TestHelpers.with_env('OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT' => '35',
'OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT' => '33',
'OTEL_EVENT_ATTRIBUTE_VALUE_LENGTH_LIMIT' => '32') do
Expand Down
Loading
Loading