Skip to content

Commit

Permalink
Merge pull request #1866 from microsoft/update-submodule
Browse files Browse the repository at this point in the history
Update to latest otel
  • Loading branch information
trask authored Aug 31, 2021
2 parents 532c7fe + 8cff3a8 commit 682619d
Show file tree
Hide file tree
Showing 111 changed files with 1,807 additions and 550 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Build otel-fork
run: |
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
- name: Test
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
run: ./gradlew check --stacktrace
Expand Down Expand Up @@ -91,11 +87,7 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Build otel-fork
run: |
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
- name: Test
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
run: ./gradlew ${{ matrix.module }}:smokeTest
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Build otel-fork
run: |
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
- name: Test
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
run: ./gradlew check --stacktrace
Expand Down Expand Up @@ -93,11 +89,7 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Build otel-fork
run: |
./otel/gradlew --project-dir otel/gradle-plugins publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :javaagent-extension-api:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel :muzzle:publishToMavenLocal --stacktrace
./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
run: ./otel/gradlew --project-dir otel publishToMavenLocal --stacktrace
- name: Test
# TODO enable build cache, either --build-cache here, or org.gradle.caching=true in gradle.properties
run: ./gradlew ${{ matrix.module }}:smokeTest
Expand Down
10 changes: 5 additions & 5 deletions agent/agent-bootstrap/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ ch.qos.logback:logback-core:1.2.3=runtimeClasspath
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
com.squareup.moshi:moshi:1.11.0=runtimeClasspath
com.squareup.okio:okio:1.17.5=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-annotation-support:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-api-metrics:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-api:1.5.0=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@

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

import org.checkerframework.checker.nullness.qual.Nullable;

