-
Notifications
You must be signed in to change notification settings - Fork 972
Fix wrong dubbo trace caused by using rpcContext.isProviderSide() #12930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
37808d7
Fix wrong dubbo trace caused by using rpcContext.isProviderSide()
steverao 92583fc
Address comment problems
steverao f5fafc0
Keep old api and mark it as deprecated
steverao 93f2ffb
Optimize codes
steverao 96ac186
Merge branch 'main' into dubbo
laurit 4607f4a
Rework dubbo insrumentation (#7)
laurit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 { | ||
steverao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private final Filter delegate; | ||
|
||
public OpenTelemetryServerFilter() { | ||
steverao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.