Skip to content

Commit

Permalink
Revert "Merge pull request newrelic#538 from newrelic/spring-security"
Browse files Browse the repository at this point in the history
This reverts commit 7980165, reversing
changes made to 1f4607e.

See newrelic#725.
  • Loading branch information
Stephan202 committed Nov 17, 2022
1 parent 3c1fb45 commit 62b772a
Show file tree
Hide file tree
Showing 19 changed files with 7 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TokenLinkingSubscriber<T> implements CoreSubscriber<T> {
public TokenLinkingSubscriber(Subscriber<? super T> subscriber, Context ctx) {
this.subscriber = subscriber;
this.context = ctx;
// newrelic-token is added by spring-webflux-5.1 instrumentation of ServerWebExchange
// newrelic-token is added by spring-webflux-5.1 instrumentation
this.token = ctx.getOrDefault("newrelic-token", null);
}

Expand Down
36 changes: 0 additions & 36 deletions instrumentation/netty-reactor-0.8.0/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
import java.util.function.BiFunction;
import java.util.function.Function;

/**
* Implementation of a reactor.core.CoreSubscriber (a Context aware subscriber) that can be added as
* a lifecycle hook on Flux/Mono operators to propagate, retrieve, and link Tokens across async contexts.
*
* Based on OpenTelemetry code:
* https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/reactor-3.1/library/src/main/java/io/opentelemetry/instrumentation/reactor/TracingSubscriber.java
* @param <T>
*/
// Based on OpenTelemetry code
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/reactor-3.1/library/src/main/java/io/opentelemetry/instrumentation/reactor/TracingSubscriber.java
public class TokenLinkingSubscriber<T> implements CoreSubscriber<T> {
private final Token token;
private final Subscriber<? super T> subscriber;
Expand All @@ -33,7 +27,7 @@ public class TokenLinkingSubscriber<T> implements CoreSubscriber<T> {
public TokenLinkingSubscriber(Subscriber<? super T> subscriber, Context ctx) {
this.subscriber = subscriber;
this.context = ctx;
// newrelic-token is added by spring-webflux instrumentation of ServerWebExchange
// newrelic-token is added by spring-webflux instrumentation
this.token = ctx.getOrDefault("newrelic-token", null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

@Weave(originalName = "reactor.core.publisher.Hooks")
public abstract class Hooks_Instrumentation {

/*
* Note that sub-hooks are cumulative. We want to avoid setting the same sub-hooks
* more than once, so we set this boolean to true the first time we set a sub-hook.
* if (!Hooks_Instrumentation.instrumented.getAndSet(true)) { Hooks.onEachOperator(...) }
*/
@NewField
public static AtomicBoolean instrumented = new AtomicBoolean(false);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.InstantPeriodicWorkerTask")
final class InstantPeriodicWorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.PeriodicWorkerTask")
final class PeriodicWorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
final class SchedulerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler via Mono::publishOn
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.WorkerTask")
final class WorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
@Weave(originalName = "reactor.netty.http.server.HttpTrafficHandler")
class HttpTrafficHandler_Instrumentation {
public void channelRead(ChannelHandlerContext ctx, Object msg) {

/*
* Add tokenLift hook if it hasn't already been added. This allows for tokens to be retrieved from
* the current context and linked across threads at various points of the Flux/Mono lifecycle.
*
* This hook will only be added when using Netty Reactor with SpringBoot. When using other embedded web
* servers (e.g. Tomcat, Jetty, Undertow) the Schedulers_Instrumentation class will add the hook.
*/
if (!Hooks_Instrumentation.instrumented.getAndSet(true)) {
Hooks.onEachOperator(TokenLinkingSubscriber.class.getName(), tokenLift());
}
Expand Down
36 changes: 0 additions & 36 deletions instrumentation/netty-reactor-0.9.0/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
import java.util.function.BiFunction;
import java.util.function.Function;

/**
* Implementation of a reactor.core.CoreSubscriber (a Context aware subscriber) that can be added as
* a lifecycle hook on Flux/Mono operators to propagate, retrieve, and link Tokens across async contexts.
*
* Based on OpenTelemetry code:
* https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/reactor-3.1/library/src/main/java/io/opentelemetry/instrumentation/reactor/TracingSubscriber.java
* @param <T>
*/
// Based on OpenTelemetry code
// https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/reactor-3.1/library/src/main/java/io/opentelemetry/instrumentation/reactor/TracingSubscriber.java
public class TokenLinkingSubscriber<T> implements CoreSubscriber<T> {
private final Token token;
private final Subscriber<? super T> subscriber;
Expand All @@ -33,7 +27,7 @@ public class TokenLinkingSubscriber<T> implements CoreSubscriber<T> {
public TokenLinkingSubscriber(Subscriber<? super T> subscriber, Context ctx) {
this.subscriber = subscriber;
this.context = ctx;
// newrelic-token is added by spring-webflux instrumentation of ServerWebExchange
// newrelic-token is added by spring-webflux instrumentation
this.token = ctx.getOrDefault("newrelic-token", null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

@Weave(originalName = "reactor.core.publisher.Hooks")
public abstract class Hooks_Instrumentation {

/*
* Note that sub-hooks are cumulative. We want to avoid setting the same sub-hooks
* more than once, so we set this boolean to true the first time we set a sub-hook.
* if (!Hooks_Instrumentation.instrumented.getAndSet(true)) { Hooks.onEachOperator(...) }
*/
@NewField
public static AtomicBoolean instrumented = new AtomicBoolean(false);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.InstantPeriodicWorkerTask")
final class InstantPeriodicWorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.PeriodicWorkerTask")
final class PeriodicWorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
final class SchedulerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler via Mono::publishOn
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
@Weave(originalName = "reactor.core.scheduler.WorkerTask")
final class WorkerTask_Instrumentation {

// We need to be able to link the Token here when executing on a supplied Scheduler
// A Token should be available on the thread that this task executes on if tokenLift() was added to Hooks.onEachOperator
@Trace(async = true, excludeFromTransactionTrace = true)
public Void call() {
return Weaver.callOriginal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
@Weave(originalName = "reactor.netty.http.server.HttpTrafficHandler")
class HttpTrafficHandler_Instrumentation {
public void channelRead(ChannelHandlerContext ctx, Object msg) {

/*
* Add tokenLift hook if it hasn't already been added. This allows for tokens to be retrieved from
* the current context and linked across threads at various points of the Flux/Mono lifecycle.
*
* This hook will only be added when using Netty Reactor with SpringBoot. When using other embedded web
* servers (e.g. Tomcat, Jetty, Undertow) the Schedulers_Instrumentation class will add the hook.
*/
if (!Hooks_Instrumentation.instrumented.getAndSet(true)) {
Hooks.onEachOperator(TokenLinkingSubscriber.class.getName(), tokenLift());
}
Expand Down

0 comments on commit 62b772a

Please sign in to comment.