Skip to content

Commit 7666027

Browse files
breedx-splklaurit
andauthored
Pre v1.14.2 (#878)
* Fix allocation metric (#864) * Fix allocation metric * convert field to local variable * prepare for v1.14.2 patch release * update changelog Co-authored-by: Lauri Tulmin <[email protected]>
1 parent f4168c7 commit 7666027

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this repository adheres to [Semantic Versioning](https://semver.org/spec/v2.
88

99
## Unreleased
1010

11+
## v1.14.2 - 2022-08-12
12+
- Fix allocated memory metrics by preventing `WeakReference` from GCing (#864)
13+
1114
## v1.14.1 - 2022-07-27
1215

1316
### Bugfixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ To extend the instrumentation with the OpenTelemetry Instrumentation for Java,
157157
you have to use a compatible API version.
158158

159159
<!-- IMPORTANT: do not change comments or break those lines below -->
160-
The Splunk Distribution of OpenTelemetry Java version <!--SPLUNK_VERSION-->1.14.1<!--SPLUNK_VERSION--> is compatible
160+
The Splunk Distribution of OpenTelemetry Java version <!--SPLUNK_VERSION-->1.14.2<!--SPLUNK_VERSION--> is compatible
161161
with:
162162

163163
* OpenTelemetry API version <!--OTEL_VERSION-->1.15.0<!--OTEL_VERSION-->

deployments/cloudfoundry/buildpack/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you want to use a specific version of the Java agent in your application, you
4040
environment variable before application deployment, either using `cf set-env` or the `manifest.yml` file:
4141

4242
```sh
43-
$ cf set-env SPLUNK_OTEL_JAVA_VERSION 1.14.1
43+
$ cf set-env SPLUNK_OTEL_JAVA_VERSION 1.14.2
4444
```
4545

4646
By default, the [latest](https://github.com/signalfx/splunk-otel-java/releases/latest) available agent version is used.

instrumentation/jvm-metrics/src/main/java/com/splunk/opentelemetry/instrumentation/jvmmetrics/micrometer/MicrometerAllocatedMemoryMetrics.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@
2525
import io.micrometer.core.instrument.binder.MeterBinder;
2626

2727
public class MicrometerAllocatedMemoryMetrics implements MeterBinder {
28-
private final AllocatedMemoryMetrics allocatedMemoryMetrics = new AllocatedMemoryMetrics();
2928

3029
@Override
3130
public void bindTo(MeterRegistry registry) {
31+
AllocatedMemoryMetrics allocatedMemoryMetrics = new AllocatedMemoryMetrics();
3232
if (!allocatedMemoryMetrics.isAvailable()) {
3333
return;
3434
}
3535

36+
// FunctionCounter keeps a weak reference to allocatedMemoryMetrics. To ensure it is not
37+
// collected we pass a capturing lambda as the function instead of method reference
38+
// AllocatedMemoryMetrics::getCumulativeAllocationTotal
3639
FunctionCounter.builder(
3740
METRIC_NAME,
3841
allocatedMemoryMetrics,
39-
AllocatedMemoryMetrics::getCumulativeAllocationTotal)
42+
(unused) -> allocatedMemoryMetrics.getCumulativeAllocationTotal())
4043
.description("Approximate sum of heap allocations")
4144
.baseUnit(BaseUnits.BYTES)
4245
.tag("type", "heap")

0 commit comments

Comments
 (0)