Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
ae34f0a
Initial plan
Copilot Aug 24, 2025
93a6cf8
Initial plan
Copilot Aug 24, 2025
9ca72f6
Initial plan
Copilot Aug 24, 2025
cd4fd9b
Initial plan
Copilot Aug 24, 2025
f19f94a
Initial plan
Copilot Aug 24, 2025
91c5a19
Initial plan
Copilot Aug 24, 2025
e5727db
Initial plan
Copilot Aug 24, 2025
024deba
Initial plan
Copilot Aug 24, 2025
7de3186
Initial plan
Copilot Aug 24, 2025
fc6cbd1
Update azure-resources module to follow style guide
Copilot Aug 24, 2025
58c2195
Update baggage-processor module to follow style guide
Copilot Aug 24, 2025
bb45a61
Initial plan
Copilot Aug 24, 2025
587a5ab
Initial plan
Copilot Aug 24, 2025
faa6e69
Add static imports and final keywords to improve style guide compliance
Copilot Aug 24, 2025
b8d3512
Initial plan
Copilot Aug 24, 2025
66d5a43
Update cloudfoundry-resources module to follow style guide
Copilot Aug 24, 2025
b11c7f4
Clean up accidentally committed temporary files
Copilot Aug 24, 2025
941b89d
Update aws-resources module to follow style guide: add @AutoService a…
Copilot Aug 24, 2025
c8f017a
Initial plan
Copilot Aug 24, 2025
0b1f72d
Initial plan
Copilot Aug 24, 2025
e9f6582
Changes before error encountered
Copilot Aug 24, 2025
506e1aa
Changes before error encountered
Copilot Aug 24, 2025
11f6928
Changes before error encountered
Copilot Aug 24, 2025
2cfe17e
Initial plan
Copilot Aug 24, 2025
4f29d6f
Changes before error encountered
Copilot Aug 24, 2025
dae1381
Changes before error encountered
Copilot Aug 24, 2025
899eef1
Initial plan
Copilot Aug 24, 2025
a3811f2
Changes before error encountered
Copilot Aug 24, 2025
5870a47
Initial plan
Copilot Aug 24, 2025
a08f104
Initial plan
Copilot Aug 24, 2025
fb51291
Changes before error encountered
Copilot Aug 24, 2025
fc78164
Changes before error encountered
Copilot Aug 24, 2025
5e6a3f4
Initial plan
Copilot Aug 24, 2025
d52f737
Initial plan
Copilot Aug 24, 2025
efdf186
Changes before error encountered
Copilot Aug 24, 2025
f516318
Initial plan
Copilot Aug 24, 2025
2b5738a
Initial plan
Copilot Aug 24, 2025
31ff21a
Initial plan
Copilot Aug 24, 2025
7aa1191
Changes before error encountered
Copilot Aug 24, 2025
184b62c
Initial plan
Copilot Aug 24, 2025
b76ab58
Changes before error encountered
Copilot Aug 24, 2025
2c1d0f9
Add final keyword to public classes and optimize static imports per s…
Copilot Aug 24, 2025
650cca8
Initial plan
Copilot Aug 24, 2025
90cab8f
Initial plan
Copilot Aug 24, 2025
9bec733
Update processors module to follow style guide
Copilot Aug 24, 2025
0bdd303
Changes before error encountered
Copilot Aug 24, 2025
90a2939
Update span-stacktrace module to follow style guide
Copilot Aug 24, 2025
4e2572f
Update samplers module to follow style guide
Copilot Aug 24, 2025
8d500c9
Merge PR #285: Update span-stacktrace module to follow style guide
trask Aug 24, 2025
7325631
Merge PR #283: Update samplers module to follow style guide
trask Aug 24, 2025
8cc049d
Merge PR #281: [WIP] Update resource-providers module to follow style…
trask Aug 24, 2025
c9f85dc
Merge PR #279: [WIP] Update prometheus-client-bridge module to follow…
trask Aug 24, 2025
fff3cfe
Merge PR #277: [WIP] Update processors module to follow style guide
trask Aug 24, 2025
d2808b0
Merge PR #275: [WIP] Update opamp-client module to follow style guide
trask Aug 24, 2025
ee87bff
Merge PR #273: Update noop-api module to follow style guide
trask Aug 24, 2025
fe3ce9a
Merge PR #271: [WIP] Update micrometer-meter-provider module to follo…
trask Aug 24, 2025
4d11494
Merge PR #269: [WIP] Update maven-extension module to follow style guide
trask Aug 24, 2025
13bb9a3
Merge PR #267: [WIP] Update kafka-exporter module to follow style guide
trask Aug 24, 2025
7ccfab7
Merge PR #265: [WIP] Update jmx-scraper module to follow style guide
trask Aug 24, 2025
ccdeb10
Merge PR #263: [WIP] Update jmx-metrics module to follow style guide
trask Aug 24, 2025
80b8105
Merge PR #261: [WIP] Update jfr-events module to follow style guide
trask Aug 24, 2025
1a08020
Merge PR #259: [WIP] Update jfr-connection module to follow style guide
trask Aug 24, 2025
374354e
Merge PR #257: [WIP] Update inferred-spans module to follow style guide
trask Aug 24, 2025
5748702
Merge PR #255: [WIP] Update ibm-mq-metrics module to follow style guide
trask Aug 24, 2025
e2c78aa
Merge PR #253: [WIP] Update gcp-resources module to follow style guide
trask Aug 24, 2025
48b2eeb
Merge PR #251: [WIP] Update gcp-auth-extension module to follow style…
trask Aug 24, 2025
1d2a4a7
Merge PR #249: [WIP] Update disk-buffering module to follow style guide
trask Aug 24, 2025
96773a1
Merge PR #247: [WIP] Update consistent-sampling module to follow styl…
trask Aug 24, 2025
6bd5eb6
Merge PR #245: Update cloudfoundry-resources module to follow style g…
trask Aug 24, 2025
670f193
Merge PR #243: Update baggage-processor module to follow style guide
trask Aug 24, 2025
8a44464
Merge PR #241: Update azure-resources module to follow style guide
trask Aug 24, 2025
d3596af
Merge PR #239: [WIP] Update aws-xray-propagator module to follow styl…
trask Aug 24, 2025
dcbbab0
Merge PR #237: [WIP] Update aws-xray module to follow style guide
trask Aug 24, 2025
19ecad4
Merge PR #235: Update aws-resources module to follow style guide
trask Aug 24, 2025
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
4 changes: 4 additions & 0 deletions aws-resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description = "OpenTelemetry AWS Resources Support"
otelJava.moduleName.set("io.opentelemetry.contrib.aws.resource")

