Skip to content

Commit 25a2bc0

Browse files
authored
Merge branch 'main' into fix/prom-exporter-labels
2 parents 1833050 + c44df70 commit 25a2bc0

File tree

8 files changed

+29
-17
lines changed

8 files changed

+29
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- prometheus-exporter: fix labels out of place for data points with different
1111
attribute sets
1212
([#4413](https://github.com/open-telemetry/opentelemetry-python/pull/4413))
13+
- Type indent parameter in to_json
14+
([#4402](https://github.com/open-telemetry/opentelemetry-python/pull/4402))
1315
- Tolerates exceptions when loading resource detectors via `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS`
1416
([#4373](https://github.com/open-telemetry/opentelemetry-python/pull/4373))
1517
- opentelemetry-sdk: fix OTLP exporting of Histograms with explicit buckets advisory
@@ -18,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1820
([#4444](https://github.com/open-telemetry/opentelemetry-python/pull/4444))
1921
- opentelemetry-exporter-opencensus: better dependency version range for Python 3.13
2022
([#4444](https://github.com/open-telemetry/opentelemetry-python/pull/4444))
23+
- Updated `tracecontext-integration-test` gitref to `d782773b2cf2fa4afd6a80a93b289d8a74ca894d`
24+
([#4448](https://github.com/open-telemetry/opentelemetry-python/pull/4448))
2125

2226
## Version 1.30.0/0.51b0 (2025-02-03)
2327

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __eq__(self, other: object) -> bool:
217217
return NotImplemented
218218
return self.__dict__ == other.__dict__
219219

220-
def to_json(self, indent=4) -> str:
220+
def to_json(self, indent: Optional[int] = 4) -> str:
221221
return json.dumps(
222222
{
223223
"body": self.body,

opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/point.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class NumberDataPoint:
3838
value: Union[int, float]
3939
exemplars: Sequence[Exemplar] = field(default_factory=list)
4040

41-
def to_json(self, indent=4) -> str:
41+
def to_json(self, indent: Optional[int] = 4) -> str:
4242
return dumps(asdict(self), indent=indent)
4343

4444

@@ -59,7 +59,7 @@ class HistogramDataPoint:
5959
max: float
6060
exemplars: Sequence[Exemplar] = field(default_factory=list)
6161

62-
def to_json(self, indent=4) -> str:
62+
def to_json(self, indent: Optional[int] = 4) -> str:
6363
return dumps(asdict(self), indent=indent)
6464

6565

@@ -90,7 +90,7 @@ class ExponentialHistogramDataPoint:
9090
max: float
9191
exemplars: Sequence[Exemplar] = field(default_factory=list)
9292

93-
def to_json(self, indent=4) -> str:
93+
def to_json(self, indent: Optional[int] = 4) -> str:
9494
return dumps(asdict(self), indent=indent)
9595

9696

@@ -105,7 +105,7 @@ class ExponentialHistogram:
105105
"opentelemetry.sdk.metrics.export.AggregationTemporality"
106106
)
107107

108-
def to_json(self, indent=4) -> str:
108+
def to_json(self, indent: Optional[int] = 4) -> str:
109109
return dumps(
110110
{
111111
"data_points": [
@@ -129,7 +129,7 @@ class Sum:
129129
)
130130
is_monotonic: bool
131131

132-
def to_json(self, indent=4) -> str:
132+
def to_json(self, indent: Optional[int] = 4) -> str:
133133
return dumps(
134134
{
135135
"data_points": [
@@ -151,7 +151,7 @@ class Gauge:
151151

152152
data_points: Sequence[NumberDataPoint]
153153

154-
def to_json(self, indent=4) -> str:
154+
def to_json(self, indent: Optional[int] = 4) -> str:
155155
return dumps(
156156
{
157157
"data_points": [
@@ -173,7 +173,7 @@ class Histogram:
173173
"opentelemetry.sdk.metrics.export.AggregationTemporality"
174174
)
175175

176-
def to_json(self, indent=4) -> str:
176+
def to_json(self, indent: Optional[int] = 4) -> str:
177177
return dumps(
178178
{
179179
"data_points": [
@@ -203,7 +203,7 @@ class Metric:
203203
unit: Optional[str]
204204
data: DataT
205205

206-
def to_json(self, indent=4) -> str:
206+
def to_json(self, indent: Optional[int] = 4) -> str:
207207
return dumps(
208208
{
209209
"name": self.name,
@@ -223,7 +223,7 @@ class ScopeMetrics:
223223
metrics: Sequence[Metric]
224224
schema_url: str
225225

226-
def to_json(self, indent=4) -> str:
226+
def to_json(self, indent: Optional[int] = 4) -> str:
227227
return dumps(
228228
{
229229
"scope": loads(self.scope.to_json(indent=indent)),
@@ -245,7 +245,7 @@ class ResourceMetrics:
245245
scope_metrics: Sequence[ScopeMetrics]
246246
schema_url: str
247247

248-
def to_json(self, indent=4) -> str:
248+
def to_json(self, indent: Optional[int] = 4) -> str:
249249
return dumps(
250250
{
251251
"resource": loads(self.resource.to_json(indent=indent)),
@@ -265,7 +265,7 @@ class MetricsData:
265265

266266
resource_metrics: Sequence[ResourceMetrics]
267267

268-
def to_json(self, indent=4) -> str:
268+
def to_json(self, indent: Optional[int] = 4) -> str:
269269
return dumps(
270270
{
271271
"resource_metrics": [

opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def __hash__(self) -> int:
297297
f"{dumps(self._attributes.copy(), sort_keys=True)}|{self._schema_url}" # type: ignore
298298
)
299299

300-
def to_json(self, indent: int = 4) -> str:
300+
def to_json(self, indent: Optional[int] = 4) -> str:
301301
attributes: MutableMapping[str, AttributeValue] = dict(
302302
self._attributes
303303
)

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def instrumentation_info(self) -> Optional[InstrumentationInfo]:
483483
def instrumentation_scope(self) -> Optional[InstrumentationScope]:
484484
return self._instrumentation_scope
485485

486-
def to_json(self, indent: int = 4):
486+
def to_json(self, indent: Optional[int] = 4):
487487
parent_id = None
488488
if self.parent is not None:
489489
parent_id = f"0x{trace_api.format_span_id(self.parent.span_id)}"

opentelemetry-sdk/src/opentelemetry/sdk/util/instrumentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def name(self) -> str:
153153
def attributes(self) -> Attributes:
154154
return self._attributes
155155

156-
def to_json(self, indent=4) -> str:
156+
def to_json(self, indent: Optional[int] = 4) -> str:
157157
return dumps(
158158
{
159159
"name": self._name,

scripts/tracecontext-integration-test.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
set -e
33
# hard-coding the git tag to ensure stable builds.
4-
TRACECONTEXT_GIT_TAG="98f210efd89c63593dce90e2bae0a1bdcb986f51"
4+
TRACECONTEXT_GIT_TAG="d782773b2cf2fa4afd6a80a93b289d8a74ca894d"
55
# clone w3c tracecontext tests
66
mkdir -p target
77
rm -rf ./target/trace-context
@@ -24,4 +24,11 @@ onshutdown()
2424
}
2525
trap onshutdown EXIT
2626
cd ./target/trace-context/test
27-
python test.py http://127.0.0.1:5000/verify-tracecontext
27+
28+
# The disabled test is not compatible with an optional part of the W3C
29+
# spec that we have implemented (dropping duplicated keys from tracestate).
30+
# W3C are planning to include flags for optional features in the test suite.
31+
# https://github.com/w3c/trace-context/issues/529
32+
# FIXME: update test to use flags for optional features when available.
33+
export SERVICE_ENDPOINT=http://127.0.0.1:5000/verify-tracecontext
34+
pytest test.py -k "not test_tracestate_duplicated_keys"

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ basepython: python3
271271
deps =
272272
# needed for tracecontext
273273
aiohttp~=3.6
274+
pytest==7.4.4
274275
# needed for example trace integration
275276
flask~=2.3
276277
requests~=2.7

0 commit comments

Comments
 (0)