Skip to content

Commit f2a816e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into renovate/junit5-monorepo
2 parents f59ec3e + 77ca1ad commit f2a816e

File tree

18 files changed

+434
-33
lines changed

18 files changed

+434
-33
lines changed

.github/component_owners.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ components:
2525
baggage-processor:
2626
- mikegoldsmith
2727
- zeitlinger
28+
cloudfoundry-resources:
29+
- KarstenSchnitter
2830
compressors:
2931
- jack-berg
3032
consistent-sampling:

.github/scripts/draft-change-log-entries.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ component_names["aws-xray/"]="AWS X-Ray SDK support"
2929
component_names["aws-xray-propagator/"]="AWS X-Ray propagator"
3030
component_names["azure-resources/"]="Azure resources"
3131
component_names["baggage-processor/"]="Baggage processor"
32+
component_names["cloudfoundry-resources/"]="CloudFoundry resources"
3233
component_names["compressors/"]="Compressors"
3334
component_names["consistent-sampling/"]="Consistent sampling"
3435
component_names["disk-buffering/"]="Disk buffering"
@@ -49,7 +50,6 @@ component_names["runtime-attach/"]="Runtime attach"
4950
component_names["resource-providers/"]="Resource providers"
5051
component_names["samplers/"]="Samplers"
5152
component_names["span-stacktrace/"]="Span stack traces"
52-
component_names["static-instrumenter/"]="Static instrumenter"
5353

5454
echo "## Unreleased"
5555
echo

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,78 @@
22

33
## Unreleased
44

