diff --git a/jcommon/docean-plugin/docean-plugin-spring/src/main/java/run/mone/docean/plugin/spring/SpringPlugin.java b/jcommon/docean-plugin/docean-plugin-spring/src/main/java/run/mone/docean/plugin/spring/SpringPlugin.java
index 7af384138..7602df807 100644
--- a/jcommon/docean-plugin/docean-plugin-spring/src/main/java/run/mone/docean/plugin/spring/SpringPlugin.java
+++ b/jcommon/docean-plugin/docean-plugin-spring/src/main/java/run/mone/docean/plugin/spring/SpringPlugin.java
@@ -40,9 +40,9 @@
/**
* @Author goodjava@qq.com
* @Date 2022-07-12
- * 让docean用起来像spring
+ * Make Docean feel like Spring.
*
- * 适配spring 的注解(Service Repository Component Autowired PreDestroy PostConstruct)
+ * Annotations compatible with Spring(Service Repository Component Autowired PreDestroy PostConstruct)
*/
@DOceanPlugin
@Slf4j
@@ -80,7 +80,7 @@ public void putBean(String name, Bean bean) {
public String getInitMethodName(Object obj, Class clazz) {
return Arrays.stream(clazz.getMethods())
.map(it -> Arrays.stream(it.getAnnotations()).filter(anno -> anno instanceof PostConstruct)
- .findAny().map(it2->it.getName()).orElse(Cons.INIT))
+ .findAny().map(it2 -> it.getName()).orElse(Cons.INIT))
.filter(name -> !Cons.INIT.equals(name)).findAny().orElse(Cons.INIT);
}
@@ -88,7 +88,7 @@ public String getInitMethodName(Object obj, Class clazz) {
public String getDestoryMethodName(Object obj, Class clazz) {
return Arrays.stream(clazz.getMethods())
.map(it -> Arrays.stream(it.getAnnotations()).filter(anno -> anno instanceof PreDestroy)
- .findAny().map(it2->it.getName()).orElse(Cons.DESTORY))
+ .findAny().map(it2 -> it.getName()).orElse(Cons.DESTORY))
.filter(name -> !Cons.DESTORY.equals(name)).findAny().orElse(Cons.DESTORY);
}
diff --git a/jcommon/docean-spring-starter/pom.xml b/jcommon/docean-spring-starter/pom.xml
new file mode 100644
index 000000000..2cc80448f
--- /dev/null
+++ b/jcommon/docean-spring-starter/pom.xml
@@ -0,0 +1,67 @@
+
+
+ 4.0.0
+
+ run.mone
+ jcommon
+ 1.4-SNAPSHOT
+
+
+ docean-spring-starter
+
+
+ UTF-8
+ 2.7.15
+ 5.3.29
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${springboot.version}
+ provided
+
+
+
+
+ run.mone
+ docean
+ 1.4-java20-SNAPSHOT
+ provided
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+
+ --add-modules=jdk.incubator.concurrent
+ --enable-preview
+
+ 20
+
+ 20
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/config/DoceanAutoConfigure.java b/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/config/DoceanAutoConfigure.java
new file mode 100644
index 000000000..7807697b3
--- /dev/null
+++ b/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/config/DoceanAutoConfigure.java
@@ -0,0 +1,61 @@
+package run.mone.docean.spring.config;
+
+import com.google.common.base.Splitter;
+import com.xiaomi.youpin.docean.Ioc;
+import com.xiaomi.youpin.docean.common.Safe;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import run.mone.docean.spring.extension.Extensions;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author goodjava@qq.com
+ * @date 2023/9/19 13:46
+ */
+@Configuration
+@Slf4j
+public class DoceanAutoConfigure {
+
+ private Ioc ioc;
+
+ @Resource
+ private ApplicationContext ac;
+
+ @Value("${extensions:}")
+ private String extensionsConfig;
+
+ public static Map extensionMap = new HashMap<>();
+
+
+ @PostConstruct
+ public void initConfig() {
+ List list = Splitter.on(":").splitToList(extensionsConfig);
+ if (list.size() == 3) {
+ extensionMap.put(list.get(0), list.get(1));
+ ioc = Ioc.ins().name("extension").setContextFunction(name -> {
+ if (ac.containsBean(name)) {
+ return ac.getBean(name);
+ }
+ return Safe.callAndLog(() -> ac.getBean(Class.forName(name)), null);
+ }).init(list.get(2), "run.mone.docean.plugin.spring");
+ }
+ }
+
+
+ @Bean
+ @ConditionalOnMissingBean
+ public Extensions extensions() {
+ Extensions extensions = new Extensions(ioc);
+ return extensions;
+ }
+
+}
diff --git a/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/extension/Extensions.java b/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/extension/Extensions.java
new file mode 100644
index 000000000..3c27967b3
--- /dev/null
+++ b/jcommon/docean-spring-starter/src/main/java/run/mone/docean/spring/extension/Extensions.java
@@ -0,0 +1,24 @@
+package run.mone.docean.spring.extension;
+
+import com.xiaomi.youpin.docean.Ioc;
+import run.mone.docean.spring.config.DoceanAutoConfigure;
+
+/**
+ * @author goodjava@qq.com
+ * @date 2023/9/19 14:20
+ */
+public class Extensions {
+
+ private Ioc ioc;
+
+ public Extensions(Ioc ioc) {
+ this.ioc = ioc;
+ }
+
+ public T get(String name) {
+ String key = DoceanAutoConfigure.extensionMap.get(name);
+ return ioc.getBean(key);
+ }
+
+
+}
diff --git a/jcommon/docean-spring-starter/src/main/resources/META-INF/spring.factories b/jcommon/docean-spring-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 000000000..abf32f032
--- /dev/null
+++ b/jcommon/docean-spring-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=run.mone.docean.spring.config.DoceanAutoConfigure
\ No newline at end of file
diff --git a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java
index 4f9640cff..318ae73b0 100644
--- a/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java
+++ b/jcommon/docean/src/main/java/com/xiaomi/youpin/docean/Ioc.java
@@ -72,10 +72,10 @@ public class Ioc {
/**
* It needs to be used when interacting with containers like spring
*/
- private Function contextFunction = new Function() {
+ private Function contextFunction = new Function<>() {
@Override
public @Nullable Object apply(@Nullable String s) {
- return new Object();
+ return null;
}
};
@@ -312,6 +312,12 @@ private void initIoc0(String name, Bean bean, Field field) {
o.getDependenceFieldMap().put(bean.getName(), field);
ReflectUtils.setField(bean.getObj(), field, o.getObj());
});
+
+ //If there is a parent container, try to retrieve it from the parent container (such as Spring).
+ if (!Optional.ofNullable(b).isPresent()) {
+ Object obj = Safe.callAndLog(()-> this.contextFunction.apply(name),null);
+ Optional.ofNullable(obj).ifPresent(o -> ReflectUtils.setField(bean.getObj(), field, o));
+ }
}
private void callInit(Bean it) {
diff --git a/jcommon/http/pom.xml b/jcommon/http/pom.xml
index 323207c3d..718e384c3 100644
--- a/jcommon/http/pom.xml
+++ b/jcommon/http/pom.xml
@@ -26,4 +26,4 @@
provided
-
+
\ No newline at end of file
diff --git a/jcommon/nginx/src/main/java/com/xiaomi/youpin/nginx/NginxUtilsV2.java b/jcommon/nginx/src/main/java/com/xiaomi/youpin/nginx/NginxUtilsV2.java
index aa77bda2b..9d55347c3 100644
--- a/jcommon/nginx/src/main/java/com/xiaomi/youpin/nginx/NginxUtilsV2.java
+++ b/jcommon/nginx/src/main/java/com/xiaomi/youpin/nginx/NginxUtilsV2.java
@@ -89,8 +89,8 @@ public static String addServer(String config, String name, List serversT
});
List checkList = StringUtils.isNotEmpty(checkUrl)
- ? Lists.newArrayList("check interval=3000 rise=2 fall=3 timeout=1000 type=http", String.format("check_http_send \"HEAD %s HTTP/1.0\\r\\n\\r\\n\"", checkUrl))
- : Lists.newArrayList("check interval=3000 rise=2 fall=3 timeout=1000 type=tcp");
+ ? Lists.newArrayList("check interval=3000 rise=2 fall=3 timeout=1000 default_down=false type=http", String.format("check_http_send \"HEAD %s HTTP/1.0\\r\\n\\r\\n\"", checkUrl))
+ : Lists.newArrayList("check interval=3000 rise=2 fall=3 timeout=1000 default_down=false type=tcp");
checkList.stream().forEach(p -> {
NgxParam param = new NgxParam();
param.addValue(p);
diff --git a/jcommon/rcurve/pom.xml b/jcommon/rcurve/pom.xml
index 16beb4b39..191de5843 100644
--- a/jcommon/rcurve/pom.xml
+++ b/jcommon/rcurve/pom.xml
@@ -59,4 +59,4 @@
provided
-
+
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/README.md b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/README.md
deleted file mode 100644
index 1e2d7066a..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-## Introduction
-
-This repository serves as a collection of examples of extending functionality of OpenTelemetry Java instrumentation agent.
-It demonstrates how to repackage the aforementioned agent adding custom functionality.
-For every extension point provided by OpenTelemetry Java instrumentation, this repository contains an example of
-its usage.
-
-## General structure
-
-This repository has four main submodules:
-
-* `custom` contains all custom functionality, SPI and other extensions
-* `agent` contains the main repackaging functionality and, optionally, an entry point to the agent, if one wishes to
-customize that
-* `instrumentation` contains custom instrumentations added by vendor
-* `smoke-tests` contains simple tests to verify that resulting agent builds and applies correctly
-
-## Extensions examples
-
-* [DemoIdGenerator](custom/src/main/java/com/example/javaagent/DemoIdGenerator.java) - custom `IdGenerator`
-* [DemoPropagator](custom/src/main/java/com/example/javaagent/DemoPropagator.java) - custom `TextMapPropagator`
-* [DemoPropertySource](custom/src/main/java/com/example/javaagent/DemoPropertySource.java) - default configuration
-* [DemoSampler](custom/src/main/java/com/example/javaagent/DemoSampler.java) - custom `Sampler`
-* [DemoSpanProcessor](custom/src/main/java/com/example/javaagent/DemoSpanProcessor.java) - custom `SpanProcessor`
-* [DemoSpanExporter](custom/src/main/java/com/example/javaagent/DemoSpanExporter.java) - custom `SpanExporter`
-* [DemoServlet3InstrumentationModule](instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java) - additional instrumentation
-
-## Instrumentation customisation
-
-There are several options to override or customise instrumentation provided by the upstream agent.
-The following description follows one specific use-case:
-
-> Instrumentation X from Otel distribution creates span that I don't like and I want to change it in my vendor distro.
-
-As an example, let us take some database client instrumentation that creates a span for database call
-and extracts data from db connection to provide attributes for that span.
-
-### I don't want this span at all
-The easiest case. You can just pre-configure your distribution and disable given instrumentation.
-
-### I want to add/modify some attributes and their values does NOT depend on a specific db connection instance.
-E.g. you want to add some data from call stack as span attribute.
-In this case just provide your custom `SpanProcessor`.
-No need for touching instrumentation itself.
-
-### I want to add/modify some attributes and their values depend on a specific db connection instance.
-Write a _new_ instrumentation which injects its own advice into the same method as the original one.
-Use `getOrder` method to ensure it is run after the original instrumentation.
-Now you can augment current span with new information.
-
-See [DemoServlet3Instrumentation](instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java).
-
-### I want to remove some attributes
-Write custom exporter or use attribute filtering functionality in Collector.
-
-### I don't like Otel span at all. I want to significantly modify it and its lifecycle
-Disable existing instrumentation.
-Write a new one, which injects `Advice` into the same (or better) method as the original instrumentation.
-Write your own `Advice` for this.
-Use existing `Tracer` directly or extend it.
-As you have your own `Advice`, you can control which `Tracer` you use.
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/agent/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/agent/build.gradle
deleted file mode 100644
index b1adb6210..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/agent/build.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-plugins {
- id("com.github.johnrengelman.shadow") version "6.0.0"
-}
-
-apply from: "$rootDir/gradle/shadow.gradle"
-
-def relocatePackages = ext.relocatePackages
-
-configurations {
- customShadow
-}
-
-dependencies {
- customShadow project(path: ":custom", configuration: "shadow")
- customShadow project(path: ":instrumentation", configuration: "shadow")
- implementation "io.opentelemetry.javaagent:opentelemetry-javaagent:${versions.opentelemetryJavaagent}:all"
-}
-
-CopySpec isolateSpec() {
- return copySpec {
- configurations.customShadow.files.each {
- from(zipTree(it)) {
- into("inst")
- rename("(^.*)\\.class\$", "\$1.classdata")
- }
- }
- }
-}
-
-
-tasks {
- shadowJar {
- dependsOn ':custom:shadowJar'
- dependsOn ':instrumentation:shadowJar'
- with isolateSpec()
-
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
-
- mergeServiceFiles {
- include("inst/META-INF/services/*")
- }
- exclude("**/module-info.class")
-
- relocatePackages(it)
-
- manifest {
- attributes.put("Main-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
- attributes.put("Agent-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
- attributes.put("Premain-Class", "io.opentelemetry.javaagent.OpenTelemetryAgent")
- attributes.put("Can-Redefine-Classes", "true")
- attributes.put("Can-Retransform-Classes", "true")
- attributes.put("Implementation-Vendor", "Demo")
- attributes.put("Implementation-Version", "demo-${project.version}-otel-${versions.opentelemetryJavaagent}")
- }
- }
-
- assemble {
- dependsOn(shadowJar)
- }
-}
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/build.gradle
deleted file mode 100644
index 4a0833721..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/build.gradle
+++ /dev/null
@@ -1,53 +0,0 @@
-group 'io.opentelemetry.example'
-version '1.0-SNAPSHOT'
-
-subprojects {
- version = rootProject.version
-
- apply plugin: "java"
-
- ext {
- versions = [
- opentelemetry : "1.2.0",
- opentelemetryJavaagent: "1.2.0",
- bytebuddy : "1.10.18",
- guava : "30.1-jre"
- ]
- versions.opentelemetryAlpha = "${versions.opentelemetry}-alpha"
- versions.opentelemetryJavaagentAlpha = "${versions.opentelemetryJavaagent}-alpha"
-
- deps = [
- bytebuddy : "net.bytebuddy:byte-buddy:${versions.bytebuddy}",
- bytebuddyagent : "net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}",
- autoservice : [
- "com.google.auto.service:auto-service:1.0-rc7",
- "com.google.auto:auto-common:0.8",
- "com.google.guava:guava:${versions.guava}",
- ],
- autoValueAnnotations: "com.google.auto.value:auto-value-annotations:${versions.autoValue}",
- ]
- }
-
- repositories {
- maven {
- url = uri("https://oss.sonatype.org/content/repositories/snapshots")
- }
- mavenCentral()
- }
-
- dependencies {
- testImplementation("org.mockito:mockito-core:3.3.3")
- testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
- }
-
- tasks {
- test {
- useJUnitPlatform()
- }
-
- compileJava {
- options.release.set(11)
- }
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/build.gradle
deleted file mode 100644
index fb466ba1a..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-plugins {
- id "java"
- id("com.github.johnrengelman.shadow") version "6.0.0"
-}
-
-apply from: "$rootDir/gradle/shadow.gradle"
-
-def relocatePackages = ext.relocatePackages
-
-dependencies {
- compileOnly("run.mone:opentelemetry-sdk:${versions.opentelemetry}")
- compileOnly("run.mone:opentelemetry-sdk-extension-autoconfigure:${versions.opentelemetryAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions.opentelemetryJavaagentAlpha}")
-}
-
-tasks {
- shadowJar {
- mergeServiceFiles()
-
- exclude("**/module-info.class")
-
- relocatePackages(it)
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoIdGenerator.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoIdGenerator.java
deleted file mode 100644
index 1b8f3ab38..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoIdGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.sdk.trace.IdGenerator;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Custom {@link IdGenerator} which provides span and trace ids.
- *
- * @see io.opentelemetry.sdk.trace.SdkTracerProvider
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoIdGenerator implements IdGenerator {
- private static final AtomicLong traceId = new AtomicLong(0);
- private static final AtomicLong spanId = new AtomicLong(0);
-
- @Override
- public String generateSpanId() {
- return String.format("%016d", spanId.incrementAndGet());
- }
-
- @Override
- public String generateTraceId() {
- return String.format("%032d", traceId.incrementAndGet());
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagator.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagator.java
deleted file mode 100644
index 9cd1bc94e..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.context.Context;
-import io.opentelemetry.context.ContextKey;
-import io.opentelemetry.context.propagation.TextMapGetter;
-import io.opentelemetry.context.propagation.TextMapPropagator;
-import io.opentelemetry.context.propagation.TextMapSetter;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * See
- * OpenTelemetry Specification for more information about Propagators.
- *
- * @see DemoPropagatorProvider
- */
-public class DemoPropagator implements TextMapPropagator {
- private static final String FIELD = "X-demo-field";
- private static final ContextKey PROPAGATION_START_KEY = ContextKey.named("propagation.start");
-
- @Override
- public List fields() {
- return Collections.singletonList(FIELD);
- }
-
- @Override
- public void inject(Context context, C carrier, TextMapSetter setter) {
- Long propagationStart = context.get(PROPAGATION_START_KEY);
- if (propagationStart == null) {
- propagationStart = System.currentTimeMillis();
- }
- setter.set(carrier, FIELD, String.valueOf(propagationStart));
- }
-
- @Override
- public Context extract(Context context, C carrier, TextMapGetter getter) {
- String propagationStart = getter.get(carrier, FIELD);
- if (propagationStart != null) {
- return context.with(PROPAGATION_START_KEY, Long.valueOf(propagationStart));
- } else {
- return context;
- }
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagatorProvider.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagatorProvider.java
deleted file mode 100644
index ca00a1681..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropagatorProvider.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.context.propagation.TextMapPropagator;
-import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider;
-
-/**
- * Registers the custom propagator used by this example.
- *
- * @see ConfigurablePropagatorProvider
- * @see DemoPropagator
- */
-public class DemoPropagatorProvider implements ConfigurablePropagatorProvider {
- @Override
- public TextMapPropagator getPropagator() {
- return new DemoPropagator();
- }
-
- @Override
- public String getName() {
- return "demo";
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropertySource.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropertySource.java
deleted file mode 100644
index 3bbe53e0c..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoPropertySource.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.javaagent.spi.config.PropertySource;
-import java.util.Map;
-
-/**
- * {@link PropertySource} is an SPI provided by OpenTelemetry Java instrumentation agent.
- * By implementing it custom distributions can supply their own default configuration.
- * The configuration priority, from highest to lowest is:
- * system properties -> environment variables -> configuration file -> PropertySource SPI -> hard-coded defaults
- */
-public class DemoPropertySource implements PropertySource {
-
- @Override
- public Map getProperties() {
- return Map.of(
- "otel.exporter.otlp.endpoint", "http://collector:55680",
- "otel.exporter.otlp.insecure", "true",
- "otel.config.max.attrs", "16"
- );
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoResourceProvider.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoResourceProvider.java
deleted file mode 100644
index 79f36f07e..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoResourceProvider.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.sdk.autoconfigure.ConfigProperties;
-import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
-import io.opentelemetry.sdk.resources.Resource;
-
-public class DemoResourceProvider implements ResourceProvider {
- @Override
- public Resource createResource(ConfigProperties config) {
- Attributes attributes = Attributes.builder().put("custom.resource", "demo").build();
- return Resource.create(attributes);
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSampler.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSampler.java
deleted file mode 100644
index 67bcade15..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSampler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.api.trace.SpanKind;
-import io.opentelemetry.context.Context;
-import io.opentelemetry.sdk.trace.data.LinkData;
-import io.opentelemetry.sdk.trace.samplers.Sampler;
-import io.opentelemetry.sdk.trace.samplers.SamplingDecision;
-import io.opentelemetry.sdk.trace.samplers.SamplingResult;
-import java.util.List;
-
-/**
- * This demo sampler filters out all internal spans whose name contains string "greeting".
- *
- * See
- * OpenTelemetry Specification for more information about span sampling.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSampler implements Sampler {
- @Override
- public SamplingResult shouldSample(Context parentContext, String traceId, String name,
- SpanKind spanKind, Attributes attributes, List parentLinks) {
- if (spanKind == SpanKind.INTERNAL && name.contains("greeting")) {
- return SamplingResult.create(SamplingDecision.DROP);
- } else {
- return SamplingResult.create(SamplingDecision.RECORD_AND_SAMPLE);
- }
- }
-
- @Override
- public String getDescription() {
- return "DemoSampler";
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
deleted file mode 100644
index d833c92e5..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.sdk.autoconfigure.spi.SdkTracerProviderConfigurer;
-import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder;
-import io.opentelemetry.sdk.trace.SpanLimits;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-
-/**
- * This is one of the main entry points for Instrumentation Agent's customizations.
- * It allows configuring {@link SdkTracerProviderBuilder}.
- * See the {@link #configure(SdkTracerProviderBuilder)} method below.
- *
- * Also see https://github.com/open-telemetry/opentelemetry-java/issues/2022
- *
- * @see SdkTracerProviderConfigurer
- * @see DemoPropagatorProvider
- */
-public class DemoSdkTracerProviderConfigurer implements SdkTracerProviderConfigurer {
- @Override
- public void configure(SdkTracerProviderBuilder tracerProvider) {
- tracerProvider
- .setIdGenerator(new DemoIdGenerator())
- .setSpanLimits(SpanLimits.builder().setMaxNumberOfAttributes(1024).build())
- .setSampler(new DemoSampler())
- .addSpanProcessor(new DemoSpanProcessor())
- .addSpanProcessor(SimpleSpanProcessor.create(new DemoSpanExporter()));
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanExporter.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanExporter.java
deleted file mode 100644
index 476093a76..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanExporter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.sdk.common.CompletableResultCode;
-import io.opentelemetry.sdk.trace.data.SpanData;
-import io.opentelemetry.sdk.trace.export.SpanExporter;
-import java.util.Collection;
-
-/**
- * See
- * OpenTelemetry Specification for more information about {@link SpanExporter}.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSpanExporter implements SpanExporter {
- @Override
- public CompletableResultCode export(Collection spans) {
- System.out.printf("%d spans exported%n", spans.size());
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode flush() {
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode shutdown() {
- return CompletableResultCode.ofSuccess();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanProcessor.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanProcessor.java
deleted file mode 100644
index 8abe2183e..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/java/com/example/javaagent/DemoSpanProcessor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.context.Context;
-import io.opentelemetry.sdk.common.CompletableResultCode;
-import io.opentelemetry.sdk.trace.ReadWriteSpan;
-import io.opentelemetry.sdk.trace.ReadableSpan;
-import io.opentelemetry.sdk.trace.SpanProcessor;
-
-/**
- * See
- * OpenTelemetry Specification for more information about {@link SpanProcessor}.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSpanProcessor implements SpanProcessor {
- @Override
- public void onStart(Context parentContext, ReadWriteSpan span) {
- span.setAttribute("custom", "demo");
- }
-
- @Override
- public boolean isStartRequired() {
- return true;
- }
-
- @Override
- public void onEnd(ReadableSpan span) {
-
- }
-
- @Override
- public boolean isEndRequired() {
- return false;
- }
-
- @Override
- public CompletableResultCode shutdown() {
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode forceFlush() {
- return CompletableResultCode.ofSuccess();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.javaagent.spi.config.PropertySource b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.javaagent.spi.config.PropertySource
deleted file mode 100644
index 1274076e5..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.javaagent.spi.config.PropertySource
+++ /dev/null
@@ -1 +0,0 @@
-com.example.javaagent.DemoPropertySource
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider
deleted file mode 100644
index b1ccca2b5..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider
+++ /dev/null
@@ -1 +0,0 @@
-com.example.javaagent.DemoPropagatorProvider
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider
deleted file mode 100644
index 95ac24bfb..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider
+++ /dev/null
@@ -1 +0,0 @@
-com.example.javaagent.DemoResourceProvider
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.SdkTracerProviderConfigurer b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.SdkTracerProviderConfigurer
deleted file mode 100644
index 81d953738..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/custom/src/main/resources/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.SdkTracerProviderConfigurer
+++ /dev/null
@@ -1 +0,0 @@
-com.example.javaagent.DemoSdkTracerProviderConfigurer
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/instrumentation.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/instrumentation.gradle
deleted file mode 100644
index bd3f980d6..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/instrumentation.gradle
+++ /dev/null
@@ -1,61 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'com.github.johnrengelman.shadow'
-
-apply from: "$rootDir/gradle/shadow.gradle"
-
-def relocatePackages = ext.relocatePackages
-
-configurations {
- testInstrumentation
- testAgent
-}
-
-dependencies {
- compileOnly("run.mone:opentelemetry-sdk:${versions.opentelemetry}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-api:${versions.opentelemetryJavaagentAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions.opentelemetryJavaagentAlpha}")
-
- compileOnly deps.bytebuddy
- compileOnly deps.bytebuddyagent
- annotationProcessor deps.autoservice
- compileOnly deps.autoservice
-
- // the javaagent that is going to be used when running instrumentation unit tests
- testAgent("io.opentelemetry.javaagent:opentelemetry-agent-for-testing:${versions.opentelemetryJavaagentAlpha}")
- // test dependencies
- testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:${versions.opentelemetryJavaagentAlpha}")
- testImplementation("run.mone:opentelemetry-sdk-testing:${versions.opentelemetry}")
- testImplementation("org.assertj:assertj-core:3.19.0")
-}
-
-shadowJar {
- configurations = [project.configurations.runtimeClasspath, project.configurations.testInstrumentation]
- mergeServiceFiles()
-
- archiveFileName = 'agent-testing.jar'
-
- relocatePackages(it)
-}
-
-tasks.withType(Test).configureEach {
- inputs.file(shadowJar.archiveFile)
-
- jvmArgs "-Dotel.javaagent.debug=true"
- jvmArgs "-javaagent:${configurations.testAgent.files.first().absolutePath}"
- jvmArgs "-Dotel.javaagent.experimental.initializer.jar=${shadowJar.archiveFile.get().asFile.absolutePath}"
- jvmArgs "-Dotel.javaagent.testing.additional-library-ignores.enabled=false"
- jvmArgs "-Dotel.javaagent.testing.fail-on-context-leak=true"
- // prevent sporadic gradle deadlocks, see SafeLogger for more details
- jvmArgs "-Dotel.javaagent.testing.transform-safe-logging.enabled=true"
-
- dependsOn shadowJar
-
- // The sources are packaged into the testing jar so we need to make sure to exclude from the test
- // classpath, which automatically inherits them, to ensure our shaded versions are used.
- classpath = classpath.filter {
- if (it == file("$buildDir/resources/main") || it == file("$buildDir/classes/java/main")) {
- return false
- }
- return true
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/shadow.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/shadow.gradle
deleted file mode 100644
index fce270eab..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/shadow.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-ext.relocatePackages = { shadowJar ->
- // Prevents conflict with other SLF4J instances. Important for premain.
- shadowJar.relocate 'org.slf4j', 'io.opentelemetry.javaagent.slf4j'
- // rewrite dependencies calling Logger.getLogger
- shadowJar.relocate 'java.util.logging.Logger', 'io.opentelemetry.javaagent.bootstrap.PatchLogger'
-
- // rewrite library instrumentation dependencies
- shadowJar.relocate "io.opentelemetry.instrumentation", "io.opentelemetry.javaagent.shaded.instrumentation"
-
- // relocate OpenTelemetry API usage
- shadowJar.relocate "io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api"
- shadowJar.relocate "io.opentelemetry.semconv", "io.opentelemetry.javaagent.shaded.io.opentelemetry.semconv"
- shadowJar.relocate "io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context"
-
- // relocate the OpenTelemetry extensions that are used by instrumentation modules
- // these extensions live in the AgentClassLoader, and are injected into the user's class loader
- // by the instrumentation modules that use them
- shadowJar.relocate "io.opentelemetry.extension.aws", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.aws"
- shadowJar.relocate "io.opentelemetry.extension.kotlin", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.kotlin"
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.jar
index 62d4c0535..912744eeb 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.properties b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index be52383ef..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew
deleted file mode 100755
index fbd7c5158..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew.bat b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew.bat
deleted file mode 100644
index 5093609d5..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/gradlew.bat
+++ /dev/null
@@ -1,104 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/build.gradle
deleted file mode 100644
index 3c7ade182..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/build.gradle
+++ /dev/null
@@ -1,31 +0,0 @@
-plugins {
- id("com.github.johnrengelman.shadow") version "6.0.0"
-}
-
-apply from: "$rootDir/gradle/shadow.gradle"
-
-def relocatePackages = ext.relocatePackages
-
-Project instr_project = project
-subprojects {
- afterEvaluate { Project subProj ->
- if (subProj.getPlugins().hasPlugin('java')) {
- // Make it so all instrumentation subproject tests can be run with a single command.
- instr_project.tasks.test.dependsOn(subProj.tasks.test)
-
- instr_project.dependencies {
- implementation(project(subProj.getPath()))
- }
- }
- }
-}
-
-shadowJar {
- mergeServiceFiles()
-
- exclude '**/module-info.class'
-
- duplicatesStrategy = DuplicatesStrategy.FAIL
-
- relocatePackages(it)
-}
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/build.gradle
deleted file mode 100644
index 7c4f6f7a7..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-apply from: "$rootDir/gradle/instrumentation.gradle"
-
-dependencies {
- compileOnly "javax.servlet:javax.servlet-api:3.0.1"
-
- testInstrumentation "io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-common:${versions.opentelemetryJavaagentAlpha}"
- testInstrumentation "io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-2.2:${versions.opentelemetryJavaagentAlpha}"
- testInstrumentation "io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-3.0:${versions.opentelemetryJavaagentAlpha}"
-
- testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common:${versions.opentelemetryJavaagentAlpha}") {
- exclude group: 'org.eclipse.jetty', module: 'jetty-server'
- }
-
- testImplementation "com.squareup.okhttp3:okhttp:3.12.12"
- testImplementation "javax.servlet:javax.servlet-api:3.0.1"
- testImplementation "org.eclipse.jetty:jetty-server:8.0.0.v20110901"
- testImplementation "org.eclipse.jetty:jetty-servlet:8.0.0.v20110901"
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java
deleted file mode 100644
index 3ad52a354..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.example.javaagent.instrumentation;
-
-import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
-import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
-import net.bytebuddy.asm.Advice;
-import net.bytebuddy.description.method.MethodDescription;
-import net.bytebuddy.description.type.TypeDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-
-import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
-import static io.opentelemetry.javaagent.extension.matcher.NameMatchers.namedOneOf;
-import static java.util.Collections.singletonMap;
-import static net.bytebuddy.matcher.ElementMatchers.*;
-
-public class DemoServlet3Instrumentation implements TypeInstrumentation {
- @Override
- public ElementMatcher typeMatcher() {
- return safeHasSuperType(namedOneOf("javax.servlet.Filter", "javax.servlet.http.HttpServlet"));
- }
-
- @Override
- public Map extends ElementMatcher super MethodDescription>, String> transformers() {
- return singletonMap(
- namedOneOf("doFilter", "service")
- .and(takesArgument(0, named("javax.servlet.ServletRequest")))
- .and(takesArgument(1, named("javax.servlet.ServletResponse")))
- .and(isPublic()),
- this.getClass().getName() + "$DemoServlet3Advice");
- }
-
- @SuppressWarnings("unused")
- public static class DemoServlet3Advice {
-
- @Advice.OnMethodEnter(suppress = Throwable.class)
- public static void onEnter(@Advice.Argument(value = 1) ServletResponse response) {
- if (!(response instanceof HttpServletResponse)) {
- return;
- }
-
- HttpServletResponse httpServletResponse = (HttpServletResponse) response;
- if (!httpServletResponse.containsHeader("X-server-id")) {
- httpServletResponse.setHeader(
- "X-server-id", Java8BytecodeBridge.currentSpan().getSpanContext().getTraceId());
- }
- }
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java
deleted file mode 100644
index f5d177a7c..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.example.javaagent.instrumentation;
-
-import static io.opentelemetry.javaagent.extension.matcher.NameMatchers.namedOneOf;
-import static java.util.Collections.singletonList;
-import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
-import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
-import io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher;
-import java.util.List;
-import net.bytebuddy.matcher.ElementMatcher;
-
-/**
- * This is a demo instrumentation which hooks into servlet invocation and modifies the http
- * response.
- */
-@AutoService(InstrumentationModule.class)
-public final class DemoServlet3InstrumentationModule extends InstrumentationModule {
- public DemoServlet3InstrumentationModule() {
- super("servlet-demo", "servlet-3");
- }
-
- /*
- We want this instrumentation to be applied after the standard servlet instrumentation.
- The latter creates a server span around http request.
- This instrumentation needs access to that server span.
- */
- @Override
- public int order() {
- return 1;
- }
-
- @Override
- public ElementMatcher.Junction classLoaderMatcher() {
- return ClassLoaderMatcher.hasClassesNamed("javax.servlet.http.HttpServlet");
- }
-
- @Override
- public List typeInstrumentations() {
- return singletonList(new DemoServlet3Instrumentation());
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/test/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationTest.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/test/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationTest.java
deleted file mode 100644
index bb752c07a..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/instrumentation/servlet-3/src/test/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.example.javaagent.instrumentation;
-
-import static io.opentelemetry.sdk.testing.assertj.TracesAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import io.opentelemetry.api.trace.SpanKind;
-import io.opentelemetry.instrumentation.test.utils.PortUtils;
-import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
-import java.io.IOException;
-import java.io.Writer;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import okhttp3.HttpUrl;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-/**
- * This is a demo instrumentation test that verifies that the custom servlet instrumentation was applied.
- */
-class DemoServlet3InstrumentationTest {
- @RegisterExtension
- static final AgentInstrumentationExtension instrumentation = AgentInstrumentationExtension
- .create();
-
- static final OkHttpClient httpClient = new OkHttpClient();
-
- static int port;
- static Server server;
-
- @BeforeAll
- static void startServer() throws Exception {
- port = PortUtils.findOpenPort();
- server = new Server(port);
- for (var connector : server.getConnectors()) {
- connector.setHost("localhost");
- }
-
- var servletContext = new ServletContextHandler(null, null);
- servletContext.addServlet(DefaultServlet.class, "/");
- servletContext.addServlet(TestServlet.class, "/servlet");
- server.setHandler(servletContext);
-
- server.start();
- }
-
- @AfterAll
- static void stopServer() throws Exception {
- server.stop();
- server.destroy();
- }
-
- @Test
- void shouldAddCustomHeader() throws Exception {
- // given
- var request =
- new Request.Builder()
- .url(HttpUrl.get("http://localhost:" + port + "/servlet"))
- .get()
- .build();
-
- // when
- var response = httpClient.newCall(request).execute();
-
- // then
- assertEquals(200, response.code());
- assertEquals("result", response.body().string());
-
- assertThat(instrumentation.waitForTraces(1))
- .hasSize(1)
- .hasTracesSatisfyingExactly(trace -> trace.hasSize(1)
- .hasSpansSatisfyingExactly(span -> span.hasName("/servlet").hasKind(SpanKind.SERVER)));
-
- var traceId = instrumentation.spans().get(0).getTraceId();
- assertEquals(traceId, response.header("X-server-id"));
- }
-
- public static class TestServlet extends HttpServlet {
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- try (Writer writer = response.getWriter()) {
- writer.write("result");
- response.setStatus(200);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/settings.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/settings.gradle
deleted file mode 100644
index 3fe07b603..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/settings.gradle
+++ /dev/null
@@ -1,8 +0,0 @@
-rootProject.name = 'opentelemetry-java-instrumentation-demo'
-
-include "agent"
-include "custom"
-include "instrumentation"
-include "instrumentation:servlet-3"
-include "smoke-tests"
-
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/build.gradle
deleted file mode 100644
index 62ea916b1..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/build.gradle
+++ /dev/null
@@ -1,27 +0,0 @@
-plugins {
- id "java"
-}
-
-dependencies {
- testImplementation("org.testcontainers:testcontainers:1.15.3")
- testImplementation("com.fasterxml.jackson.core:jackson-databind:2.11.2")
- testImplementation("com.google.protobuf:protobuf-java-util:3.12.4")
- testImplementation("com.squareup.okhttp3:okhttp:3.12.12")
- testImplementation("run.mone:opentelemetry-proto")
- testImplementation("run.mone:opentelemetry-api")
-
- testImplementation("ch.qos.logback:logback-classic:1.2.3")
-}
-
-tasks.test {
- useJUnitPlatform()
-
- testLogging.showStandardStreams = true
-
- def shadowTask = project(":agent").tasks.shadowJar
- inputs.files(layout.files(shadowTask))
-
- doFirst {
- jvmArgs("-Dio.opentelemetry.smoketest.agent.shadowJar.path=${shadowTask.archiveFile.get()}")
- }
-}
\ No newline at end of file
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java
deleted file mode 100644
index b8956aa29..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import java.util.concurrent.TimeUnit;
-import okhttp3.OkHttpClient;
-
-public class OkHttpUtils {
-
- static OkHttpClient.Builder clientBuilder() {
- TimeUnit unit = TimeUnit.MINUTES;
- return new OkHttpClient.Builder()
- .connectTimeout(1, unit)
- .writeTimeout(1, unit)
- .readTimeout(1, unit);
- }
-
- public static OkHttpClient client() {
- return client(false);
- }
-
- public static OkHttpClient client(boolean followRedirects) {
- return clientBuilder().followRedirects(followRedirects).build();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SmokeTest.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SmokeTest.java
deleted file mode 100644
index 194ae50bf..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SmokeTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.util.JsonFormat;
-import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
-import io.opentelemetry.proto.trace.v1.Span;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.ResponseBody;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.Network;
-import org.testcontainers.containers.output.Slf4jLogConsumer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.utility.MountableFile;
-
-abstract class SmokeTest {
- private static final Logger logger = LoggerFactory.getLogger(SmokeTest.class);
-
- private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
- protected static OkHttpClient client = OkHttpUtils.client();
-
- private static final Network network = Network.newNetwork();
- protected static final String agentPath =
- System.getProperty("io.opentelemetry.smoketest.agent.shadowJar.path");
-
- protected abstract String getTargetImage(int jdk);
-
- /**
- * Subclasses can override this method to customise target application's environment
- */
- protected Map getExtraEnv() {
- return Collections.emptyMap();
- }
-
- private static GenericContainer backend;
- private static GenericContainer collector;
-
- @BeforeAll
- static void setupSpec() {
- backend =
- new GenericContainer<>(
- "ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend-20210324.684269693")
- .withExposedPorts(8080)
- .waitingFor(Wait.forHttp("/health").forPort(8080))
- .withNetwork(network)
- .withNetworkAliases("backend")
- .withLogConsumer(new Slf4jLogConsumer(logger));
- backend.start();
-
- collector =
- new GenericContainer<>("otel/opentelemetry-collector-dev:latest")
- .dependsOn(backend)
- .withNetwork(network)
- .withNetworkAliases("collector")
- .withLogConsumer(new Slf4jLogConsumer(logger))
- .withCopyFileToContainer(
- MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
- .withCommand("--config /etc/otel.yaml");
- collector.start();
- }
-
- protected GenericContainer target;
-
- void startTarget(int jdk) {
- target =
- new GenericContainer<>(getTargetImage(jdk))
- .withExposedPorts(8080)
- .withNetwork(network)
- .withLogConsumer(new Slf4jLogConsumer(logger))
- .withCopyFileToContainer(
- MountableFile.forHostPath(agentPath), "/opentelemetry-javaagent.jar")
- .withEnv("JAVA_TOOL_OPTIONS", "-javaagent:/opentelemetry-javaagent.jar")
- .withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
- .withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
- .withEnv("OTEL_PROPAGATORS", "tracecontext,baggage,demo")
- .withEnv(getExtraEnv());
- target.start();
- }
-
- @AfterEach
- void cleanup() throws IOException {
- client
- .newCall(
- new Request.Builder()
- .url(
- String.format(
- "http://localhost:%d/clear-requests", backend.getMappedPort(8080)))
- .build())
- .execute()
- .close();
- }
-
- void stopTarget() {
- target.stop();
- }
-
- @AfterAll
- static void cleanupSpec() {
- backend.stop();
- collector.stop();
- }
-
- protected static int countResourcesByValue(Collection traces, String resourceName, String value) {
- return (int) traces.stream()
- .flatMap(it -> it.getResourceSpansList().stream())
- .flatMap(it -> it.getResource().getAttributesList().stream())
- .filter(kv -> kv.getKey().equals(resourceName) && kv.getValue().getStringValue().equals(value))
- .count();
- }
-
- protected static int countSpansByName(
- Collection traces, String spanName) {
- return (int) getSpanStream(traces).filter(it -> it.getName().equals(spanName)).count();
- }
-
- protected static int countSpansByAttributeValue(
- Collection traces, String attributeName, String attributeValue) {
- return (int) getSpanStream(traces)
- .flatMap(it -> it.getAttributesList().stream())
- .filter(kv -> kv.getKey().equals(attributeName) && kv.getValue().getStringValue().equals(attributeValue))
- .count();
- }
-
- protected static Stream getSpanStream(Collection traces) {
- return traces.stream()
- .flatMap(it -> it.getResourceSpansList().stream())
- .flatMap(it -> it.getInstrumentationLibrarySpansList().stream())
- .flatMap(it -> it.getSpansList().stream());
- }
-
- protected Collection waitForTraces()
- throws IOException, InterruptedException {
- String content = waitForContent();
-
- return StreamSupport.stream(OBJECT_MAPPER.readTree(content).spliterator(), false)
- .map(
- it -> {
- ExportTraceServiceRequest.Builder builder = ExportTraceServiceRequest.newBuilder();
- // TODO(anuraaga): Register parser into object mapper to avoid de -> re ->
- // deserialize.
- try {
- JsonFormat.parser().merge(OBJECT_MAPPER.writeValueAsString(it), builder);
- } catch (InvalidProtocolBufferException | JsonProcessingException e) {
- e.printStackTrace();
- }
- return builder.build();
- })
- .collect(Collectors.toList());
- }
-
- private String waitForContent() throws IOException, InterruptedException {
- long previousSize = 0;
- long deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30);
- String content = "[]";
- while (System.currentTimeMillis() < deadline) {
-
- Request request =
- new Request.Builder()
- .url(String.format("http://localhost:%d/get-traces", backend.getMappedPort(8080)))
- .build();
-
- try (ResponseBody body = client.newCall(request).execute().body()) {
- content = body.string();
- }
-
- if (content.length() > 2 && content.length() == previousSize) {
- break;
- }
- previousSize = content.length();
- System.out.printf("Current content size %d%n", previousSize);
- TimeUnit.MILLISECONDS.sleep(500);
- }
-
- return content;
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java
deleted file mode 100644
index 813605add..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/java/com/example/javaagent/smoketest/SpringBootSmokeTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import io.opentelemetry.api.trace.TraceId;
-import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import okhttp3.Request;
-import okhttp3.Response;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-class SpringBootSmokeTest extends SmokeTest {
-
- protected String getTargetImage(int jdk) {
- return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk" + jdk
- + "-20210218.577304949";
- }
-
- @Test
- public void springBootSmokeTestOnJDK() throws IOException, InterruptedException {
- startTarget(11);
- String url = String.format("http://localhost:%d/greeting", target.getMappedPort(8080));
- Request request = new Request.Builder().url(url).get().build();
-
- String currentAgentVersion =
- (String) new JarFile(agentPath)
- .getManifest()
- .getMainAttributes()
- .get(Attributes.Name.IMPLEMENTATION_VERSION);
-
- Response response = client.newCall(request).execute();
- System.out.println(response.headers().toString());
-
- Collection traces = waitForTraces();
-
- Assertions.assertNotNull(response.header("X-server-id"));
- Assertions.assertEquals(1, response.headers("X-server-id").size());
- Assertions.assertTrue(TraceId.isValid(response.header("X-server-id")));
- Assertions.assertEquals("Hi!", response.body().string());
- Assertions.assertEquals(1, countSpansByName(traces, "/greeting"));
- Assertions.assertEquals(0, countSpansByName(traces, "WebController.greeting"));
- Assertions.assertEquals(1, countSpansByName(traces, "WebController.withSpan"));
- Assertions.assertEquals(2, countSpansByAttributeValue(traces, "custom", "demo"));
- Assertions.assertNotEquals(0,
- countResourcesByValue(traces, "telemetry.auto.version", currentAgentVersion));
- Assertions.assertNotEquals(0, countResourcesByValue(traces, "custom.resource", "demo"));
-
- stopTarget();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/logback.xml b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/logback.xml
deleted file mode 100644
index ab55cbd1c..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/logback.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
- %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/otel.yaml b/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/otel.yaml
deleted file mode 100644
index a25201f89..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/distro/smoke-tests/src/test/resources/otel.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-extensions:
- health_check:
- pprof:
- endpoint: 0.0.0.0:1777
- zpages:
- endpoint: 0.0.0.0:55679
-
-receivers:
- otlp:
- protocols:
- grpc:
- zipkin:
-
-processors:
- batch:
-
-exporters:
- logging:
- loglevel: debug
- otlp:
- endpoint: backend:8080
- insecure: true
-
-service:
- pipelines:
- traces:
- receivers: [otlp, zipkin]
- processors: [batch]
- exporters: [logging, otlp]
-
- extensions: [health_check, pprof, zpages]
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/README.md b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/README.md
deleted file mode 100644
index 259b01156..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-## Introduction
-
-This repository demonstrates how to create an extension archive to use with `otel.javaagent.experimental.extensions`
-configuration option of the OpenTelemetry Java instrumentation agent.
-
-For every extension point provided by OpenTelemetry Java instrumentation, this repository contains an example of
-its usage.
-
-Please carefully read both the source code and Gradle build script file `build.gradle`.
-They contain a lot of documentation and comments explaining the purpose of all major pieces.
-
-## How to use extension archive
-
-When you build this project by running `./gradlew build` you will get a jar file in
-`build/libs/opentelemetry-java-instrumentation-extension-demo-1.0-all.jar`.
-Copy this jar file to a machine running the application that you are monitoring with
-OpenTelemetry Java instrumentation agent.
-
-Assuming that your command line looks similar to this:
-```
-java -javaagent:path/to/opentelemetry-javaagent-all.jar \
- -jar myapp.jar
-```
-change it to this:
-```
-java -javaagent:path/to/opentelemetry-javaagent-all.jar \
- -Dotel.javaagent.experimental.extensions=path/to/extension.jar
- -jar myapp.jar
-```
-specifying the full path and the correct name of your extensions jar.
-
-## Extensions examples
-
-* [DemoIdGenerator](src/main/java/com/example/javaagent/DemoIdGenerator.java) - custom `IdGenerator`
-* [DemoPropagator](src/main/java/com/example/javaagent/DemoPropagator.java) - custom `TextMapPropagator`
-* [DemoPropertySource](src/main/java/com/example/javaagent/DemoPropertySource.java) - default configuration
-* [DemoSampler](src/main/java/com/example/javaagent/DemoSampler.java) - custom `Sampler`
-* [DemoSpanProcessor](src/main/java/com/example/javaagent/DemoSpanProcessor.java) - custom `SpanProcessor`
-* [DemoSpanExporter](src/main/java/com/example/javaagent/DemoSpanExporter.java) - custom `SpanExporter`
-* [DemoServlet3InstrumentationModule](src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java) - additional instrumentation
-
-## Instrumentation customisation
-
-There are several options to override or customise instrumentation provided by the upstream agent.
-The following description follows one specific use-case:
-
-> Instrumentation X from Otel distribution creates span that I don't like and I want to change it.
-
-As an example, let us take some database client instrumentation that creates a span for database call
-and extracts data from db connection to provide attributes for that span.
-
-### I don't want this span at all
-The easiest case. You can just pre-configure the agent in your extension and disable given instrumentation.
-
-### I want to add/modify some attributes and their values does NOT depend on a specific db connection instance.
-E.g. you want to add some data from call stack as span attribute.
-In this case just provide your custom `SpanProcessor`.
-No need for touching instrumentation itself.
-
-### I want to add/modify some attributes and their values depend on a specific db connection instance.
-Write a _new_ instrumentation which injects its own advice into the same method as the original one.
-Use `order` method to ensure it is run after the original instrumentation.
-Now you can augment current span with new information.
-
-See [DemoServlet3InstrumentationModule](src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java).
-
-### I want to remove some attributes
-Write custom exporter or use attribute filtering functionality in Collector.
-
-### I don't like Otel span at all. I want to significantly modify it and its lifecycle
-Disable existing instrumentation.
-Write a new one, which injects `Advice` into the same (or better) method as the original instrumentation.
-Write your own `Advice` for this.
-Use existing `Tracer` directly or extend it.
-As you have your own `Advice`, you can control which `Tracer` you use.
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/build.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/build.gradle
deleted file mode 100644
index 297d3a3dd..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/build.gradle
+++ /dev/null
@@ -1,132 +0,0 @@
-plugins {
- id "java"
-
- /*
- Instrumentation agent extension mechanism expects a single jar containing everything required
- for your extension. This also includes any external libraries that your extension uses and
- cannot access from application classpath (see comment below about `javax.servlet-api` dependency).
-
- Thus we use Shadow Gradle plugin to package our classes and all required runtime dependencies
- into a single jar.
- See https://imperceptiblethoughts.com/shadow/ for more details about Shadow plugin.
- */
- id "com.github.johnrengelman.shadow" version "6.1.0"
-}
-
-group 'io.opentelemetry.example'
-version '1.0'
-
-ext {
- versions = [
- opentelemetry : "1.2.0",
- opentelemetryAlpha : "1.2.0-alpha",
- opentelemetryJavaagent : "1.3.0-SNAPSHOT",
- opentelemetryJavaagentAlpha: "1.3.0-alpha-SNAPSHOT",
- ]
-
- deps = [
- autoservice: dependencies.create(group: 'com.google.auto.service', name: 'auto-service', version: '1.0')
- ]
-}opentelemetry
-
-repositories {
- mavenLocal()
- mavenCentral()
- maven {
- url = uri("https://oss.sonatype.org/content/repositories/snapshots")
- }
-}
-
-configurations {
- /*
- We create a separate gradle configuration to grab a published Otel instrumentation agent.
- We don't need the agent during development of this extension module.
- This agent is used only during integration test.
- */
- otel
-}
-
-dependencies {
- /*
- Interfaces and SPIs that we implement. We use `compileOnly` dependency because during
- runtime all necessary classes are provided by javaagent itself.
- */
- compileOnly("run.mone:opentelemetry-sdk-extension-autoconfigure:${versions.opentelemetryAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-api:${versions.opentelemetryJavaagentAlpha}")
- compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:${versions.opentelemetryJavaagentAlpha}")
-
- //Provides @AutoService annotation that makes registration of our SPI implementations much easier
- compileOnly deps.autoservice
- annotationProcessor deps.autoservice
-
- /*
- Used by our demo instrumentation module to reference classes of the target instrumented library.
- We again use `compileOnly` here because during runtime these classes are provided by the
- actual application that we instrument.
-
- NB! Only Advice (and "helper") classes of instrumentation modules can access classes from application classpath.
- See https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/writing-instrumentation-module.md#advice-classes
- */
- compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
-
- /*
- This dependency is required for DemoSpanProcessor both during compile and runtime.
- Only dependencies added to `implementation` configuration will be picked up by Shadow plugin
- and added to the resulting jar for our extension's distribution.
- */
- implementation 'org.apache.commons:commons-lang3:3.11'
-
- //All dependencies below are only for tests
- testImplementation("org.testcontainers:testcontainers:1.15.3")
- testImplementation("com.fasterxml.jackson.core:jackson-databind:2.11.2")
- testImplementation("com.google.protobuf:protobuf-java-util:3.12.4")
- testImplementation("com.squareup.okhttp3:okhttp:3.12.12")
- testImplementation("io.opentelemetry:opentelemetry-api:${versions.opentelemetry}")
- testImplementation("io.opentelemetry:opentelemetry-proto:${versions.opentelemetryAlpha}")
-
- testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
- testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
- testRuntimeOnly("ch.qos.logback:logback-classic:1.2.3")
-
- //Otel Java instrumentation that we use and extend during integration tests
- otel("io.opentelemetry.javaagent:opentelemetry-javaagent:${versions.opentelemetryJavaagent}:all")
-}
-
-//Extracts manifest from OpenTelemetry Java agent to reuse it later
-task agentManifest(type: Copy) {
- from zipTree(configurations.otel.singleFile).matching {
- include 'META-INF/MANIFEST.MF'
- }
- into buildDir
-}
-
-//Produces a copy of upstream javaagent with this extension jar included inside it
-//The location of extension directory inside agent jar is hard-coded in the agent source code
-task extendedAgent(type: Jar) {
- dependsOn agentManifest
- archiveFileName = "opentelemetry-javaagent-all.jar"
- manifest.from "$buildDir/META-INF/MANIFEST.MF"
- from zipTree(configurations.otel.singleFile)
- from(tasks.shadowJar.archiveFile) {
- into "extensions"
- }
-}
-
-tasks {
- test {
- useJUnitPlatform()
-
- inputs.files(layout.files(tasks.shadowJar))
- inputs.files(layout.files(tasks.extendedAgent))
-
- systemProperty 'io.opentelemetry.smoketest.agentPath', configurations.otel.singleFile.absolutePath
- systemProperty 'io.opentelemetry.smoketest.extendedAgentPath', tasks.extendedAgent.archiveFile.get().asFile.absolutePath
- systemProperty 'io.opentelemetry.smoketest.extensionPath', tasks.shadowJar.archiveFile.get().asFile.absolutePath
- }
-
- compileJava {
- options.release.set(11)
- }
-
- assemble.dependsOn(shadowJar)
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.jar
index 62d4c0535..912744eeb 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.properties b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index be52383ef..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew
deleted file mode 100755
index fbd7c5158..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew.bat b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew.bat
deleted file mode 100644
index 5093609d5..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/gradlew.bat
+++ /dev/null
@@ -1,104 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/settings.gradle b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/settings.gradle
deleted file mode 100644
index b56be86b6..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'opentelemetry-java-instrumentation-extension-demo'
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoIdGenerator.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoIdGenerator.java
deleted file mode 100644
index 1b8f3ab38..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoIdGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.sdk.trace.IdGenerator;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Custom {@link IdGenerator} which provides span and trace ids.
- *
- * @see io.opentelemetry.sdk.trace.SdkTracerProvider
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoIdGenerator implements IdGenerator {
- private static final AtomicLong traceId = new AtomicLong(0);
- private static final AtomicLong spanId = new AtomicLong(0);
-
- @Override
- public String generateSpanId() {
- return String.format("%016d", spanId.incrementAndGet());
- }
-
- @Override
- public String generateTraceId() {
- return String.format("%032d", traceId.incrementAndGet());
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagator.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagator.java
deleted file mode 100644
index 9cd1bc94e..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.context.Context;
-import io.opentelemetry.context.ContextKey;
-import io.opentelemetry.context.propagation.TextMapGetter;
-import io.opentelemetry.context.propagation.TextMapPropagator;
-import io.opentelemetry.context.propagation.TextMapSetter;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * See
- * OpenTelemetry Specification for more information about Propagators.
- *
- * @see DemoPropagatorProvider
- */
-public class DemoPropagator implements TextMapPropagator {
- private static final String FIELD = "X-demo-field";
- private static final ContextKey PROPAGATION_START_KEY = ContextKey.named("propagation.start");
-
- @Override
- public List fields() {
- return Collections.singletonList(FIELD);
- }
-
- @Override
- public void inject(Context context, C carrier, TextMapSetter setter) {
- Long propagationStart = context.get(PROPAGATION_START_KEY);
- if (propagationStart == null) {
- propagationStart = System.currentTimeMillis();
- }
- setter.set(carrier, FIELD, String.valueOf(propagationStart));
- }
-
- @Override
- public Context extract(Context context, C carrier, TextMapGetter getter) {
- String propagationStart = getter.get(carrier, FIELD);
- if (propagationStart != null) {
- return context.with(PROPAGATION_START_KEY, Long.valueOf(propagationStart));
- } else {
- return context;
- }
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagatorProvider.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagatorProvider.java
deleted file mode 100644
index 3f3438c97..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropagatorProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.example.javaagent;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.context.propagation.TextMapPropagator;
-import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider;
-
-/**
- * Registers the custom propagator used by this example.
- *
- * @see ConfigurablePropagatorProvider
- * @see DemoPropagator
- */
-@AutoService(ConfigurablePropagatorProvider.class)
-public class DemoPropagatorProvider implements ConfigurablePropagatorProvider {
- @Override
- public TextMapPropagator getPropagator() {
- return new DemoPropagator();
- }
-
- @Override
- public String getName() {
- return "demo";
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropertySource.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropertySource.java
deleted file mode 100644
index 0c0f24a5d..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoPropertySource.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.example.javaagent;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.javaagent.spi.config.PropertySource;
-import java.util.Map;
-
-/**
- * {@link PropertySource} is an SPI provided by OpenTelemetry Java instrumentation agent.
- * By implementing it custom distributions can supply their own default configuration.
- * The configuration priority, from highest to lowest is:
- * system properties -> environment variables -> configuration file -> PropertySource SPI -> hard-coded defaults
- */
-@AutoService(PropertySource.class)
-public class DemoPropertySource implements PropertySource {
-
- @Override
- public Map getProperties() {
- return Map.of(
- "otel.exporter.otlp.endpoint", "http://collector:55680",
- "otel.exporter.otlp.insecure", "true",
- "otel.config.max.attrs", "16"
- );
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoResourceProvider.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoResourceProvider.java
deleted file mode 100644
index cad1ba098..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoResourceProvider.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.example.javaagent;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.sdk.autoconfigure.ConfigProperties;
-import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
-import io.opentelemetry.sdk.resources.Resource;
-
-@AutoService(ResourceProvider.class)
-public class DemoResourceProvider implements ResourceProvider {
- @Override
- public Resource createResource(ConfigProperties config) {
- Attributes attributes = Attributes.builder().put("custom.resource", "demo").build();
- return Resource.create(attributes);
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSampler.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSampler.java
deleted file mode 100644
index 67bcade15..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSampler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.api.common.Attributes;
-import io.opentelemetry.api.trace.SpanKind;
-import io.opentelemetry.context.Context;
-import io.opentelemetry.sdk.trace.data.LinkData;
-import io.opentelemetry.sdk.trace.samplers.Sampler;
-import io.opentelemetry.sdk.trace.samplers.SamplingDecision;
-import io.opentelemetry.sdk.trace.samplers.SamplingResult;
-import java.util.List;
-
-/**
- * This demo sampler filters out all internal spans whose name contains string "greeting".
- *
- * See
- * OpenTelemetry Specification for more information about span sampling.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSampler implements Sampler {
- @Override
- public SamplingResult shouldSample(Context parentContext, String traceId, String name,
- SpanKind spanKind, Attributes attributes, List parentLinks) {
- if (spanKind == SpanKind.INTERNAL && name.contains("greeting")) {
- return SamplingResult.create(SamplingDecision.DROP);
- } else {
- return SamplingResult.create(SamplingDecision.RECORD_AND_SAMPLE);
- }
- }
-
- @Override
- public String getDescription() {
- return "DemoSampler";
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
deleted file mode 100644
index 8ad8ab828..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSdkTracerProviderConfigurer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.example.javaagent;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.sdk.autoconfigure.spi.SdkTracerProviderConfigurer;
-import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder;
-import io.opentelemetry.sdk.trace.SpanLimits;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-
-/**
- * This is one of the main entry points for Instrumentation Agent's customizations.
- * It allows configuring {@link SdkTracerProviderBuilder}.
- * See the {@link #configure(SdkTracerProviderBuilder)} method below.
- *
- * Also see https://github.com/open-telemetry/opentelemetry-java/issues/2022
- *
- * @see SdkTracerProviderConfigurer
- * @see DemoPropagatorProvider
- */
-@AutoService(SdkTracerProviderConfigurer.class)
-public class DemoSdkTracerProviderConfigurer implements SdkTracerProviderConfigurer {
- @Override
- public void configure(SdkTracerProviderBuilder tracerProvider) {
- tracerProvider
- .setIdGenerator(new DemoIdGenerator())
- .setSpanLimits(SpanLimits.builder().setMaxNumberOfAttributes(1024).build())
- .setSampler(new DemoSampler())
- .addSpanProcessor(new DemoSpanProcessor())
- .addSpanProcessor(SimpleSpanProcessor.create(new DemoSpanExporter()));
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanExporter.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanExporter.java
deleted file mode 100644
index 476093a76..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanExporter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.sdk.common.CompletableResultCode;
-import io.opentelemetry.sdk.trace.data.SpanData;
-import io.opentelemetry.sdk.trace.export.SpanExporter;
-import java.util.Collection;
-
-/**
- * See
- * OpenTelemetry Specification for more information about {@link SpanExporter}.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSpanExporter implements SpanExporter {
- @Override
- public CompletableResultCode export(Collection spans) {
- System.out.printf("%d spans exported%n", spans.size());
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode flush() {
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode shutdown() {
- return CompletableResultCode.ofSuccess();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanProcessor.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanProcessor.java
deleted file mode 100644
index 32aa2f319..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/DemoSpanProcessor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.example.javaagent;
-
-import io.opentelemetry.context.Context;
-import io.opentelemetry.sdk.common.CompletableResultCode;
-import io.opentelemetry.sdk.trace.ReadWriteSpan;
-import io.opentelemetry.sdk.trace.ReadableSpan;
-import io.opentelemetry.sdk.trace.SpanProcessor;
-import org.apache.commons.lang3.RandomStringUtils;
-
-/**
- * See
- * OpenTelemetry Specification for more information about {@link SpanProcessor}.
- *
- * @see DemoSdkTracerProviderConfigurer
- */
-public class DemoSpanProcessor implements SpanProcessor {
-
- @Override
- public void onStart(Context parentContext, ReadWriteSpan span) {
- /*
- The sole purpose of this attribute is to introduce runtime dependency on some external library.
- We need this to demonstrate how extension can use them.
- */
- span.setAttribute("random", RandomStringUtils.random(10));
- span.setAttribute("custom", "demo");
- }
-
- @Override
- public boolean isStartRequired() {
- return true;
- }
-
- @Override
- public void onEnd(ReadableSpan span) {
-
- }
-
- @Override
- public boolean isEndRequired() {
- return false;
- }
-
- @Override
- public CompletableResultCode shutdown() {
- return CompletableResultCode.ofSuccess();
- }
-
- @Override
- public CompletableResultCode forceFlush() {
- return CompletableResultCode.ofSuccess();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java
deleted file mode 100644
index 7238f4c0e..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3Instrumentation.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.example.javaagent.instrumentation;
-
-import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
-
-import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
-import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
-import io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers;
-import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
-import net.bytebuddy.asm.Advice;
-import net.bytebuddy.description.type.TypeDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-import net.bytebuddy.matcher.ElementMatchers;
-
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-
-public class DemoServlet3Instrumentation implements TypeInstrumentation {
- @Override
- public ElementMatcher typeMatcher() {
- return AgentElementMatchers.safeHasSuperType(
- namedOneOf("javax.servlet.Filter", "javax.servlet.http.HttpServlet"));
- }
-
- @Override
- public void transform(TypeTransformer typeTransformer) {
- typeTransformer.applyAdviceToMethod(
- namedOneOf("doFilter", "service")
- .and(
- ElementMatchers.takesArgument(
- 0, ElementMatchers.named("javax.servlet.ServletRequest")))
- .and(
- ElementMatchers.takesArgument(
- 1, ElementMatchers.named("javax.servlet.ServletResponse")))
- .and(ElementMatchers.isPublic()),
- this.getClass().getName() + "$DemoServlet3Advice");
- }
-
- @SuppressWarnings("unused")
- public static class DemoServlet3Advice {
-
- @Advice.OnMethodEnter(suppress = Throwable.class)
- public static void onEnter(@Advice.Argument(value = 1) ServletResponse response) {
- if (!(response instanceof HttpServletResponse)) {
- return;
- }
-
- HttpServletResponse httpServletResponse = (HttpServletResponse) response;
- if (!httpServletResponse.containsHeader("X-server-id")) {
- httpServletResponse.setHeader(
- "X-server-id", Java8BytecodeBridge.currentSpan().getSpanContext().getTraceId());
- }
- }
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java
deleted file mode 100644
index 65ec43e4a..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.example.javaagent.instrumentation;
-
-import static java.util.Collections.singletonList;
-
-import com.google.auto.service.AutoService;
-import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
-import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
-import io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher;
-import java.util.List;
-import net.bytebuddy.matcher.ElementMatcher;
-
-/**
- * This is a demo instrumentation which hooks into servlet invocation and modifies the http
- * response.
- */
-@AutoService(InstrumentationModule.class)
-public final class DemoServlet3InstrumentationModule extends InstrumentationModule {
- public DemoServlet3InstrumentationModule() {
- super("servlet-demo", "servlet-3");
- }
-
- /*
- We want this instrumentation to be applied after the standard servlet instrumentation.
- The latter creates a server span around http request.
- This instrumentation needs access to that server span.
- */
- @Override
- public int order() {
- return 1;
- }
-
- @Override
- public ElementMatcher.Junction classLoaderMatcher() {
- return ClassLoaderMatcher.hasClassesNamed("javax.servlet.http.HttpServlet");
- }
-
- @Override
- public List typeInstrumentations() {
- return singletonList(new DemoServlet3Instrumentation());
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/IntegrationTest.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/IntegrationTest.java
deleted file mode 100644
index 5b5ac1763..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/IntegrationTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.util.JsonFormat;
-import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
-import io.opentelemetry.proto.trace.v1.Span;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.ResponseBody;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeAll;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.Network;
-import org.testcontainers.containers.output.Slf4jLogConsumer;
-import org.testcontainers.containers.wait.strategy.Wait;
-import org.testcontainers.utility.MountableFile;
-
-abstract class IntegrationTest {
- private static final Logger logger = LoggerFactory.getLogger(IntegrationTest.class);
-
- private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
- protected static OkHttpClient client = OkHttpUtils.client();
-
- private static final Network network = Network.newNetwork();
- protected static final String agentPath =
- System.getProperty("io.opentelemetry.smoketest.agentPath");
- //Javaagent with extensions embedded inside it
- protected static final String extendedAgentPath =
- System.getProperty("io.opentelemetry.smoketest.extendedAgentPath");
- protected static final String extensionPath =
- System.getProperty("io.opentelemetry.smoketest.extensionPath");
-
- protected abstract String getTargetImage(int jdk);
-
- /**
- * Subclasses can override this method to customise target application's environment
- */
- protected Map getExtraEnv() {
- return Collections.emptyMap();
- }
-
- private static GenericContainer backend;
- private static GenericContainer collector;
-
- @BeforeAll
- static void setupSpec() {
- backend =
- new GenericContainer<>(
- "ghcr.io/open-telemetry/java-test-containers:smoke-fake-backend-20210324.684269693")
- .withExposedPorts(8080)
- .waitingFor(Wait.forHttp("/health").forPort(8080))
- .withNetwork(network)
- .withNetworkAliases("backend")
- .withLogConsumer(new Slf4jLogConsumer(logger));
- backend.start();
-
- collector =
- new GenericContainer<>("otel/opentelemetry-collector-dev:latest")
- .dependsOn(backend)
- .withNetwork(network)
- .withNetworkAliases("collector")
- .withLogConsumer(new Slf4jLogConsumer(logger))
- .withCopyFileToContainer(
- MountableFile.forClasspathResource("/otel.yaml"), "/etc/otel.yaml")
- .withCommand("--config /etc/otel.yaml");
- collector.start();
- }
-
- protected GenericContainer> target;
-
- void startTarget(String extensionLocation) {
- target = buildTargetContainer(agentPath, extensionLocation);
- target.start();
- }
-
- void startTargetWithExtendedAgent() {
- target = buildTargetContainer(extendedAgentPath, null);
- target.start();
- }
-
- private GenericContainer> buildTargetContainer(String agentPath, String extensionLocation) {
- GenericContainer> result =
- new GenericContainer<>(getTargetImage(11))
- .withExposedPorts(8080)
- .withNetwork(network)
- .withLogConsumer(new Slf4jLogConsumer(logger))
- .withCopyFileToContainer(
- MountableFile.forHostPath(agentPath), "/opentelemetry-javaagent.jar")
- //Adds instrumentation agent with debug configuration to the target application
- .withEnv("JAVA_TOOL_OPTIONS",
- "-javaagent:/opentelemetry-javaagent.jar -Dotel.javaagent.debug=true")
- .withEnv("OTEL_BSP_MAX_EXPORT_BATCH", "1")
- .withEnv("OTEL_BSP_SCHEDULE_DELAY", "10")
- .withEnv("OTEL_PROPAGATORS", "tracecontext,baggage,demo")
- .withEnv(getExtraEnv());
- //If external extensions are requested
- if (extensionLocation != null) {
- //Asks instrumentation agent to include extensions from given location into its runtime
- result = result.withCopyFileToContainer(
- MountableFile.forHostPath(extensionPath), "/opentelemetry-extensions.jar")
- .withEnv("OTEL_JAVAAGENT_EXPERIMENTAL_EXTENSIONS", extensionLocation);
- }
- return result;
- }
-
- @AfterEach
- void cleanup() throws IOException {
- client
- .newCall(
- new Request.Builder()
- .url(
- String.format(
- "http://localhost:%d/clear", backend.getMappedPort(8080)))
- .build())
- .execute()
- .close();
- }
-
- void stopTarget() {
- target.stop();
- }
-
- @AfterAll
- static void cleanupSpec() {
- backend.stop();
- collector.stop();
- }
-
- protected static int countResourcesByValue(Collection traces,
- String resourceName, String value) {
- return (int) traces.stream()
- .flatMap(it -> it.getResourceSpansList().stream())
- .flatMap(it -> it.getResource().getAttributesList().stream())
- .filter(
- kv -> kv.getKey().equals(resourceName) && kv.getValue().getStringValue().equals(value))
- .count();
- }
-
- protected static int countSpansByName(
- Collection traces, String spanName) {
- return (int) getSpanStream(traces).filter(it -> it.getName().equals(spanName)).count();
- }
-
- protected static int countSpansByAttributeValue(
- Collection traces, String attributeName, String attributeValue) {
- return (int) getSpanStream(traces)
- .flatMap(it -> it.getAttributesList().stream())
- .filter(kv -> kv.getKey().equals(attributeName) && kv.getValue().getStringValue()
- .equals(attributeValue))
- .count();
- }
-
- protected static Stream getSpanStream(Collection traces) {
- return traces.stream()
- .flatMap(it -> it.getResourceSpansList().stream())
- .flatMap(it -> it.getInstrumentationLibrarySpansList().stream())
- .flatMap(it -> it.getSpansList().stream());
- }
-
- protected Collection waitForTraces()
- throws IOException, InterruptedException {
- String content = waitForContent();
-
- return StreamSupport.stream(OBJECT_MAPPER.readTree(content).spliterator(), false)
- .map(
- it -> {
- ExportTraceServiceRequest.Builder builder = ExportTraceServiceRequest.newBuilder();
- try {
- JsonFormat.parser().merge(OBJECT_MAPPER.writeValueAsString(it), builder);
- } catch (InvalidProtocolBufferException | JsonProcessingException e) {
- e.printStackTrace();
- }
- return builder.build();
- })
- .collect(Collectors.toList());
- }
-
- private String waitForContent() throws IOException, InterruptedException {
- long previousSize = 0;
- long deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30);
- String content = "[]";
- while (System.currentTimeMillis() < deadline) {
-
- Request request =
- new Request.Builder()
- .url(String.format("http://localhost:%d/get-traces", backend.getMappedPort(8080)))
- .build();
-
- try (ResponseBody body = client.newCall(request).execute().body()) {
- content = body.string();
- }
-
- if (content.length() > 2 && content.length() == previousSize) {
- break;
- }
- previousSize = content.length();
- System.out.printf("Current content size %d%n", previousSize);
- TimeUnit.MILLISECONDS.sleep(500);
- }
-
- return content;
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java
deleted file mode 100644
index b8956aa29..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/OkHttpUtils.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import java.util.concurrent.TimeUnit;
-import okhttp3.OkHttpClient;
-
-public class OkHttpUtils {
-
- static OkHttpClient.Builder clientBuilder() {
- TimeUnit unit = TimeUnit.MINUTES;
- return new OkHttpClient.Builder()
- .connectTimeout(1, unit)
- .writeTimeout(1, unit)
- .readTimeout(1, unit);
- }
-
- public static OkHttpClient client() {
- return client(false);
- }
-
- public static OkHttpClient client(boolean followRedirects) {
- return clientBuilder().followRedirects(followRedirects).build();
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java
deleted file mode 100644
index 078454846..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/java/com/example/javaagent/smoketest/SpringBootIntegrationTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.example.javaagent.smoketest;
-
-import io.opentelemetry.api.trace.TraceId;
-import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import okhttp3.Request;
-import okhttp3.Response;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-class SpringBootIntegrationTest extends IntegrationTest {
-
- protected String getTargetImage(int jdk) {
- return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk" + jdk
- + "-20210218.577304949";
- }
-
- @Test
- public void extensionsAreLoadedFromJar() throws IOException, InterruptedException {
- startTarget("/opentelemetry-extensions.jar");
-
- testAndVerify();
-
- stopTarget();
- }
-
- @Test
- public void extensionsAreLoadedFromFolder() throws IOException, InterruptedException {
- startTarget("/");
-
- testAndVerify();
-
- stopTarget();
- }
-
- @Test
- public void extensionsAreLoadedFromJavaagent() throws IOException, InterruptedException {
- startTargetWithExtendedAgent();
-
- testAndVerify();
-
- stopTarget();
- }
-
- private void testAndVerify() throws IOException, InterruptedException {
- String url = String.format("http://localhost:%d/greeting", target.getMappedPort(8080));
- Request request = new Request.Builder().url(url).get().build();
-
- String currentAgentVersion =
- (String) new JarFile(agentPath)
- .getManifest()
- .getMainAttributes()
- .get(Attributes.Name.IMPLEMENTATION_VERSION);
-
- Response response = client.newCall(request).execute();
-
- Collection traces = waitForTraces();
-
- Assertions.assertNotNull(response.header("X-server-id"));
- Assertions.assertEquals(1, response.headers("X-server-id").size());
- Assertions.assertTrue(TraceId.isValid(response.header("X-server-id")));
- Assertions.assertEquals("Hi!", response.body().string());
- Assertions.assertEquals(1, countSpansByName(traces, "/greeting"));
- Assertions.assertEquals(0, countSpansByName(traces, "WebController.greeting"));
- Assertions.assertEquals(1, countSpansByName(traces, "WebController.withSpan"));
- Assertions.assertEquals(2, countSpansByAttributeValue(traces, "custom", "demo"));
- Assertions.assertNotEquals(0,
- countResourcesByValue(traces, "telemetry.auto.version", currentAgentVersion));
- Assertions.assertNotEquals(0, countResourcesByValue(traces, "custom.resource", "demo"));
- }
-}
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/logback.xml b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/logback.xml
deleted file mode 100644
index 3fefcd72b..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/logback.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
- %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/otel.yaml b/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/otel.yaml
deleted file mode 100644
index a25201f89..000000000
--- a/ozhera-all/opentelemetry-java-instrumentation/examples/extension/src/test/resources/otel.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-extensions:
- health_check:
- pprof:
- endpoint: 0.0.0.0:1777
- zpages:
- endpoint: 0.0.0.0:55679
-
-receivers:
- otlp:
- protocols:
- grpc:
- zipkin:
-
-processors:
- batch:
-
-exporters:
- logging:
- loglevel: debug
- otlp:
- endpoint: backend:8080
- insecure: true
-
-service:
- pipelines:
- traces:
- receivers: [otlp, zipkin]
- processors: [batch]
- exporters: [logging, otlp]
-
- extensions: [health_check, pprof, zpages]
diff --git a/ozhera-all/opentelemetry-java-instrumentation/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/gradle/wrapper/gradle-wrapper.jar
index e708b1c02..c9d55ea1c 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/fake-backend/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/fake-backend/gradle/wrapper/gradle-wrapper.jar
index e708b1c02..c9d55ea1c 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/fake-backend/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/fake-backend/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/grpc/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/grpc/gradle/wrapper/gradle-wrapper.jar
index e708b1c02..c9d55ea1c 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/grpc/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/grpc/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/matrix/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/matrix/gradle/wrapper/gradle-wrapper.jar
index 62d4c0535..912744eeb 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/matrix/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/matrix/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/play/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/play/gradle/wrapper/gradle-wrapper.jar
index 62d4c0535..912744eeb 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/play/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/play/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/springboot/gradle/wrapper/gradle-wrapper.jar b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/springboot/gradle/wrapper/gradle-wrapper.jar
index 62d4c0535..912744eeb 100644
Binary files a/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/springboot/gradle/wrapper/gradle-wrapper.jar and b/ozhera-all/opentelemetry-java-instrumentation/smoke-tests/springboot/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ozhera-all/ozhera-prometheus-agent/README.md b/ozhera-all/ozhera-prometheus-agent/README.md
index 4bba659eb..e2b24c383 100644
--- a/ozhera-all/ozhera-prometheus-agent/README.md
+++ b/ozhera-all/ozhera-prometheus-agent/README.md
@@ -1 +1,2 @@
-# Overview
\ No newline at end of file
+# Overview
+## ozhera-prometheus-agent
diff --git a/ozhera-all/ozhera-prometheus-agent/ozhera-prometheus-agent-service/src/test/java/com/xiaomi/youpin/prometheus/agent/test/feishuCartTest.java b/ozhera-all/ozhera-prometheus-agent/ozhera-prometheus-agent-service/src/test/java/com/xiaomi/youpin/prometheus/agent/test/feishuCartTest.java
index 1ac646ae3..61c293191 100644
--- a/ozhera-all/ozhera-prometheus-agent/ozhera-prometheus-agent-service/src/test/java/com/xiaomi/youpin/prometheus/agent/test/feishuCartTest.java
+++ b/ozhera-all/ozhera-prometheus-agent/ozhera-prometheus-agent-service/src/test/java/com/xiaomi/youpin/prometheus/agent/test/feishuCartTest.java
@@ -190,8 +190,8 @@ public void testFeishuInterfaceAlertCard() {
try {
String content = FreeMarkerUtil.getContent("/feishu", "feishuInterfalCart.ftl", map);
System.out.println(content);
- FeiShu feiShu = new FeiShu("cli_9ef18a2d8c74500e", "58eASBLGw9IqBFyds5m93m4GmTDYBMMt");
- feiShu.sendCardByEmail("zhangxiaowei6@xiaomi.com", content);
+ FeiShu feiShu = new FeiShu("xxx", "xxx");
+ feiShu.sendCardByEmail("xxx", content);
} catch (Exception e) {
}