Skip to content

Commit 682619d

Browse files
authored
Merge pull request #1866 from microsoft/update-submodule
Update to latest otel
2 parents 532c7fe + 8cff3a8 commit 682619d

File tree

111 files changed

+1807
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1807
-550
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ jobs:
3636
path: ~/.gradle/wrapper
3737
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
3838
- name: Build otel-fork
39-
run: |
40-
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
41-
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
42-
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
43-
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
39+
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
4440
- name: Test
4541
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
4642
run: ./gradlew check --stacktrace
@@ -91,11 +87,7 @@ jobs:
9187
path: ~/.gradle/wrapper
9288
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
9389
- name: Build otel-fork
94-
run: |
95-
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
96-
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
97-
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
98-
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
90+
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
9991
- name: Test
10092
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
10193
run: ./gradlew ${{ matrix.module }}:smokeTest

.github/workflows/pr.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ jobs:
3838
path: ~/.gradle/wrapper
3939
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
4040
- name: Build otel-fork
41-
run: |
42-
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
43-
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
44-
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
45-
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
41+
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
4642
- name: Test
4743
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
4844
run: ./gradlew check --stacktrace
@@ -93,11 +89,7 @@ jobs:
9389
path: ~/.gradle/wrapper
9490
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
9591
- name: Build otel-fork
96-
run: |
97-
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
98-
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
99-
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
100-
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
92+
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
10193
- name: Test
10294
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
10395
run: ./gradlew ${{ matrix.module }}:smokeTest

agent/agent-bootstrap/gradle.lockfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ ch.qos.logback:logback-core:1.2.3=runtimeClasspath
88
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
99
com.squareup.moshi:moshi:1.11.0=runtimeClasspath
1010
com.squareup.okio:okio:1.17.5=runtimeClasspath
11-
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support:1.5.0-alpha-SNAPSHOT=runtimeClasspath
12-
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.5.0-alpha-SNAPSHOT=runtimeClasspath
13-
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
14-
io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:1.5.0-alpha-SNAPSHOT=runtimeClasspath
15-
io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:1.5.0-alpha-SNAPSHOT=runtimeClasspath
11+
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support:1.5.0+ai.patches-alpha=runtimeClasspath
12+
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.5.0+ai.patches-alpha=runtimeClasspath
13+
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
14+
io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:1.5.0+ai.patches-alpha=runtimeClasspath
15+
io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:1.5.0+ai.patches-alpha=runtimeClasspath
1616
io.opentelemetry:opentelemetry-api-metrics:1.5.0-alpha=runtimeClasspath
1717
io.opentelemetry:opentelemetry-api:1.5.0=runtimeClasspath
1818
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath

agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/diagnostics/MachineNameFinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121

2222
package com.microsoft.applicationinsights.agent.bootstrap.diagnostics;
2323

