Skip to content

Commit 2c4aaeb

Browse files
committed
Cleanups and reverting silly changes
1 parent 3369be3 commit 2c4aaeb

5 files changed

Lines changed: 29 additions & 32 deletions

File tree

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
11
Comparing source compatibility of opentelemetry-sdk-common-1.52.0-SNAPSHOT.jar against opentelemetry-sdk-common-1.51.0.jar
2-
***! MODIFIED CLASS: PUBLIC ABSTRACT io.opentelemetry.sdk.resources.Resource (not serializable)
3-
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
4-
+++ NEW INTERFACE: io.opentelemetry.sdk.resources.internal.Resource
5-
---! REMOVED METHOD: PUBLIC(-) java.lang.Object getAttribute(io.opentelemetry.api.common.AttributeKey<T>)
6-
--- REMOVED ANNOTATION: javax.annotation.Nullable
7-
GENERIC TEMPLATES: --- T:java.lang.Object
8-
---! REMOVED METHOD: PUBLIC(-) io.opentelemetry.sdk.resources.Resource merge(io.opentelemetry.sdk.resources.Resource)
9-
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.resources.Resource merge(io.opentelemetry.sdk.resources.internal.Resource)
10-
*** MODIFIED CLASS: PUBLIC io.opentelemetry.sdk.resources.ResourceBuilder (not serializable)
11-
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
12-
+++ NEW INTERFACE: io.opentelemetry.sdk.resources.internal.ResourceBuilder
2+
No changes.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
Comparing source compatibility of opentelemetry-sdk-testing-1.52.0-SNAPSHOT.jar against opentelemetry-sdk-testing-1.51.0.jar
2-
No changes.
2+
+++ NEW CLASS: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert (not serializable)
3+
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
4+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert hasDescriptionSatisfying(org.assertj.core.api.ThrowingConsumer<io.opentelemetry.api.common.Attributes>)
5+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert hasIdSatisfying(org.assertj.core.api.ThrowingConsumer<io.opentelemetry.api.common.Attributes>)
6+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert hasSchemaUrl(java.lang.String)
7+
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert hasType(java.lang.String)
8+
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions (not serializable)
9+
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
10+
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.testing.assertj.EntityAssert assertThat(io.opentelemetry.sdk.resources.internal.Entity)

exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/Otel2PrometheusConverter.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ MetricSnapshots convert(@Nullable Collection<MetricData> metricDataCollection) {
123123
if (resource == null) {
124124
resource = metricData.getResource();
125125
}
126-
if (otelScopeEnabled
127-
&& !metricData.getInstrumentationScopeInfo().getDescription().isEmpty()) {
126+
if (otelScopeEnabled && !metricData.getInstrumentationScopeInfo().getAttributes().isEmpty()) {
128127
scopes.add(metricData.getInstrumentationScopeInfo());
129128
}
130129
}
@@ -208,7 +207,7 @@ private GaugeSnapshot convertLongGauge(
208207
data.add(
209208
new GaugeDataPointSnapshot(
210209
(double) longData.getValue(),
211-
convertAttributes(resource, scope, longData.getDescription()),
210+
convertAttributes(resource, scope, longData.getAttributes()),
212211
convertLongExemplar(longData.getExemplars())));
213212
}
214213
return new GaugeSnapshot(metadata, data);
@@ -224,7 +223,7 @@ private CounterSnapshot convertLongCounter(
224223
data.add(
225224
new CounterDataPointSnapshot(
226225
(double) longData.getValue(),
227-
convertAttributes(resource, scope, longData.getDescription()),
226+
convertAttributes(resource, scope, longData.getAttributes()),
228227
convertLongExemplar(longData.getExemplars()),
229228
longData.getStartEpochNanos() / NANOS_PER_MILLISECOND));
230229
}
@@ -241,7 +240,7 @@ private GaugeSnapshot convertDoubleGauge(
241240
data.add(
242241
new GaugeDataPointSnapshot(
243242
doubleData.getValue(),
244-
convertAttributes(resource, scope, doubleData.getDescription()),
243+
convertAttributes(resource, scope, doubleData.getAttributes()),
245244
convertDoubleExemplar(doubleData.getExemplars())));
246245
}
247246
return new GaugeSnapshot(metadata, data);
@@ -257,7 +256,7 @@ private CounterSnapshot convertDoubleCounter(
257256
data.add(
258257
new CounterDataPointSnapshot(
259258
doubleData.getValue(),
260-
convertAttributes(resource, scope, doubleData.getDescription()),
259+
convertAttributes(resource, scope, doubleData.getAttributes()),
261260
convertDoubleExemplar(doubleData.getExemplars()),
262261
doubleData.getStartEpochNanos() / NANOS_PER_MILLISECOND));
263262
}
@@ -278,7 +277,7 @@ private HistogramSnapshot convertHistogram(
278277
new HistogramDataPointSnapshot(
279278
ClassicHistogramBuckets.of(boundaries, histogramData.getCounts()),
280279
histogramData.getSum(),
281-
convertAttributes(resource, scope, histogramData.getDescription()),
280+
convertAttributes(resource, scope, histogramData.getAttributes()),
282281
convertDoubleExemplars(histogramData.getExemplars()),
283282
histogramData.getStartEpochNanos() / NANOS_PER_MILLISECOND));
284283
}
@@ -300,7 +299,7 @@ private HistogramSnapshot convertExponentialHistogram(
300299
"Dropping histogram "
301300
+ metadata.getName()
302301
+ " with attributes "
303-
+ histogramData.getDescription()
302+
+ histogramData.getAttributes()
304303
+ " because it has scale < -4 which is unsupported in Prometheus");
305304
return null;
306305
}
@@ -314,7 +313,7 @@ private HistogramSnapshot convertExponentialHistogram(
314313
convertExponentialHistogramBuckets(histogramData.getPositiveBuckets(), scaleDown),
315314
convertExponentialHistogramBuckets(histogramData.getNegativeBuckets(), scaleDown),
316315
histogramData.getSum(),
317-
convertAttributes(resource, scope, histogramData.getDescription()),
316+
convertAttributes(resource, scope, histogramData.getAttributes()),
318317
convertDoubleExemplars(histogramData.getExemplars()),
319318
histogramData.getStartEpochNanos() / NANOS_PER_MILLISECOND));
320319
}
@@ -358,7 +357,7 @@ private SummarySnapshot convertSummary(
358357
summaryData.getCount(),
359358
summaryData.getSum(),
360359
convertQuantiles(summaryData.getValues()),
361-
convertAttributes(resource, scope, summaryData.getDescription()),
360+
convertAttributes(resource, scope, summaryData.getAttributes()),
362361
Exemplars.EMPTY, // Exemplars for Summaries not implemented yet.
363362
summaryData.getStartEpochNanos() / NANOS_PER_MILLISECOND));
364363
}
@@ -436,7 +435,7 @@ private InfoSnapshot makeTargetInfo(Resource resource) {
436435
convertAttributes(
437436
null, // resource attributes are only copied for point's attributes
438437
null, // scope attributes are only needed for point's attributes
439-
resource.getDescription()))));
438+
resource.getAttributes()))));
440439
}
441440

