Skip to content

Commit

Permalink
Codespell ci (open-telemetry#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
galbash authored Aug 29, 2022
1 parent 934af7e commit 18e056b
Show file tree
Hide file tree
Showing 30 changed files with 52 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
# skipping auto generated folders
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv
ignore-words-list = ot
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tox-environment: [ "docker-tests", "lint", "docs", "generate" ]
tox-environment: [ "docker-tests", "spellcheck", "lint", "docs", "generate" ]
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-20.04
steps:
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#567](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/567))
- `opentelemetry-instrumentation-grpc` Respect the suppress instrumentation in gRPC client instrumentor
([#559](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/559))
- `opentelemetry-instrumentation-grpc` Fixed asynchonous unary call traces
- `opentelemetry-instrumentation-grpc` Fixed asynchronous unary call traces
([#536](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/536))
- `opentelemetry-sdk-extension-aws` Update AWS entry points to match spec
([#566](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/566))
Expand Down Expand Up @@ -736,7 +736,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#182](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/182))
- `opentelemetry-instrumentation-botocore` Botocore SpanKind as CLIENT and modify existing traced attributes
([#150](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/150))
- `opentelemetry-instrumentation-dbapi` Update dbapi and its dependant instrumentations to follow semantic conventions
- `opentelemetry-instrumentation-dbapi` Update dbapi and its dependent instrumentations to follow semantic conventions
([#195](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/195))
- `opentelemetry-instrumentation-dbapi` Stop capturing query parameters by default
([#156](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/156))
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ You can run:
- `tox -e py37-test-flask` to e.g. run the Flask tests under a specific
Python version
- `tox -e lint` to run lint checks on all code
- `tox -e spellcheck` to run spell check on the code

See
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
Expand Down Expand Up @@ -172,7 +173,7 @@ The continuation integration overrides that environment variable with as per the

* docstrings should adhere to the [Google Python Style
Guide](http://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
as specified with the [napolean
as specified with the [napoleon
extension](http://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#google-vs-numpy)
extension in [Sphinx](http://www.sphinx-doc.org/en/master/index.html).

Expand All @@ -194,7 +195,7 @@ Below is a checklist of things to be mindful of when implementing a new instrume
- https://github.com/open-telemetry/opentelemetry-python-contrib/issues/344 for more context
- `exclude_urls` functionality
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py#L91
- `url_filter` functonality
- `url_filter` functionality
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0fcb60d2ad139f78a52edd85b1cc4e32f2e962d0/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py#L235
- `is_recording()` optimization on non-sampled spans
- ex. https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py#L133
Expand All @@ -204,5 +205,5 @@ Below is a checklist of things to be mindful of when implementing a new instrume

## Expectations from contributors

OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current memebers of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.
OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.

1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ grpcio-tools==1.29.0
mypy-protobuf>=1.23
protobuf~=3.13
markupsafe==2.0.1
codespell==2.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _translate_to_datadog(self, spans):

# datadog Span is initialized with a reference to the tracer which is
# used to record the span when it is finished. We can skip ignore this
# because we are not calling the finish method and explictly set the
# because we are not calling the finish method and explicitly set the
# duration.
tracer = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def worker(self):
# missing spans will be sent when calling flush
break

# substract the duration of this export call to the next timeout
# subtract the duration of this export call to the next timeout
start = time_ns()
self.export()
end = time_ns()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def strip_query_params(url: yarl.URL) -> str:
Request/Response hooks
**********************
Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request.
Utilize request/response hooks to execute custom logic to be performed before/after performing a request.
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ async def hello():
Request/Response hooks
**********************
Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request. The server request hook takes in a server span and ASGI
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method recieve is called.
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. The server request hook takes in a server span and ASGI
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method receive is called.
The client response hook is called with the internal span and an ASGI event which is sent as a dictionary for when the method send is called.
.. code-block:: python
Expand Down Expand Up @@ -379,7 +379,7 @@ class OpenTelemetryMiddleware:
server_request_hook: Optional callback which is called with the server span and ASGI
scope object for every incoming request.
client_request_hook: Optional callback which is called with the internal span and an ASGI
scope which is sent as a dictionary for when the method recieve is called.
scope which is sent as a dictionary for when the method receive is called.
client_response_hook: Optional callback which is called with the internal span and an ASGI
event which is sent as a dictionary for when the method send is called.
tracer_provider: The optional tracer provider to use. If omitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

"""
The opentelemetry-instrumentation-aws-lambda package provides an `Instrumentor`
to traces calls whithin a Python AWS Lambda function.
to traces calls within a Python AWS Lambda function.
Usage
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def instrumentation_dependencies(self) -> Collection[str]:
def _instrument(self, **kwargs):
# AWSQueryConnection and AWSAuthConnection are two different classes
# called by different services for connection.
# For exemple EC2 uses AWSQueryConnection and S3 uses
# For example EC2 uses AWSQueryConnection and S3 uses
# AWSAuthConnection

# pylint: disable=attribute-defined-outside-init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_s3_client(self):
self.assertEqual(span.attributes["aws.operation"], "head_bucket")
self.assertEqual(span.name, "s3.command")

# Checking for resource incase of error
# Checking for resource in case of error
try:
s3.get_bucket("big_bucket")
except Exception: # pylint: disable=broad-except
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _AwsSdkCallContext:
Args:
service: the AWS service (e.g. s3, lambda, ...) which is called
service_id: the name of the service in propper casing
service_id: the name of the service in proper casing
operation: the called operation (e.g. ListBuckets, Invoke, ...) of the
AWS service.
params: a dict of input parameters passed to the service operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _instrument(self, **kwargs):
_DjangoMiddleware._active_request_counter = meter.create_up_down_counter(
name="http.server.active_requests",
unit="requests",
description="measures the number of concurent HTTP requests those are currently in flight",
description="measures the number of concurrent HTTP requests those are currently in flight",
)
# This can not be solved, but is an inherent problem of this approach:
# the order of middleware entries matters, and here you have no control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ async def foobar():
Request/Response hooks
**********************
Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request. The server request hook takes in a server span and ASGI
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method recieve is called.
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. The server request hook takes in a server span and ASGI
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method receive is called.
The client response hook is called with the internal span and an ASGI event which is sent as a dictionary for when the method send is called.
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def test_http_custom_response_headers_in_span_attributes(self):

def test_http_custom_response_headers_not_in_span_attributes(self):
not_expected = {
"http.reponse.header.custom_test_header_3": (
"http.response.header.custom_test_header_3": (
"test-header-value-3",
),
}
Expand Down Expand Up @@ -633,7 +633,7 @@ def test_web_socket_custom_response_headers_in_span_attributes(self):

def test_web_socket_custom_response_headers_not_in_span_attributes(self):
not_expected = {
"http.reponse.header.custom_test_header_3": (
"http.response.header.custom_test_header_3": (
"test-header-value-3",
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can also pass the comma delimited regexes to the ``instrument_app`` method d
Request/Response hooks
**********************

Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment (flask.request.environ).
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment (flask.request.environ).
Response_headers is a list of key-value (tuples) representing the response headers returned from the response.

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def hello():
Request/Response hooks
**********************
Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment (flask.request.environ).
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment (flask.request.environ).
Response_headers is a list of key-value (tuples) representing the response headers returned from the response.
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def __init__(self, connect_failure=None):
self.sockets = []

def socket(self): # noqa: A002
soket = MockSocket([], connect_failure=self.connect_failure)
self.sockets.append(soket)
return soket
mock_socket = MockSocket([], connect_failure=self.connect_failure)
self.sockets.append(mock_socket)
return mock_socket

def __getattr__(self, name):
return getattr(socket, name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
---------------------------------
If you use Method 2 and then set tweens for your application with the ``pyramid.tweens`` setting,
you need to add ``opentelemetry.instrumentation.pyramid.trace_tween_factory`` explicity to the list,
you need to add ``opentelemetry.instrumentation.pyramid.trace_tween_factory`` explicitly to the list,
*as well as* instrumenting the config as shown above.
For example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def home(request):
**********************
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. The server request hook takes in a server span and ASGI
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method recieve is called.
scope object for every incoming request. The client request hook is called with the internal span and an ASGI scope which is sent as a dictionary for when the method receive is called.
The client response hook is called with the internal span and an ASGI event which is sent as a dictionary for when the method send is called.
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_starlette_route_attribute_added(self):
)

def test_starlette_excluded_urls(self):
"""Ensure that givem starlette routes are excluded."""
"""Ensure that given starlette routes are excluded."""
self._client.get("/healthzz")
spans = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans), 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _instrument(self, **kwargs):
perfectly on the other hand as it executes in the same context as on_finish and log_exection which
are patched to finish a span after a request is served.
However, we cannot just patch RequestHandler's prepare method because it is supposed to be overwridden
However, we cannot just patch RequestHandler's prepare method because it is supposed to be overridden
by sub-classes and since the parent prepare method does not do anything special, sub-classes don't
have to call super() when overriding the method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def GET(self):
Request/Response hooks
**********************
Utilize request/reponse hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment.
Utilize request/response hooks to execute custom logic to be performed before/after performing a request. Environ is an instance of WSGIEnvironment.
Response_headers is a list of key-value (tuples) representing the response headers returned from the response.
.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-instrumentation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ and when possible, apply automatic tracing instrumentation on them. This means y
will get automatic distributed tracing for free without having to make any code changes
at all. This will also configure a global tracer and tracing exporter without you having to
make any code changes. By default, the instrument command will use the OTLP exporter but
this can be overriden when needed.
this can be overridden when needed.

The command supports the following configuration options as CLI arguments and environment vars:

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_a_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This script builds wheels for a single package when trigged from a push to
# This script builds wheels for a single package when triggered from a push to
# a tag as part of a GitHub workflow (See .github/publish-a-package.yml). The
# wheel is then published to PyPI.

Expand Down
2 changes: 1 addition & 1 deletion scripts/eachdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def update_changelog(path, version, new_entry):
text = changelog.read()
if f"## [{version}]" in text:
raise AttributeError(
f"{path} already contans version {version}"
f"{path} already contains version {version}"
)
with open(path, encoding="utf-8") as changelog:
for line in changelog:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AwsLambdaResourceDetector(ResourceDetector):
"""Detects attribute values only available when the app is running on AWS
Lambda and returns them in a Resource.
Uses Lambda defined runtime enivronment variables. See more: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
Uses Lambda defined runtime environment variables. See more: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
"""

def detect(self) -> "Resource":
Expand Down
10 changes: 10 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ envlist =
pypy3-test-instrumentation-kafka-python

lint
spellcheck
docker-tests
docs

Expand Down Expand Up @@ -426,6 +427,15 @@ changedir = docs
commands =
sphinx-build -E -a -W -b html -T . _build/html

[testenv:spellcheck]
basepython: python3.9
recreate = True
deps =
codespell

commands =
codespell

[testenv:lint]
basepython: python3.9
recreate = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def remove_url_credentials(url: str) -> str:
parsed_url.fragment,
)
)
except ValueError: # an unparseable url was passed
except ValueError: # an unparsable url was passed
pass
return url

Expand Down

0 comments on commit 18e056b

Please sign in to comment.