Skip to content

Commit

Permalink
Update distro and extension examples to 1.3.0 (#3355)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek authored Jun 18, 2021
1 parent 57fef6a commit 0125a17
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions examples/distro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ subprojects {

ext {
versions = [
opentelemetry : "1.2.0",
opentelemetryJavaagent: "1.2.0",
opentelemetry : "1.3.0",
opentelemetryJavaagent: "1.3.0",
bytebuddy : "1.10.18",
guava : "30.1-jre"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
package com.example.javaagent.instrumentation;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;

import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
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<TypeDescription> 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")
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(namedOneOf("doFilter", "service")
.and(takesArgument(0, named("javax.servlet.ServletRequest")))
.and(takesArgument(1, named("javax.servlet.ServletResponse")))
.and(isPublic()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
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;
Expand Down
9 changes: 4 additions & 5 deletions examples/extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ 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",
opentelemetry : "1.3.0",
opentelemetryAlpha : "1.3.0-alpha",
opentelemetryJavaagent : "1.3.0",
opentelemetryJavaagentAlpha: "1.3.0-alpha",
]

deps = [
Expand All @@ -30,7 +30,6 @@ ext {
}

repositories {
mavenLocal()
mavenCentral()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
Expand Down

0 comments on commit 0125a17

Please sign in to comment.