5+
## Version 1.44.0 (2025-02-21)
6+
7+
### AWS resources
8+
9+
- Changed resource attribute `container.image.tag` to `container.image.tags`
10+
([#1736](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1736))
11+
12+
### AWS X-Ray propagator
13+
14+
- Make `xray-lambda` propagator available via SPI
15+
([#1669](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1669))
16+
- Support Lineage in XRay trace header and remove additional baggage from being added
17+
([#1671](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1671))
18+
19+
### CloudFoundry resources - New 🌟
20+
21+
CloudFoundry resource detector.
22+
23+
### Disk buffering
24+
25+
- Use delegate's temporality
26+
([#1672](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1672))
27+
28+
### GCP authentication extension
29+
30+
- Publish both shaded and unshaded variants
31+
([#1688](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1688))
32+
33+
### JMX metrics
34+
35+
- Updated Hadoop metric unit definitions to align with semantic conventions
36+
([#1675](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1675))
37+
- Updated Kafka metric unit definitions to align with semantic conventions
38+
([#1670](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1670))
39+
40+
### JMX scraper
41+
42+
- Use SDK autoconfigure module
43+
([#1651](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1651))
44+
- Rename `otel.jmx.custom.scraping.config` to `otel.jmx.config` in order to align
45+
with `io.opentelemetry.instrumentation:opentelemetry-jmx-metrics`
46+
([#1678](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1678))
47+
- Hadoop metrics added
48+
([#1675](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1675))
49+
- Add a CLI option to test the connection
50+
([#1684](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1684))
51+
- Kafka server, producer, and consumer metrics added
52+
([#1670](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1670))
53+
- Add custom YAML support
54+
([#1741](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1741))
55+
- Add SSL support
56+
([#1710](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1710))
57+
- Replicate JMXMP/SASL config from the JMX metrics module
58+
([#1749](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1749))
59+
60+
### Maven extension
61+
62+
- Support Maven 4.0
63+
([#1679](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1679))
64+
65+
### Processors
66+
67+
- Changed `EventToSpanEventBridge` from reading `event.name` to reading the new LogRecord
68+
[EventName](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-eventname)
69+
field.
70+
([#1736](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1736))
71+
72+
### Static instrumenter
73+
74+
- Module has been removed
75+
([#1755](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1755))
76+
577
## Version 1.43.0 (2025-01-17)
678

779
### Azure resources - New 🌟

CONTRIBUTING.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1-
## Contributing
1+
# Contributing
22

3-
Pull requests for bug fixes are always welcome!
3+
Welcome to the OpenTelemetry Java Contrib Repository!
4+
5+
## Introduction
6+
7+
This repository focuses on providing tools and utilities for Java-based observability, such as remote JMX metric gathering and reporting. We’re excited to have you here! Whether you’re fixing a bug, adding a feature, or suggesting an idea, your contributions are invaluable.
48

59
Before submitting new features or changes to current functionality, it is recommended to first
610
[open an issue](https://github.com/open-telemetry/opentelemetry-java-contrib/issues/new)
711
and discuss your ideas or propose the changes you wish to make.
812

9-
### Building
13+
Questions? Ask in the OpenTelemetry [java channel](https://cloud-native.slack.com/archives/C014L2KCTE3)
14+
15+
Pull requests for bug fixes are always welcome!
16+
17+
## Pre-requisites
18+
19+
To work with this repository, ensure you have:
20+
21+
### Tools:
22+
23+
Java 17 or higher
24+
25+
### Platform Notes:
26+
27+
macOS/Linux: Ensure JAVA_HOME is set correctly.
28+
29+
## Workflow
30+
31+
1. Fork the repository
32+
2. Clone locally
33+
3. Create a branch before working on an issue
34+
35+
## Local Run/Build
1036

1137
In order to build and test this whole repository you need JDK 11+.
1238

@@ -22,21 +48,35 @@ the Sonatype OSS snapshots repository at `https://oss.sonatype.org/content/repos
2248
Building using Java 11+:
2349

2450
```bash
25-
java -version
51+
$ java -version
52+
```
53+
54+
```bash
55+
$ ./gradlew assemble
2656
```
2757

58+
## Testing
59+
2860
```bash
29-
./gradlew assemble
61+
$ ./gradlew test
3062
```
3163

32-
### Style guide
64+
### Some modules have integration tests
3365

34-
See
35-
the [Style guide](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/style-guideline.md)
36-
from the opentelemetry-java-instrumentation repository.
66+
```
67+
$ ./gradlew integrationTest
68+
```
69+
70+
Follow the Java Instrumentation [Style Guide](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/style-guideline.md) from the opentelemetry-java-instrumentation repository.
3771

38-
### Gradle conventions
72+
Failure? Check logs for errors or mismatched dependencies.
73+
74+
## Gradle conventions
3975

4076
- Use kotlin instead of groovy
4177
- Plugin versions should be specified in `settings.gradle.kts`, not in individual modules
4278
- All modules use `plugins { id("otel.java-conventions") }`
79+
80+
## Further Help
81+
82+
Join [#otel-java](https://cloud-native.slack.com/archives/C014L2KCTE3) on OpenTelemetry Slack

cloudfoundry-resources/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# OpenTelemetry CloudFoundry Resource Support
2+
3+
This module contains CloudFoundry resource detectors for OpenTelemetry.
4+
5+
The module detects environment variable `VCAP_APPLICATION`, which is present for applications deployed in CloudFoundry.
6+
This variable contains a JSON structure, which is parsed to fill the following attributes.
7+
8+
| Resource attribute | `VCAP_APPLICATION` field |
9+
|------------------------------|--------------------------|
10+
| cloudfoundry.app.id | application_id |
11+
| cloudfoundry.app.name | application_name |
12+
| cloudfoundry.app.instance.id | instance_index |
13+
| cloudfoundry.org.id | organization_id |
14+
| cloudfoundry.org.name | organization_name |
15+
| cloudfoundry.process.id | process_id |
16+
| cloudfoundry.process.type | process_type |
17+
| cloudfoundry.space.id | space_id |
18+
| cloudfoundry.space.name | space_name |
19+
20+
The resource attributes follow the [CloudFoundry semantic convention.](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/attributes-registry/cloudfoundry.md).
21+
A description of `VCAP_APPLICATION` is available in the [CloudFoundry documentation](https://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-APPLICATION).
22+
23+
## Component owners
24+
25+
- [Karsten Schnitter](https://github.com/KarstenSchnitter), SAP
26+
27+
Learn more about component owners in [component_owners.yml](../.github/component_owners.yml).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
plugins {
2+
id("otel.java-conventions")
3+
4+
id("otel.publish-conventions")
5+
}
6+
7+
description = "OpenTelemetry CloudFoundry Resources"
8+
otelJava.moduleName.set("io.opentelemetry.contrib.cloudfoundry.resources")
9+
10+
dependencies {
11+
api("io.opentelemetry:opentelemetry-api")
12+
api("io.opentelemetry:opentelemetry-sdk")
13+
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
14+
15+
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
16+
17+
implementation("com.fasterxml.jackson.core:jackson-core")
18+
implementation("io.opentelemetry.semconv:opentelemetry-semconv")
19+
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating")
20+
21+
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
22+
testImplementation("io.opentelemetry:opentelemetry-sdk-testing")
23+
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
24+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.contrib.cloudfoundry.resources;
7+
8+
import com.fasterxml.jackson.core.JsonFactory;
9+
import com.fasterxml.jackson.core.JsonParser;
10+
import com.fasterxml.jackson.core.JsonToken;
11+
import io.opentelemetry.api.common.AttributeKey;
12+
import io.opentelemetry.api.common.Attributes;
13+
import io.opentelemetry.api.common.AttributesBuilder;
14+
import io.opentelemetry.sdk.resources.Resource;
15+
import io.opentelemetry.semconv.SchemaUrls;
16+
import java.io.IOException;
17+
import java.util.function.Function;
18+
import java.util.logging.Logger;
19+
20+
public final class CloudFoundryResource {
21+
22+
private static final String ENV_VCAP_APPLICATION = "VCAP_APPLICATION";
23+
24+
// copied from CloudfoundryIncubatingAttributes
25+
private static final AttributeKey<String> CLOUDFOUNDRY_APP_ID =
26+
AttributeKey.stringKey("cloudfoundry.app.id");
27+
private static final AttributeKey<String> CLOUDFOUNDRY_APP_INSTANCE_ID =
28+
AttributeKey.stringKey("cloudfoundry.app.instance.id");
29+
private static final AttributeKey<String> CLOUDFOUNDRY_APP_NAME =
30+
AttributeKey.stringKey("cloudfoundry.app.name");
31+
private static final AttributeKey<String> CLOUDFOUNDRY_ORG_ID =
32+
AttributeKey.stringKey("cloudfoundry.org.id");
33+
private static final AttributeKey<String> CLOUDFOUNDRY_ORG_NAME =
34+
AttributeKey.stringKey("cloudfoundry.org.name");
35+
private static final AttributeKey<String> CLOUDFOUNDRY_PROCESS_ID =
36+
AttributeKey.stringKey("cloudfoundry.process.id");
37+
private static final AttributeKey<String> CLOUDFOUNDRY_PROCESS_TYPE =
38+
AttributeKey.stringKey("cloudfoundry.process.type");
39+
private static final AttributeKey<String> CLOUDFOUNDRY_SPACE_ID =
40+
AttributeKey.stringKey("cloudfoundry.space.id");
41+
private static final AttributeKey<String> CLOUDFOUNDRY_SPACE_NAME =
42+
AttributeKey.stringKey("cloudfoundry.space.name");
43+
private static final Logger LOG = Logger.getLogger(CloudFoundryResource.class.getName());
44+
private static final JsonFactory JSON_FACTORY = new JsonFactory();
45+
private static final Resource INSTANCE = buildResource(System::getenv);
46+
47+
private CloudFoundryResource() {}
48+
49+
public static Resource get() {
50+
return INSTANCE;
51+
}
52+
53+
static Resource buildResource(Function<String, String> getenv) {
54+
String vcapAppRaw = getenv.apply(ENV_VCAP_APPLICATION);
55+
// If there is no VCAP_APPLICATION in the environment, we are likely not running in CloudFoundry
56+
if (vcapAppRaw == null || vcapAppRaw.isEmpty()) {
57+
return Resource.empty();
58+
}
59+
60+
AttributesBuilder builder = Attributes.builder();
61+
try (JsonParser parser = JSON_FACTORY.createParser(vcapAppRaw)) {
62+
parser.nextToken();
63+
while (parser.nextToken() != JsonToken.END_OBJECT) {
64+
String name = parser.currentName();
65+
parser.nextToken();
66+
String value = parser.getValueAsString();
67+
switch (name) {
68+
case "application_id":
69+
builder.put(CLOUDFOUNDRY_APP_ID, value);
70+
break;
71+
case "application_name":
72+
builder.put(CLOUDFOUNDRY_APP_NAME, value);
73+
break;
74+
case "instance_index":
75+
builder.put(CLOUDFOUNDRY_APP_INSTANCE_ID, value);
76+
break;
77+
case "organization_id":
78+
builder.put(CLOUDFOUNDRY_ORG_ID, value);
79+
break;
80+
case "organization_name":
81+
builder.put(CLOUDFOUNDRY_ORG_NAME, value);
82+
break;
83+
case "process_id":
84+
builder.put(CLOUDFOUNDRY_PROCESS_ID, value);
85+
break;
86+
case "process_type":
87+
builder.put(CLOUDFOUNDRY_PROCESS_TYPE, value);
88+
break;
89+
case "space_id":
90+
builder.put(CLOUDFOUNDRY_SPACE_ID, value);
91+
break;
92+
case "space_name":
93+
builder.put(CLOUDFOUNDRY_SPACE_NAME, value);
94+
break;
95+
default:
96+
parser.skipChildren();
97+
break;
98+
}
99+
}
100+
} catch (IOException e) {
101+
LOG.warning("Cannot parse contents of environment variable VCAP_APPLICATION. Invalid JSON");
102+
}
103+
104+
return Resource.create(builder.build(), SchemaUrls.V1_24_0);
105+
}
106+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.contrib.cloudfoundry.resources;
7+
8+
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
9+
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
10+
import io.opentelemetry.sdk.resources.Resource;
11+
12+
public class CloudFoundryResourceProvider implements ResourceProvider {
13+
14+
@Override
15+
public Resource createResource(ConfigProperties configProperties) {
16+
return CloudFoundryResource.get();
17+
}
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
io.opentelemetry.contrib.cloudfoundry.resources.CloudFoundryResourceProvider

0 commit comments

Comments
 (0)