Skip to content

Commit bb98692

Browse files
authored
Merge branch 'main' into fix-flask-active-requests-gauge-leak
2 parents 9018dc2 + dcf86d0 commit bb98692

15 files changed

Lines changed: 87 additions & 91 deletions

File tree

.pylintrc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ persistent=yes
3737
# Specify a configuration file.
3838
#rcfile=
3939

40-
# When enabled, pylint would attempt to guess common misconfiguration and emit
41-
# user-friendly hints instead of false-positive error messages.
42-
suggestion-mode=yes
43-
4440
# Allow loading of arbitrary C extensions. Extensions are imported into the
4541
# active Python interpreter and may run arbitrary code.
4642
unsafe-load-any-extension=no
@@ -463,6 +459,9 @@ valid-metaclass-classmethod-first-arg=cls
463459
# Maximum number of arguments for function / method.
464460
max-args=5
465461

462+
# Maximum number of positional arguments for function / method.
463+
max-positional-arguments=12
464+
466465
# Maximum number of attributes for a class (see R0902).
467466
max-attributes=7
468467

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# OpenTelemetry Python Contrib
2+
3+
This file is here to steer AI assisted PRs towards being high quality and valuable contributions
4+
that do not create excessive maintainer burden.
5+
6+
Monorepo with 50+ OpenTelemetry instrumentation packages for Python.
7+
8+
## General Rules and Guidelines
9+
10+
The most important rule is not to post comments on issues or PRs that are AI-generated. Discussions
11+
on the OpenTelemetry repositories are for Users/Humans only.
12+
13+
Follow the PR scoping guidance in [CONTRIBUTING.md](CONTRIBUTING.md). Keep AI-assisted PRs tightly
14+
isolated to the requested change and never include unrelated cleanup or opportunistic improvements
15+
unless they are strictly necessary for correctness.
16+
17+
If you have been assigned an issue by the user or their prompt, please ensure that the
18+
implementation direction is agreed on with the maintainers first in the issue comments. If there are
19+
unknowns, discuss these on the issue before starting implementation. Do not forget that you cannot
20+
comment for users on issue threads on their behalf as it is against the rules of this project.
21+
22+
## Structure
23+
24+
- `instrumentation/` - instrumentation packages (Flask, Django, FastAPI, gRPC, databases, etc.)
25+
- `instrumentation-genai/` - GenAI instrumentations (Anthropic, Vertex AI, LangChain, etc.)
26+
- `util/` - shared utilities (`util-http`, `util-genai`)
27+
- `exporter/` - custom exporters
28+
- `propagator/` - context propagators
29+
30+
Instrumentation packages live under `src/opentelemetry/instrumentation/{name}/` with their own
31+
`pyproject.toml` and `tests/`. Other package types follow the equivalent layout under their own
32+
namespace (e.g. `src/opentelemetry/util/{name}/`, `src/opentelemetry/exporter/{name}/`).
33+
34+
## Commands
35+
36+
```sh
37+
# Install all packages and dev tools
38+
uv sync --frozen --all-packages
39+
40+
# Lint (runs ruff via pre-commit)
41+
uv run pre-commit run ruff --all-files
42+
43+
# Test a specific package (append -0, -1, etc. for version variants)
44+
uv run tox -e py312-test-instrumentation-flask-0
45+
46+
# Type check
47+
uv run tox -e typecheck
48+
```
49+
50+
## Guidelines
51+
52+
- Each package has its own `pyproject.toml` with version, dependencies, and entry points.
53+
- The monorepo uses `uv` workspaces.
54+
- `tox.ini` defines the test matrix - check it for available test environments.
55+
- Do not add `type: ignore` comments. If a type error arises, solve it properly or write a follow-up plan to address it in another PR.
56+
- Whenever applicable, all code changes should have tests that actually validate the changes.
57+
58+
## Commit formatting
59+
60+
We appreciate it if users disclose the use of AI tools when the significant part of a commit is
61+
taken from a tool without changes. When making a commit this should be disclosed through an
62+
`Assisted-by:` commit message trailer.
63+
64+
Examples:
65+
66+
```
67+
Assisted-by: ChatGPT 5.2
68+
Assisted-by: Claude Opus 4.6
69+
```

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
## Unreleased
1313