442441
private InfoSnapshot makeScopeInfo(Set<InstrumentationScopeInfo> scopes) {
@@ -447,7 +446,7 @@ private InfoSnapshot makeScopeInfo(Set<InstrumentationScopeInfo> scopes) {
447446
convertAttributes(
448447
null, // resource attributes are only copied for point's attributes
449448
scope,
450-
scope.getDescription())));
449+
scope.getAttributes())));
451450
}
452451
return new InfoSnapshot(new MetricMetadata("otel_scope"), prometheusScopeInfos);
453452
}
@@ -492,7 +491,7 @@ private Labels convertAttributes(
492491
}
493492

494493
if (resource != null) {
495-
Attributes resourceAttributes = resource.getDescription();
494+
Attributes resourceAttributes = resource.getAttributes();
496495
for (AttributeKey attributeKey : allowedAttributeKeys) {
497496
Object attributeValue = resourceAttributes.get(attributeKey);
498497
if (attributeValue != null) {
@@ -525,7 +524,7 @@ private List<AttributeKey<?>> filterAllowedResourceAttributeKeys(@Nullable Resou
525524

526525
List<AttributeKey<?>> allowedAttributeKeys =
527526
resourceAttributesToAllowedKeysCache.computeIfAbsent(
528-
resource.getDescription(),
527+
resource.getAttributes(),
529528
resourceAttributes ->
530529
resourceAttributes.asMap().keySet().stream()
531530
.filter(o -> allowedResourceAttributesFilter.test(o.getKey()))

exporters/prometheus/src/test/java/io/opentelemetry/exporter/prometheus/CollectorIntegrationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,19 @@ void endToEnd() {
140140
// Resource attributes from the metric SDK resource translated to target_info
141141
stringKeyValue(
142142
"service_name",
143-
Objects.requireNonNull(resource.getDescription().get(stringKey("service.name")))),
143+
Objects.requireNonNull(resource.getAttributes().get(stringKey("service.name")))),
144144
stringKeyValue(
145145
"telemetry_sdk_name",
146146
Objects.requireNonNull(
147-
resource.getDescription().get(stringKey("telemetry.sdk.name")))),
147+
resource.getAttributes().get(stringKey("telemetry.sdk.name")))),
148148
stringKeyValue(
149149
"telemetry_sdk_language",
150150
Objects.requireNonNull(
151-
resource.getDescription().get(stringKey("telemetry.sdk.language")))),
151+
resource.getAttributes().get(stringKey("telemetry.sdk.language")))),
152152
stringKeyValue(
153153
"telemetry_sdk_version",
154154
Objects.requireNonNull(
155-
resource.getDescription().get(stringKey("telemetry.sdk.version")))));
155+
resource.getAttributes().get(stringKey("telemetry.sdk.version")))));
156156

157157
assertThat(resourceMetrics.getScopeMetricsCount()).isEqualTo(2);
158158
ScopeMetrics testScopeMetrics =

sdk/testing/src/main/java/io/opentelemetry/sdk/testing/assertj/EntityAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public EntityAssert hasType(String entityType) {
2525
return this;
2626
}
2727

28-
/** Asserts that the entity id satisfies the given asserts */
28+
/** Asserts that the entity id satisfies the given asserts. */
2929
public EntityAssert hasIdSatisfying(ThrowingConsumer<Attributes> asserts) {
3030
asserts.accept(actual.getId());
3131
return this;
3232
}
3333

34-
/** Asserts that the entity description satisfies the given asserts */
34+
/** Asserts that the entity description satisfies the given asserts. */
3535
public EntityAssert hasDescriptionSatisfying(ThrowingConsumer<Attributes> asserts) {
3636
asserts.accept(actual.getDescription());
3737
return this;

0 commit comments

Comments
 (0)