public class MachineNameFinder extends CachedDiagnosticsValueFinder {
public static final String PROPERTY_NAME = "MachineName";

@Override
@Nullable
protected String populateValue() {
String computerName = System.getenv("COMPUTERNAME");
if (computerName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Method;
import org.checkerframework.checker.nullness.qual.Nullable;

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

@Nullable
private static String getPidUsingRuntimeBean() {
// will only work with sun based jvm
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
Expand All @@ -59,6 +61,7 @@ private static String getPidUsingRuntimeBean() {
}
}

@Nullable
private static String getPidUsingProcessHandle() {
try {
// if java.specification.version < 9, the next line will fail.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

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

import org.checkerframework.checker.nullness.qual.Nullable;

public class SiteNameFinder extends CachedDiagnosticsValueFinder {
// visible for testing
static final String WEBSITE_SITE_NAME_ENV_VAR = "WEBSITE_SITE_NAME";
Expand All @@ -33,6 +35,7 @@ public String getName() {
}

@Override
@Nullable
protected String populateValue() {
String value = System.getenv(SiteNameFinder.WEBSITE_SITE_NAME_ENV_VAR);
return value == null || value.isEmpty() ? null : value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.concurrent.TimeUnit;
import okio.BufferedSink;
import okio.Okio;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -313,6 +314,7 @@ private static String getUniqueId(Object pid) {
}
}

@Nullable
private static String capitalize(String input) {
if (input == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* ApplicationInsights-Java
* Copyright (c) Microsoft Corporation
* All rights reserved.
*
* MIT License
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the ""Software""), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

package patched.io.opentelemetry.api.common;

import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.AttributeType;
import org.checkerframework.checker.nullness.qual.Nullable;

@SuppressWarnings("rawtypes")
// TEMPORARY until optimization lands upstream
final class AttributeKeyImpl<T> implements AttributeKey<T> {

private final AttributeType type;
private final String key;
private final int hashCode;

private AttributeKeyImpl(AttributeType type, String key) {
if (type == null) {
throw new NullPointerException("Null type");
}
this.type = type;
if (key == null) {
throw new NullPointerException("Null key");
}
this.key = key;
this.hashCode = buildHashCode();
}

// Used by auto-instrumentation agent. Check with auto-instrumentation before making changes to
// this method.
//
// In particular, do not change this return type to AttributeKeyImpl because auto-instrumentation
// hijacks this method and returns a bridged implementation of Context.
//
// Ideally auto-instrumentation would hijack the public AttributeKey.*Key() instead of this
// method, but auto-instrumentation also needs to inject its own implementation of AttributeKey
// into the class loader at the same time, which causes a problem because injecting a class into
// the class loader automatically resolves its super classes (interfaces), which in this case is
// Context, which would be the same class (interface) being instrumented at that time,
// which would lead to the JVM throwing a LinkageError "attempted duplicate interface definition"
static <T> AttributeKey<T> create(@Nullable String key, AttributeType type) {
return new AttributeKeyImpl<>(type, key != null ? key : "");
}

@Override
public AttributeType getType() {
return type;
}

@Override
public String getKey() {
return key;
}

@Override
public boolean equals(@Nullable Object o) {
if (o == this) {
return true;
}
if (o instanceof AttributeKeyImpl) {
AttributeKeyImpl<?> that = (AttributeKeyImpl<?>) o;
return this.type.equals(that.getType()) && this.key.equals(that.getKey());
}
return false;
}

@Override
public int hashCode() {
return hashCode;
}

@Override
public String toString() {
return key;
}

private int buildHashCode() {
int result = 1;
result *= 1000003;
result ^= type.hashCode();
result *= 1000003;
result ^= key.hashCode();
return result;
}
}
2 changes: 1 addition & 1 deletion agent/agent-gc-monitor/gc-monitor-api/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is expected to be part of source control.
com.google.errorprone:error_prone_annotations:2.7.1=runtimeClasspath
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
org.junit:junit-bom:5.7.2=runtimeClasspath
Expand Down
3 changes: 3 additions & 0 deletions agent/agent-gc-monitor/gc-monitor-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ plugins {
}

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

implementation(project(":agent:agent-gc-monitor:gc-monitor-api"))
implementation("org.slf4j:slf4j-api")
}
2 changes: 1 addition & 1 deletion agent/agent-gc-monitor/gc-monitor-core/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This file is expected to be part of source control.
com.google.errorprone:error_prone_annotations:2.7.1=runtimeClasspath
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
org.junit:junit-bom:5.7.2=runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

package com.microsoft.gcmonitor;

import com.google.auto.service.AutoService;
import java.lang.management.ManagementFactory;
import java.util.concurrent.ExecutorService;
import javax.management.MBeanServerConnection;

@AutoService(GcMonitorFactory.class)
public class JmxGcMonitorFactory implements GcMonitorFactory {

@Override
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion agent/agent-gc-monitor/gc-monitor-tests/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
org.junit:junit-bom:5.7.2=runtimeClasspath
Expand Down
2 changes: 1 addition & 1 deletion agent/agent-profiler/agent-alerting-api/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
org.junit:junit-bom:5.7.2=runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.microsoft.applicationinsights.alerting.config;

import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;

/** Contains the overall configuration of the entire alerting subsystem. */
public class AlertingConfiguration {
Expand Down Expand Up @@ -66,7 +67,7 @@ public CollectionPlanConfiguration getCollectionPlanConfiguration() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
Expand Down Expand Up @@ -124,7 +125,7 @@ public long getCooldown() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.time.ZonedDateTime;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;

public class CollectionPlanConfiguration {

Expand Down Expand Up @@ -81,7 +82,7 @@ public String getSettingsMoniker() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.microsoft.applicationinsights.alerting.config;

import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;

public class DefaultConfiguration {

Expand All @@ -37,7 +38,7 @@ public DefaultConfiguration(
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion agent/agent-profiler/agent-alerting/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.google.guava:guava-bom:30.1.1-jre=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0-alpha-SNAPSHOT=runtimeClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.5.0+ai.patches-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom-alpha:1.5.0-alpha=runtimeClasspath
io.opentelemetry:opentelemetry-bom:1.5.0=runtimeClasspath
org.junit:junit-bom:5.7.2=runtimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.microsoft.applicationinsights.alerting.config.AlertMetricType;
import java.time.ZonedDateTime;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;

/** Individual sample of telemetry data. */
public class TelemetryDataPoint implements Comparable<TelemetryDataPoint> {
Expand Down Expand Up @@ -62,7 +63,7 @@ public AlertMetricType getType() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
}
Expand Down
Loading

0 comments on commit 682619d

Please sign in to comment.