14+
### Added
15+
16+
- Bump `pylint` to `4.0.5`
17+
([#4244](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4244))
18+
1419
### Breaking changes
1520

1621
- Drop Python 3.9 support

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pylint==3.0.2
1+
pylint==4.0.5
22
httpretty==1.1.4
33
pyright==v1.1.404
44
sphinx==7.1.2

instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/src/opentelemetry/instrumentation/openai_agents/span_processor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ def get_span_name(
426426
class GenAISemanticProcessor(TracingProcessor):
427427
"""Trace processor adding GenAI semantic convention attributes with metrics."""
428428

429+
# pylint: disable=too-many-positional-arguments
429430
def __init__(
430431
self,
431432
tracer: Optional[Tracer] = None,

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ class OpenTelemetryMiddleware:
586586
exclude_spans: Optionally exclude HTTP `send` and/or `receive` spans from the trace.
587587
"""
588588

589-
# pylint: disable=too-many-branches
589+
# pylint: disable=too-many-branches,too-many-positional-arguments
590590
def __init__(
591591
self,
592592
app,

instrumentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_run_coroutine_threadsafe.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
# limitations under the License.
1414
import asyncio
1515
import threading
16-
from concurrent.futures import ( # pylint: disable=no-name-in-module; TODO #4199
17-
ThreadPoolExecutor,
18-
)
16+
from concurrent.futures import ThreadPoolExecutor
1917
from unittest.mock import patch
2018

2119
# pylint: disable=no-name-in-module

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_bedrock.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,6 @@ def test_invoke_model_with_content(
14871487
finish_reason = "length"
14881488
else:
14891489
pytest.xfail("model family not handled: {model_family}")
1490-
return
14911490

14921491
assert_message_in_logs(logs[0], "gen_ai.user.message", user_content, span)
14931492

@@ -1628,7 +1627,6 @@ def test_invoke_model_with_content_different_events(
16281627
choice_content = [{"type": "text", "text": "This is a test"}]
16291628
else:
16301629
pytest.xfail("llm_model_value not handled: {llm_model_value}")
1631-
return
16321630

16331631
body = get_invoke_model_body(
16341632
llm_model_value,
@@ -2070,7 +2068,6 @@ def test_invoke_model_with_content_tool_call(
20702068
llm_model_config = AnthropicClaudeModel
20712069
else:
20722070
pytest.xfail("model family not handled: {model_family}")
2073-
return
20742071

20752072
invoke_model_tool_call(
20762073
span_exporter,
@@ -2156,7 +2153,6 @@ def test_invoke_model_no_content(
21562153
finish_reason = "length"
21572154
else:
21582155
pytest.xfail("model family not handled: {model_family}")
2159-
return
21602156

21612157
choice_body = {
21622158
"index": 0,
@@ -2190,7 +2186,6 @@ def test_invoke_model_no_content_different_events(
21902186
finish_reason = "end_turn"
21912187
else:
21922188
pytest.xfail("llm_model_value not handled: {llm_model_value}")
2193-
return
21942189

21952190
body = get_invoke_model_body(
21962191
llm_model_value,
@@ -2246,7 +2241,6 @@ def test_invoke_model_no_content_tool_call(
22462241
llm_model_config = AnthropicClaudeModel
22472242
else:
22482243
pytest.xfail("model family not handled: {model_family}")
2249-
return
22502244

22512245
invoke_model_tool_call(
22522246
span_exporter,
@@ -2401,7 +2395,6 @@ def test_invoke_model_with_response_stream_with_content(
24012395
}
24022396
else:
24032397
pytest.xfail("model family not handled: {model_family}")
2404-
return
24052398

24062399
choice_body = {
24072400
"index": 0,
@@ -2437,7 +2430,6 @@ def test_invoke_model_with_response_stream_with_content_different_events(
24372430
choice_content = [{"text": "This is a test", "type": "text"}]
24382431
else:
24392432
pytest.xfail("llm_model_value not handled: {llm_model_value}")
2440-
return
24412433

24422434
max_tokens = 10
24432435
body = get_invoke_model_body(
@@ -2672,7 +2664,6 @@ def test_invoke_model_with_response_stream_with_content_tool_call(
26722664
llm_model_config = AnthropicClaudeModel
26732665
else:
26742666
pytest.xfail("model family not handled: {model_family}")
2675-
return
26762667

26772668
invoke_model_with_response_stream_tool_call(
26782669
span_exporter,
@@ -2801,7 +2792,6 @@ def test_invoke_model_with_response_stream_no_content_different_events(
28012792
finish_reason = "end_turn"
28022793
else:
28032794
pytest.xfail("llm_model_value not handled: {llm_model_value}")
2804-
return
28052795

28062796
max_tokens = 10
28072797
body = get_invoke_model_body(
@@ -2864,7 +2854,6 @@ def test_invoke_model_with_response_stream_no_content_tool_call(
28642854
llm_model_config = AnthropicClaudeModel
28652855
else:
28662856
pytest.xfail("model family not handled: {model_family}")
2867-
return
28682857

28692858
invoke_model_with_response_stream_tool_call(
28702859
span_exporter,

instrumentation/opentelemetry-instrumentation-threading/tests/test_threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from __future__ import annotations
1616

1717
import threading
18-
from concurrent.futures import ( # pylint: disable=no-name-in-module; TODO #4199
18+
from concurrent.futures import (
1919
Future,
2020
ThreadPoolExecutor,
2121
)

0 commit comments

Comments
 (0)