-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrong dubbo trace caused by using rpcContext.isProviderSide()
- Loading branch information
Showing
9 changed files
with
99 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...o/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/OpenTelemetryServerFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.apachedubbo.v2_7; | ||
|
||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import io.opentelemetry.instrumentation.apachedubbo.v2_7.DubboTelemetry; | ||
import io.opentelemetry.instrumentation.apachedubbo.v2_7.internal.DubboClientNetworkAttributesGetter; | ||
import io.opentelemetry.instrumentation.api.incubator.semconv.net.PeerServiceAttributesExtractor; | ||
import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig; | ||
import org.apache.dubbo.common.extension.Activate; | ||
import org.apache.dubbo.rpc.Filter; | ||
import org.apache.dubbo.rpc.Invocation; | ||
import org.apache.dubbo.rpc.Invoker; | ||
import org.apache.dubbo.rpc.Result; | ||
|
||
@Activate(group = {"provider"}) | ||
public class OpenTelemetryServerFilter implements Filter { | ||
|
||
private final Filter delegate; | ||
|
||
public OpenTelemetryServerFilter() { | ||
delegate = | ||
DubboTelemetry.builder(GlobalOpenTelemetry.get()) | ||
.addAttributesExtractor( | ||
PeerServiceAttributesExtractor.create( | ||
new DubboClientNetworkAttributesGetter(), | ||
AgentCommonConfig.get().getPeerServiceResolver())) | ||
.build() | ||
.newServerFilter(); | ||
} | ||
|
||
@Override | ||
public Result invoke(Invoker<?> invoker, Invocation invocation) { | ||
return delegate.invoke(invoker, invocation); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...bo-2.7/javaagent/src/main/resources/apache-dubbo-2.7/META-INF/org.apache.dubbo.rpc.Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
io.opentelemetry.javaagent.instrumentation.apachedubbo.v2_7.OpenTelemetryFilter | ||
io.opentelemetry.javaagent.instrumentation.apachedubbo.v2_7.OpenTelemetryClientFilter | ||
io.opentelemetry.javaagent.instrumentation.apachedubbo.v2_7.OpenTelemetryServerFilter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ain/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/OpenTelemetryServerFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.apachedubbo.v2_7; | ||
|
||
import io.opentelemetry.api.GlobalOpenTelemetry; | ||
import org.apache.dubbo.common.extension.Activate; | ||
import org.apache.dubbo.rpc.Filter; | ||
import org.apache.dubbo.rpc.Invocation; | ||
import org.apache.dubbo.rpc.Invoker; | ||
import org.apache.dubbo.rpc.Result; | ||
|
||
@Activate(group = {"provider"}) | ||
public final class OpenTelemetryServerFilter implements Filter { | ||
|
||
private final Filter delegate; | ||
|
||
public OpenTelemetryServerFilter() { | ||
delegate = DubboTelemetry.create(GlobalOpenTelemetry.get()).newServerFilter(); | ||
} | ||
|
||
@Override | ||
public Result invoke(Invoker<?> invoker, Invocation invocation) { | ||
return delegate.invoke(invoker, invocation); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
....7/library-autoconfigure/src/main/resources/META-INF/services/org.apache.dubbo.rpc.Filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
io.opentelemetry.instrumentation.apachedubbo.v2_7.OpenTelemetryFilter | ||
io.opentelemetry.instrumentation.apachedubbo.v2_7.OpenTelemetryClientFilter | ||
io.opentelemetry.instrumentation.apachedubbo.v2_7.OpenTelemetryServerFilter |