Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/pull_request_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pull Request CI (Snapshot)

on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build:
permissions:
contents: read
uses: ./.github/workflows/build.yml

event_file:
needs: build
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
1 change: 1 addition & 0 deletions .github/workflows/test_results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
workflow_run:
workflows:
- "Branch CI (Snapshot)"
- "Pull Request CI (Snapshot)"
types:
- completed

Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2024-09-19

### Changed

- Support for a null `executor`, allowing for synchronous metrics publishing.
- Verify `openTelemetry` and `metricPrefix` are not null in the `OtelMetricPublisher` constructor.

## [1.0.0] - 2024-09-17

### Added

- Initial release of the AWS SDK Java OpenTelemetry Metrics library.

[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v1.0.0
[1.0.1]: https://github.com/AppsFlyer/aws-sdk-java-opentelemetry-metrics/compare/aws-sdk-java-opentelemetry-metrics-1.0.0...aws-sdk-java-opentelemetry-metrics-1.0.1

[1.0.0]: https://github.com/AppsFlyer/aws-sdk-java-opentelemetry-metrics/releases/tag/aws-sdk-java-opentelemetry-metrics-1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ForkJoinPool;
Expand Down Expand Up @@ -45,6 +46,13 @@ public OtelMetricPublisher(OpenTelemetry openTelemetry, String metricPrefix) {
}

public OtelMetricPublisher(OpenTelemetry openTelemetry, String metricPrefix, Executor executor) {
Objects.requireNonNull(metricPrefix, "metricPrefix must not be null");
Objects.requireNonNull(openTelemetry, "openTelemetry must not be null");

if (executor == null) {
log.warn("An executor is not provided. The metrics will be published synchronously on the calling thread.");
}

this.metricPrefix = metricPrefix + ".";
this.executor = executor;

Expand All @@ -57,6 +65,11 @@ public OtelMetricPublisher(OpenTelemetry openTelemetry, String metricPrefix, Exe

@Override
public void publish(MetricCollection metricCollection) {
if (executor == null) {
publishInternal(metricCollection);
return;
}

try {
executor.execute(() -> publishInternal(metricCollection));
} catch (RejectedExecutionException ex) {
Expand Down
Loading