Skip to content

Commit baa1e61

Browse files
authored
Merge branch 'main' into export-nonmonotonic-sums-as-gauges-in-prometheus
2 parents c1882d9 + 93992ce commit baa1e61

File tree

44 files changed

+144
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+144
-60
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
# Otherwise, set variable to the commit of your branch on
1111
# opentelemetry-python-contrib which is compatible with these Core repo
1212
# changes.
13-
CONTRIB_REPO_SHA: dadcd01524449ddee07a8d8405890a60caeb8c8e
13+
CONTRIB_REPO_SHA: d1fb91ae0c075751b580ff4892bae44749d5810d
1414
# This is needed because we do not clone the core repo in contrib builds anymore.
1515
# When running contrib builds as part of core builds, we use actions/checkout@v2 which
1616
# does not set an environment variable (simply just runs tox), which is different when

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Modify Prometheus exporter to translate non-monotonic Sums into Gauges
1111
([#3306](https://github.com/open-telemetry/opentelemetry-python/pull/3306))
12+
13+
14+
## Version 1.19.0/0.40b0 (2023-07-13)
15+
16+
- Drop `setuptools` runtime requirement.
17+
([#3372](https://github.com/open-telemetry/opentelemetry-python/pull/3372))
18+
- Update the body type in the log
19+
([$3343](https://github.com/open-telemetry/opentelemetry-python/pull/3343))
1220
- Add max_scale option to Exponential Bucket Histogram Aggregation
1321
([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323))
1422
- Use BoundedAttributes instead of raw dict to extract attributes from LogRecord
15-
([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310))
23+
([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310))
1624
- Support dropped_attributes_count in LogRecord and exporters
1725
([#3351](https://github.com/open-telemetry/opentelemetry-python/pull/3351))
1826
- Add unit to view instrument selection criteria
@@ -21,8 +29,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2129
[#3355](https://github.com/open-telemetry/opentelemetry-python/pull/3355))
2230
- Include endpoint in Grpc transient error warning
2331
[#3362](https://github.com/open-telemetry/opentelemetry-python/pull/3362))
32+
- Fixed bug where logging export is tracked as trace
33+
[#3375](https://github.com/open-telemetry/opentelemetry-python/pull/3375))
34+
2435

25-
## Version 1.18.0/0.39b0 (2023-05-04)
36+
## Version 1.18.0/0.39b0 (2023-05-19)
2637

2738
- Select histogram aggregation with an environment variable
2839
([#3265](https://github.com/open-telemetry/opentelemetry-python/pull/3265))

docs/examples/fork-process-model/flask-gunicorn/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
click==7.1.2
22
Flask==1.1.2
33
googleapis-common-protos==1.52.0
4-
grpcio==1.35.0
4+
grpcio==1.53.0
55
gunicorn==20.0.4
66
itsdangerous==1.1.0
77
Jinja2==2.11.3

docs/examples/fork-process-model/flask-uwsgi/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
click==7.1.2
22
Flask==1.1.2
33
googleapis-common-protos==1.52.0
4-
grpcio==1.35.0
4+
grpcio==1.53.0
55
gunicorn==20.0.4
66
itsdangerous==1.1.0
77
Jinja2==2.11.3

eachdist.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sortfirst=
1111
exporter/*
1212

1313
[stable]
14-
version=1.19.0.dev
14+
version=1.20.0.dev
1515

1616
packages=
1717
opentelemetry-sdk
@@ -30,7 +30,7 @@ packages=
3030
opentelemetry-api
3131

3232
[prerelease]
33-
version=0.40b0.dev
33+
version=0.41b0.dev
3434

3535
packages=
3636
opentelemetry-opentracing-shim

exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
__version__ = "1.19.0.dev"
16+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
__version__ = "1.19.0.dev"
16+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-jaeger/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ classifiers = [
2626
"Typing :: Typed",
2727
]
2828
dependencies = [
29-
"opentelemetry-exporter-jaeger-proto-grpc == 1.19.0.dev",
30-
"opentelemetry-exporter-jaeger-thrift == 1.19.0.dev",
29+
"opentelemetry-exporter-jaeger-proto-grpc == 1.20.0.dev",
30+
"opentelemetry-exporter-jaeger-thrift == 1.20.0.dev",
3131
]
3232

3333
[project.optional-dependencies]

exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
__version__ = "1.19.0.dev"
16+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-opencensus/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ classifiers = [
2828
dependencies = [
2929
"grpcio >= 1.0.0, < 2.0.0",
3030
"opencensus-proto >= 0.1.0, < 1.0.0",
31-
"opentelemetry-api >= 1.19.0.dev",
31+
"opentelemetry-api >= 1.20.0.dev",
3232
"opentelemetry-sdk >= 1.15",
3333
"protobuf ~= 3.13",
3434
"setuptools >= 16.0",

exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.40b0.dev"
15+
__version__ = "0.41b0.dev"

exporter/opentelemetry-exporter-otlp-proto-common/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.11",
2626
]
2727
dependencies = [
28-
"opentelemetry-proto == 1.19.0.dev",
28+
"opentelemetry-proto == 1.20.0.dev",
2929
]
3030

3131
[project.urls]

exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-otlp-proto-grpc/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ dependencies = [
3131
"googleapis-common-protos ~= 1.52",
3232
"grpcio >= 1.0.0, < 2.0.0",
3333
"opentelemetry-api ~= 1.15",
34-
"opentelemetry-proto == 1.19.0.dev",
35-
"opentelemetry-sdk ~= 1.19.0.dev",
36-
"opentelemetry-exporter-otlp-proto-common == 1.19.0.dev",
34+
"opentelemetry-proto == 1.20.0.dev",
35+
"opentelemetry-sdk ~= 1.20.0.dev",
36+
"opentelemetry-exporter-otlp-proto-common == 1.20.0.dev",
3737
]
3838

3939
[project.optional-dependencies]

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-otlp-proto-http/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ dependencies = [
3030
"backoff >= 1.10.0, < 3.0.0; python_version>='3.7'",
3131
"googleapis-common-protos ~= 1.52",
3232
"opentelemetry-api ~= 1.15",
33-
"opentelemetry-proto == 1.19.0.dev",
34-
"opentelemetry-sdk ~= 1.19.0.dev",
35-
"opentelemetry-exporter-otlp-proto-common == 1.19.0.dev",
33+
"opentelemetry-proto == 1.20.0.dev",
34+
"opentelemetry-sdk ~= 1.20.0.dev",
35+
"opentelemetry-exporter-otlp-proto-common == 1.20.0.dev",
3636
"requests ~= 2.7",
3737
]
3838

exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-otlp/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ classifiers = [
2626
"Typing :: Typed",
2727
]
2828
dependencies = [
29-
"opentelemetry-exporter-otlp-proto-grpc == 1.19.0.dev",
30-
"opentelemetry-exporter-otlp-proto-http == 1.19.0.dev",
29+
"opentelemetry-exporter-otlp-proto-grpc == 1.20.0.dev",
30+
"opentelemetry-exporter-otlp-proto-http == 1.20.0.dev",
3131
]
3232

3333
[project.entry-points.opentelemetry_logs_exporter]

exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.40b0.dev"
15+
__version__ = "0.41b0.dev"

exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-zipkin-proto-http/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ classifiers = [
2727
]
2828
dependencies = [
2929
"opentelemetry-api ~= 1.3",
30-
"opentelemetry-exporter-zipkin-json == 1.19.0.dev",
30+
"opentelemetry-exporter-zipkin-json == 1.20.0.dev",
3131
"opentelemetry-sdk ~= 1.11",
3232
"protobuf ~= 3.12",
3333
"requests ~= 2.7",

exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

exporter/opentelemetry-exporter-zipkin/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ classifiers = [
2626
"Typing :: Typed",
2727
]
2828
dependencies = [
29-
"opentelemetry-exporter-zipkin-json == 1.19.0.dev",
30-
"opentelemetry-exporter-zipkin-proto-http == 1.19.0.dev",
29+
"opentelemetry-exporter-zipkin-json == 1.20.0.dev",
30+
"opentelemetry-exporter-zipkin-proto-http == 1.20.0.dev",
3131
]
3232

3333
[project.optional-dependencies]

exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

opentelemetry-api/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ classifiers = [
2626
]
2727
dependencies = [
2828
"Deprecated >= 1.2.6",
29-
"setuptools >= 16.0",
3029
# FIXME This should be able to be removed after 3.12 is released if there is a reliable API
3130
# in importlib.metadata.
3231
"importlib-metadata ~= 6.0",

opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_logger(
143143
144144
version: Optional. The version string of the
145145
instrumenting library. Usually this should be the same as
146-
``pkg_resources.get_distribution(instrumenting_library_name).version``.
146+
``importlib.metadata.version(instrumenting_library_name)``.
147147
148148
schema_url: Optional. Specifies the Schema URL of the emitted telemetry.
149149
"""

opentelemetry-api/src/opentelemetry/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

opentelemetry-proto/src/opentelemetry/proto/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

opentelemetry-sdk/pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ classifiers = [
2626
"Typing :: Typed",
2727
]
2828
dependencies = [
29-
"opentelemetry-api == 1.19.0.dev",
30-
"opentelemetry-semantic-conventions == 0.40b0.dev",
31-
"setuptools >= 16.0",
29+
"opentelemetry-api == 1.20.0.dev",
30+
"opentelemetry-semantic-conventions == 0.41b0.dev",
3231
"typing-extensions >= 3.7.4",
3332
]
3433

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import traceback
2222
from os import environ
2323
from time import time_ns
24-
from typing import Any, Callable, Optional, Tuple, Union
24+
from typing import Any, Callable, Optional, Tuple, Union # noqa
2525

2626
from opentelemetry._logs import Logger as APILogger
2727
from opentelemetry._logs import LoggerProvider as APILoggerProvider
@@ -476,15 +476,56 @@ def _translate(self, record: logging.LogRecord) -> LogRecord:
476476
timestamp = int(record.created * 1e9)
477477
span_context = get_current_span().get_span_context()
478478
attributes = self._get_attributes(record)
479+
# This comment is taken from GanyedeNil's PR #3343, I have redacted it
480+
# slightly for clarity:
481+
# According to the definition of the Body field type in the
482+
# OTel 1.22.0 Logs Data Model article, the Body field should be of
483+
# type 'any' and should not use the str method to directly translate
484+
# the msg. This is because str only converts non-text types into a
485+
# human-readable form, rather than a standard format, which leads to
486+
# the need for additional operations when collected through a log
487+
# collector.
488+
# Considering that he Body field should be of type 'any' and should not
489+
# use the str method but record.msg is also a string type, then the
490+
# difference is just the self.args formatting?
491+
# The primary consideration depends on the ultimate purpose of the log.
492+
# Converting the default log directly into a string is acceptable as it
493+
# will be required to be presented in a more readable format. However,
494+
# this approach might not be as "standard" when hoping to aggregate
495+
# logs and perform subsequent data analysis. In the context of log
496+
# extraction, it would be more appropriate for the msg to be
497+
# converted into JSON format or remain unchanged, as it will eventually
498+
# be transformed into JSON. If the final output JSON data contains a
499+
# structure that appears similar to JSON but is not, it may confuse
500+
# users. This is particularly true for operation and maintenance
501+
# personnel who need to deal with log data in various languages.
502+
# Where is the JSON converting occur? and what about when the msg
503+
# represents something else but JSON, the expected behavior change?
504+
# For the ConsoleLogExporter, it performs the to_json operation in
505+
# opentelemetry.sdk._logs._internal.export.ConsoleLogExporter.__init__,
506+
# so it can handle any type of input without problems. As for the
507+
# OTLPLogExporter, it also handles any type of input encoding in
508+
# _encode_log located in
509+
# opentelemetry.exporter.otlp.proto.common._internal._log_encoder.
510+
# Therefore, no extra operation is needed to support this change.
511+
# The only thing to consider is the users who have already been using
512+
# this SDK. If they upgrade the SDK after this change, they will need
513+
# to readjust their logging collection rules to adapt to the latest
514+
# output format. Therefore, this change is considered a breaking
515+
# change and needs to be upgraded at an appropriate time.
479516
severity_number = std_to_otel(record.levelno)
517+
if isinstance(record.msg, str) and record.args:
518+
body = record.msg % record.args
519+
else:
520+
body = record.msg
480521
return LogRecord(
481522
timestamp=timestamp,
482523
trace_id=span_context.trace_id,
483524
span_id=span_context.span_id,
484525
trace_flags=span_context.trace_flags,
485526
severity_text=record.levelname,
486527
severity_number=severity_number,
487-
body=record.getMessage(),
528+
body=body,
488529
resource=self._logger.resource,
489530
attributes=attributes,
490531
)

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def _export_batch(self) -> int:
307307
record = self._queue.pop()
308308
self._log_records[idx] = record
309309
idx += 1
310-
token = attach(set_value("suppress_instrumentation", True))
310+
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
311311
try:
312312
self._exporter.export(self._log_records[:idx]) # type: ignore
313313
except Exception: # pylint: disable=broad-except

opentelemetry-sdk/src/opentelemetry/sdk/trace/export/in_memory_span_exporter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ class InMemorySpanExporter(SpanExporter):
2727
:func:`.get_finished_spans` method.
2828
"""
2929

30-
def __init__(self):
31-
self._finished_spans = []
30+
def __init__(self) -> None:
31+
self._finished_spans: typing.List[ReadableSpan] = []
3232
self._stopped = False
3333
self._lock = threading.Lock()
3434

35-
def clear(self):
35+
def clear(self) -> None:
3636
"""Clear list of collected spans."""
3737
with self._lock:
3838
self._finished_spans.clear()
3939

40-
def get_finished_spans(self):
40+
def get_finished_spans(self) -> typing.Tuple[ReadableSpan, ...]:
4141
"""Get list of collected spans."""
4242
with self._lock:
4343
return tuple(self._finished_spans)
@@ -50,7 +50,7 @@ def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult:
5050
self._finished_spans.extend(spans)
5151
return SpanExportResult.SUCCESS
5252

53-
def shutdown(self):
53+
def shutdown(self) -> None:
5454
"""Shut downs the exporter.
5555
5656
Calls to export after the exporter has been shut down will fail.

opentelemetry-sdk/src/opentelemetry/sdk/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.19.0.dev"
15+
__version__ = "1.20.0.dev"

0 commit comments

Comments
 (0)