dependencies {
annotationProcessor("com.google.auto.service:auto-service")

api("io.opentelemetry:opentelemetry-api")
compileOnly("io.opentelemetry:opentelemetry-api-incubator")
api("io.opentelemetry:opentelemetry-sdk")
Expand All @@ -16,13 +18,15 @@ dependencies {
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")

compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
compileOnly("com.google.auto.service:auto-service")

implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.squareup.okhttp3:okhttp")

testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
testImplementation("io.opentelemetry:opentelemetry-api-incubator")
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
testImplementation("com.google.auto.service:auto-service")

testImplementation("com.linecorp.armeria:armeria-junit5")
testRuntimeOnly("org.bouncycastle:bcpkix-jdk15on")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link BeanstalkResource}. */
@AutoService(ResourceProvider.class)
public final class BeanstalkResourceProvider extends CloudResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link Ec2Resource}. */
@AutoService(ResourceProvider.class)
public final class Ec2ResourceProvider extends CloudResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link EcsResource}. */
@AutoService(ResourceProvider.class)
public final class EcsResourceProvider extends CloudResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link EksResource}. */
@AutoService(ResourceProvider.class)
public final class EksResourceProvider extends CloudResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

package io.opentelemetry.contrib.aws.resource;

import com.google.auto.service.AutoService;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;