24+
import org.checkerframework.checker.nullness.qual.Nullable;
25+
2426
public class MachineNameFinder extends CachedDiagnosticsValueFinder {
2527
public static final String PROPERTY_NAME = "MachineName";
2628

2729
@Override
30+
@Nullable
2831
protected String populateValue() {
2932
String computerName = System.getenv("COMPUTERNAME");
3033
if (computerName != null) {

agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/diagnostics/PidFinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.lang.management.ManagementFactory;
2525
import java.lang.management.RuntimeMXBean;
2626
import java.lang.reflect.Method;
27+
import org.checkerframework.checker.nullness.qual.Nullable;
2728

2829
public class PidFinder extends CachedDiagnosticsValueFinder {
2930
public static final String PROPERTY_NAME = "PID";
@@ -38,6 +39,7 @@ protected String populateValue() {
3839
return getPidUsingRuntimeBean();
3940
}
4041

42+
@Nullable
4143
private static String getPidUsingRuntimeBean() {
4244
// will only work with sun based jvm
4345
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
@@ -59,6 +61,7 @@ private static String getPidUsingRuntimeBean() {
5961
}
6062
}
6163

64+
@Nullable
6265
private static String getPidUsingProcessHandle() {
6366
try {
6467
// if java.specification.version < 9, the next line will fail.

agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/diagnostics/SiteNameFinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.microsoft.applicationinsights.agent.bootstrap.diagnostics;
2323

24+
import org.checkerframework.checker.nullness.qual.Nullable;
25+
2426
public class SiteNameFinder extends CachedDiagnosticsValueFinder {
2527
// visible for testing
2628
static final String WEBSITE_SITE_NAME_ENV_VAR = "WEBSITE_SITE_NAME";
@@ -33,6 +35,7 @@ public String getName() {
3335
}
3436

3537
@Override
38+
@Nullable
3639
protected String populateValue() {
3740
String value = System.getenv(SiteNameFinder.WEBSITE_SITE_NAME_ENV_VAR);
3841
return value == null || value.isEmpty() ? null : value;

agent/agent-bootstrap/src/main/java/com/microsoft/applicationinsights/agent/bootstrap/diagnostics/status/StatusFile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import java.util.concurrent.TimeUnit;
4444
import okio.BufferedSink;
4545
import okio.Okio;
46+
import org.checkerframework.checker.nullness.qual.Nullable;
4647
import org.slf4j.Logger;
4748
import org.slf4j.LoggerFactory;
4849

@@ -313,6 +314,7 @@ private static String getUniqueId(Object pid) {
313314
}
314315
}
315316

317+
@Nullable
316318
private static String capitalize(String input) {
317319
if (input == null) {
318320
return null;
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* ApplicationInsights-Java
3+
* Copyright (c) Microsoft Corporation
4+
* All rights reserved.
5+
*
6+
* MIT License
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
8+
* software and associated documentation files (the ""Software""), to deal in the Software
9+
* without restriction, including without limitation the rights to use, copy, modify, merge,
10+
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit
11+
* persons to whom the Software is furnished to do so, subject to the following conditions:
12+
* The above copyright notice and this permission notice shall be included in all copies or
13+
* substantial portions of the Software.
14+
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17+
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19+
* DEALINGS IN THE SOFTWARE.
20+
*/
21+
22+
package patched.io.opentelemetry.api.common;
23+
24+
import io.opentelemetry.api.common.AttributeKey;
25+
import io.opentelemetry.api.common.AttributeType;
26+
import org.checkerframework.checker.nullness.qual.Nullable;
27+
28+
@SuppressWarnings("rawtypes")
29+
// TEMPORARY until optimization lands upstream
30+
final class AttributeKeyImpl<T> implements AttributeKey<T> {
31+
32+
private final AttributeType type;
33+
private final String key;
34+
private final int hashCode;
35+
36+
private AttributeKeyImpl(AttributeType type, String key) {
37+
if (type == null) {
38+
throw new NullPointerException("Null type");
39+
}
40+
this.type = type;
41+
if (key == null) {
42+
throw new NullPointerException("Null key");
43+
}
44+
this.key = key;
45+
this.hashCode = buildHashCode();
46+
}
47+
48+
// Used by auto-instrumentation agent. Check with auto-instrumentation before making changes to
49+
// this method.
50+
//
51+
// In particular, do not change this return type to AttributeKeyImpl because auto-instrumentation
52+
// hijacks this method and returns a bridged implementation of Context.
53+
//
54+
// Ideally auto-instrumentation would hijack the public AttributeKey.*Key() instead of this
55+
// method, but auto-instrumentation also needs to inject its own implementation of AttributeKey
56+
// into the class loader at the same time, which causes a problem because injecting a class into
57+
// the class loader automatically resolves its super classes (interfaces), which in this case is
58+
// Context, which would be the same class (interface) being instrumented at that time,
59+
// which would lead to the JVM throwing a LinkageError "attempted duplicate interface definition"
60+
static <T> AttributeKey<T> create(@Nullable String key, AttributeType type) {
61+
return new AttributeKeyImpl<>(type, key != null ? key : "");
62+
}
63+
64+
@Override
65+
public AttributeType getType() {
66+
return type;
67+
}
68+
69+
@Override
70+
public String getKey() {
71+
return key;
72+
}
73+
74+
@Override
75+
public boolean equals(@Nullable Object o) {
76+
if (o == this) {
77+
return true;
78+
}
79+
if (o instanceof AttributeKeyImpl) {
80+
AttributeKeyImpl<?> that = (AttributeKeyImpl<?>) o;
81+
return this.type.equals(that.getType()) && this.key.equals(that.getKey());
82+
}
83+
return false;
84+
}
85+
86+
@Override
87+
public int hashCode() {
88+
return hashCode;
89+
}
90+
91+
@Override
92+
public String toString() {
93+
return key;
94+
}
95+
96+
private int buildHashCode() {
97+
int result = 1;
98+
result *= 1000003;
99+
result ^= type.hashCode();
100+
result *= 1000003;
101+
result ^= key.hashCode();
102+
return result;
103+
}
104+
}

agent/agent-gc-monitor/gc-monitor-api/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file is expected to be part of source control.
44
com.google.errorprone:error_prone_annotations:2.7.1=runtimeClasspath
55
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
6-
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
6+
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
77
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
88
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
99
org.junit:junit-bom:5.7.2=runtimeClasspath

agent/agent-gc-monitor/gc-monitor-core/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ plugins {
33
}
44

55
dependencies {
6+
compileOnly("com.google.auto.service:auto-service")
7+
annotationProcessor("com.google.auto.service:auto-service")
8+
69
implementation(project(":agent:agent-gc-monitor:gc-monitor-api"))
710
implementation("org.slf4j:slf4j-api")
811
}

0 commit comments

Comments
 (0)