Skip to content

Commit 1c7c8a4

Browse files
committed
Merge branch 'main' into deprecate_events
2 parents 4e131a6 + daae23b commit 1c7c8a4

File tree

21 files changed

+442
-143
lines changed

21 files changed

+442
-143
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ repos:
1313
rev: 0.6.0
1414
hooks:
1515
- id: uv-lock
16+
- repo: https://github.com/rstcheck/rstcheck
17+
rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5
18+
hooks:
19+
- id: rstcheck
20+
additional_dependencies: ['rstcheck[sphinx]']
21+
args: ["--report-level", "warning"]

.rstcheck.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[rstcheck]
2+
ignore_directives = automodule
3+
ignore_roles = scm_web,scm_raw_web

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
1313
## Unreleased
1414

15+
- Add `rstcheck` to pre-commit to stop introducing invalid RST
16+
([#4755](https://github.com/open-telemetry/opentelemetry-python/pull/4755))
17+
- logs: extend Logger.emit to accept separated keyword arguments
18+
([#4737](https://github.com/open-telemetry/opentelemetry-python/pull/4737))
1519
- Mark the Events API/SDK as deprecated. The Logs API/SDK should be used instead. An event is now a `LogRecord` with the `event_name` field set
16-
([#4654](https://github.com/open-telemetry/opentelemetry-python/pull/4654)).
20+
([#4654](https://github.com/open-telemetry/opentelemetry-python/pull/4654)).
1721

1822
## Version 1.37.0/0.58b0 (2025-09-11)
1923

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You can run `tox` with the following arguments:
7272
- `tox -e tracecontext` to run integration tests for tracecontext.
7373
- `tox -e precommit` to run all `pre-commit` actions
7474

75-
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
75+
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` and `rstcheck` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
7676

7777
```console
7878
pip install pre-commit -c dev-requirements.txt

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pylint==3.3.4
22
httpretty==1.1.4
3-
pyright==1.1.396
3+
pyright==1.1.405
44
sphinx==7.1.2
55
sphinx-rtd-theme==2.0.0rc4
66
sphinx-autodoc-typehints==1.25.2

docs/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@
115115
"py:class",
116116
"opentelemetry.trace._LinkBase",
117117
),
118+
(
119+
"py:class",
120+
"opentelemetry.proto.collector.trace.v1.trace_service_pb2_grpc.TraceServiceStub",
121+
),
122+
(
123+
"py:class",
124+
"opentelemetry.proto.collector.metrics.v1.metrics_service_pb2_grpc.MetricsServiceStub",
125+
),
126+
(
127+
"py:class",
128+
"opentelemetry.proto.collector.logs.v1.logs_service_pb2_grpc.LogsServiceStub",
129+
),
118130
(
119131
"py:class",
120132
"opentelemetry.exporter.otlp.proto.grpc.exporter.OTLPExporterMixin",

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_log_exporter/__init__.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# limitations under the License.
1313

1414
from os import environ
15-
from typing import Dict, Optional, Sequence, Tuple, Union
15+
from typing import Dict, Literal, Optional, Sequence, Tuple, Union
1616
from typing import Sequence as TypingSequence
1717

1818
from grpc import ChannelCredentials, Compression
@@ -29,7 +29,6 @@
2929
LogsServiceStub,
3030
)
3131
from opentelemetry.sdk._logs import LogData
32-
from opentelemetry.sdk._logs import LogRecord as SDKLogRecord
3332
from opentelemetry.sdk._logs.export import LogExporter, LogExportResult
3433
from opentelemetry.sdk.environment_variables import (
3534
_OTEL_PYTHON_EXPORTER_OTLP_GRPC_LOGS_CREDENTIAL_PROVIDER,
@@ -46,11 +45,13 @@
4645

4746
class OTLPLogExporter(
4847
LogExporter,
49-
OTLPExporterMixin[SDKLogRecord, ExportLogsServiceRequest, LogExportResult],
48+
OTLPExporterMixin[
49+
Sequence[LogData],
50+
ExportLogsServiceRequest,
51+
LogExportResult,
52+
LogsServiceStub,
53+
],
5054
):
51-
_result = LogExportResult
52-
_stub = LogsServiceStub
53-
5455
def __init__(
5556
self,
5657
endpoint: Optional[str] = None,
@@ -61,12 +62,11 @@ def __init__(
6162
] = None,
6263
timeout: Optional[float] = None,
6364
compression: Optional[Compression] = None,
64-
channel_options: Optional[TypingSequence[Tuple[str, str]]] = None,
65+
channel_options: Optional[Tuple[Tuple[str, str]]] = None,
6566
):
66-
if insecure is None:
67-
insecure = environ.get(OTEL_EXPORTER_OTLP_LOGS_INSECURE)
68-
if insecure is not None:
69-
insecure = insecure.lower() == "true"
67+
insecure_logs = environ.get(OTEL_EXPORTER_OTLP_LOGS_INSECURE)
68+
if insecure is None and insecure_logs is not None:
69+
insecure = insecure_logs.lower() == "true"
7070

7171
if (
7272
not insecure
@@ -90,29 +90,30 @@ def __init__(
9090
if compression is None
9191
else compression
9292
)
93-
endpoint = endpoint or environ.get(OTEL_EXPORTER_OTLP_LOGS_ENDPOINT)
94-
95-
headers = headers or environ.get(OTEL_EXPORTER_OTLP_LOGS_HEADERS)
9693

97-
super().__init__(
98-
**{
99-
"endpoint": endpoint,
100-
"insecure": insecure,
101-
"credentials": credentials,
102-
"headers": headers,
103-
"timeout": timeout or environ_timeout,
104-
"compression": compression,
105-
"channel_options": channel_options,
106-
}
94+
OTLPExporterMixin.__init__(
95+
self,
96+
endpoint=endpoint or environ.get(OTEL_EXPORTER_OTLP_LOGS_ENDPOINT),
97+
insecure=insecure,
98+
credentials=credentials,
99+
headers=headers or environ.get(OTEL_EXPORTER_OTLP_LOGS_HEADERS),
100+
timeout=timeout or environ_timeout,
101+
compression=compression,
102+
stub=LogsServiceStub,
103+
result=LogExportResult,
104+
channel_options=channel_options,
107105
)
108106

109107
def _translate_data(
110108
self, data: Sequence[LogData]
111109
) -> ExportLogsServiceRequest:
112110
return encode_logs(data)
113111

114-
def export(self, batch: Sequence[LogData]) -> LogExportResult:
115-
return self._export(batch)
112+
def export( # type: ignore [reportIncompatibleMethodOverride]
113+
self,
114+
batch: Sequence[LogData],
115+
) -> Literal[LogExportResult.SUCCESS, LogExportResult.FAILURE]:
116+
return OTLPExporterMixin._export(self, batch)
116117

117118
def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
118119
OTLPExporterMixin.shutdown(self, timeout_millis=timeout_millis)

0 commit comments

Comments
 (0)