/** {@link ResourceProvider} for automatically configuring {@link LambdaResource}. */
@AutoService(ResourceProvider.class)
public final class LambdaResourceProvider extends CloudResourceProvider {
@Override
public Resource createResource(ConfigProperties config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package io.opentelemetry.contrib.aws.resource.internal;

import com.google.auto.service.AutoService;
import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties;
import io.opentelemetry.contrib.aws.resource.BeanstalkResource;
import io.opentelemetry.contrib.aws.resource.Ec2Resource;
Expand All @@ -15,7 +16,9 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.resources.ResourceBuilder;

public class AwsResourceDetector implements ComponentProvider<Resource> {
@AutoService(ComponentProvider.class)
@SuppressWarnings("rawtypes")
public final class AwsResourceDetector implements ComponentProvider<Resource> {

@Override
public Class<Resource> getType() {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

package io.opentelemetry.contrib.awsxray;

import static java.util.Collections.unmodifiableList;
import static java.util.Objects.requireNonNull;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.api.common.AttributeKey;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
Expand All @@ -19,7 +19,7 @@
* #setAttributesKeysToPropagate} are not invoked, the builder defaults to using specific {@link
* AwsAttributeKeys} as propagation targets.
*/
public class AttributePropagatingSpanProcessorBuilder {
public final class AttributePropagatingSpanProcessorBuilder {

private AttributeKey<String> spanNamePropagationKey = AwsAttributeKeys.AWS_LOCAL_OPERATION;
private List<AttributeKey<String>> attributesKeysToPropagate =
Expand All @@ -43,7 +43,7 @@ public AttributePropagatingSpanProcessorBuilder setSpanNamePropagationKey(
public AttributePropagatingSpanProcessorBuilder setAttributesKeysToPropagate(
List<AttributeKey<String>> attributesKeysToPropagate) {
requireNonNull(attributesKeysToPropagate, "attributesKeysToPropagate");
this.attributesKeysToPropagate = Collections.unmodifiableList(attributesKeysToPropagate);
this.attributesKeysToPropagate = unmodifiableList(attributesKeysToPropagate);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,34 @@

package io.opentelemetry.contrib.awsxray;

import static io.opentelemetry.api.common.AttributeKey.stringKey;

import io.opentelemetry.api.common.AttributeKey;

/** Utility class holding attribute keys with special meaning to AWS components */
final class AwsAttributeKeys {

private AwsAttributeKeys() {}

static final AttributeKey<String> AWS_SPAN_KIND = AttributeKey.stringKey("aws.span.kind");
static final AttributeKey<String> AWS_SPAN_KIND = stringKey("aws.span.kind");

static final AttributeKey<String> AWS_LOCAL_SERVICE = AttributeKey.stringKey("aws.local.service");
static final AttributeKey<String> AWS_LOCAL_SERVICE = stringKey("aws.local.service");

static final AttributeKey<String> AWS_LOCAL_OPERATION =
AttributeKey.stringKey("aws.local.operation");
static final AttributeKey<String> AWS_LOCAL_OPERATION = stringKey("aws.local.operation");

static final AttributeKey<String> AWS_REMOTE_SERVICE =
AttributeKey.stringKey("aws.remote.service");
static final AttributeKey<String> AWS_REMOTE_SERVICE = stringKey("aws.remote.service");

static final AttributeKey<String> AWS_REMOTE_OPERATION =
AttributeKey.stringKey("aws.remote.operation");
static final AttributeKey<String> AWS_REMOTE_OPERATION = stringKey("aws.remote.operation");

static final AttributeKey<String> AWS_REMOTE_TARGET = AttributeKey.stringKey("aws.remote.target");
static final AttributeKey<String> AWS_REMOTE_TARGET = stringKey("aws.remote.target");

// use the same AWS Resource attribute name defined by OTel java auto-instr for aws_sdk_v_1_1
// TODO: all AWS specific attributes should be defined in semconv package and reused cross all
// otel packages. Related sim -
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8710

static final AttributeKey<String> AWS_BUCKET_NAME = AttributeKey.stringKey("aws.bucket.name");
static final AttributeKey<String> AWS_QUEUE_NAME = AttributeKey.stringKey("aws.queue.name");
static final AttributeKey<String> AWS_STREAM_NAME = AttributeKey.stringKey("aws.stream.name");
static final AttributeKey<String> AWS_TABLE_NAME = AttributeKey.stringKey("aws.table.name");
static final AttributeKey<String> AWS_BUCKET_NAME = stringKey("aws.bucket.name");
static final AttributeKey<String> AWS_QUEUE_NAME = stringKey("aws.queue.name");
static final AttributeKey<String> AWS_STREAM_NAME = stringKey("aws.stream.name");
static final AttributeKey<String> AWS_TABLE_NAME = stringKey("aws.table.name");

private AwsAttributeKeys() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* attributes.
*/
@Immutable
public class AwsMetricAttributesSpanExporter implements SpanExporter {
public final class AwsMetricAttributesSpanExporter implements SpanExporter {

private final SpanExporter delegate;
private final MetricAttributeGenerator generator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.trace.export.SpanExporter;

public class AwsMetricAttributesSpanExporterBuilder {
public final class AwsMetricAttributesSpanExporterBuilder {

// Defaults
private static final MetricAttributeGenerator DEFAULT_GENERATOR =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package io.opentelemetry.contrib.awsxray;

import static io.opentelemetry.api.common.AttributeKey.longKey;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.metrics.DoubleHistogram;
Expand Down Expand Up @@ -41,7 +43,7 @@
public final class AwsSpanMetricsProcessor implements SpanProcessor {

private static final AttributeKey<Long> HTTP_STATUS_CODE =
AttributeKey.longKey("http.status_code");
longKey("http.status_code");

private static final double NANOS_TO_MILLIS = 1_000_000.0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

package io.opentelemetry.contrib.awsxray;

import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.logging.FINE;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.context.Context;
Expand All @@ -29,17 +36,15 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.Nullable;

/** Remote sampler that gets sampling configuration from AWS X-Ray. */
public final class AwsXrayRemoteSampler implements Sampler, Closeable {

static final long DEFAULT_TARGET_INTERVAL_NANOS = TimeUnit.SECONDS.toNanos(10);
static final long DEFAULT_TARGET_INTERVAL_NANOS = SECONDS.toNanos(10);

private static final Logger logger = Logger.getLogger(AwsXrayRemoteSampler.class.getName());

Expand Down Expand Up @@ -134,26 +139,25 @@ private void getAndUpdateSampler() {
initialSampler,
response.getSamplingRules().stream()
.map(SamplingRuleRecord::getRule)
.collect(Collectors.toList())));
.collect(toList())));

previousRulesResponse = response;
ScheduledFuture<?> existingFetchTargetsFuture = fetchTargetsFuture;
if (existingFetchTargetsFuture != null) {
existingFetchTargetsFuture.cancel(false);
}
fetchTargetsFuture =
executor.schedule(
this::fetchTargets, DEFAULT_TARGET_INTERVAL_NANOS, TimeUnit.NANOSECONDS);
executor.schedule(this::fetchTargets, DEFAULT_TARGET_INTERVAL_NANOS, NANOSECONDS);
}
} catch (Throwable t) {
logger.log(Level.FINE, "Failed to update sampler", t);
logger.log(FINE, "Failed to update sampler", t);
}
scheduleSamplerUpdate();
}

private void scheduleSamplerUpdate() {
long delay = pollingIntervalNanos + jitterNanos.next();
pollFuture = executor.schedule(this::getAndUpdateSampler, delay, TimeUnit.NANOSECONDS);
pollFuture = executor.schedule(this::getAndUpdateSampler, delay, NANOSECONDS);
}

/**
Expand All @@ -168,7 +172,7 @@ Duration getNextSamplerUpdateScheduledDuration() {
if (pollFuture == null) {
return null;
}
return Duration.ofNanos(pollFuture.getDelay(TimeUnit.NANOSECONDS));
return Duration.ofNanos(pollFuture.getDelay(NANOSECONDS));
}

private void fetchTargets() {
Expand All @@ -181,28 +185,25 @@ private void fetchTargets() {
Date now = Date.from(Instant.ofEpochSecond(0, clock.now()));
List<SamplingStatisticsDocument> statistics = xrayRulesSampler.snapshot(now);
Set<String> requestedTargetRuleNames =
statistics.stream()
.map(SamplingStatisticsDocument::getRuleName)
.collect(Collectors.toSet());
statistics.stream().map(SamplingStatisticsDocument::getRuleName).collect(toSet());

GetSamplingTargetsResponse response =
client.getSamplingTargets(GetSamplingTargetsRequest.create(statistics));
Map<String, SamplingTargetDocument> targets =
response.getDocuments().stream()
.collect(Collectors.toMap(SamplingTargetDocument::getRuleName, Function.identity()));
.collect(toMap(SamplingTargetDocument::getRuleName, Function.identity()));
updateInternalSamplers(xrayRulesSampler.withTargets(targets, requestedTargetRuleNames, now));
} catch (Throwable t) {
// Might be a transient API failure, try again after a default interval.
fetchTargetsFuture =
executor.schedule(
this::fetchTargets, DEFAULT_TARGET_INTERVAL_NANOS, TimeUnit.NANOSECONDS);
executor.schedule(this::fetchTargets, DEFAULT_TARGET_INTERVAL_NANOS, NANOSECONDS);
return;
}

long nextTargetFetchIntervalNanos =
xrayRulesSampler.nextTargetFetchTimeNanos() - clock.nanoTime();
fetchTargetsFuture =
executor.schedule(this::fetchTargets, nextTargetFetchIntervalNanos, TimeUnit.NANOSECONDS);
executor.schedule(this::fetchTargets, nextTargetFetchIntervalNanos, NANOSECONDS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package io.opentelemetry.contrib.awsxray;

import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.opentelemetry.sdk.common.Clock;
Expand All @@ -26,7 +28,7 @@ public final class AwsXrayRemoteSamplerBuilder {
private Clock clock = Clock.getDefault();
private String endpoint = DEFAULT_ENDPOINT;
@Nullable private Sampler initialSampler;
private long pollingIntervalNanos = TimeUnit.SECONDS.toNanos(DEFAULT_POLLING_INTERVAL_SECS);
private long pollingIntervalNanos = SECONDS.toNanos(DEFAULT_POLLING_INTERVAL_SECS);

AwsXrayRemoteSamplerBuilder(Resource resource) {
this.resource = resource;
Expand All @@ -51,7 +53,7 @@ public AwsXrayRemoteSamplerBuilder setEndpoint(String endpoint) {
@CanIgnoreReturnValue
public AwsXrayRemoteSamplerBuilder setPollingInterval(Duration delay) {
requireNonNull(delay, "delay");
return setPollingInterval(delay.toNanos(), TimeUnit.NANOSECONDS);
return setPollingInterval(delay.toNanos(), NANOSECONDS);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.Map;

@AutoService(ConfigurableSamplerProvider.class)
public class AwsXrayRemoteSamplerProvider implements ConfigurableSamplerProvider {
public final class AwsXrayRemoteSamplerProvider implements ConfigurableSamplerProvider {

@Override
public Sampler createSampler(ConfigProperties config) {
Expand Down
Loading
Loading