Skip to content

fix: no data receive from grpc#103

Closed
LinuxSuRen wants to merge 1 commit into
apache:mainfrom
LinuxSuRen:fix/grpc-invoke
Closed

fix: no data receive from grpc#103
LinuxSuRen wants to merge 1 commit into
apache:mainfrom
LinuxSuRen:fix/grpc-invoke

Conversation

@LinuxSuRen

@LinuxSuRen LinuxSuRen commented Sep 22, 2023

Copy link
Copy Markdown
Contributor

What happend

I cannot see the gRPC related data from SkyWaling native UI.

Test

See the following screenshots with the changes:

image

I read part code lines of this project. But I'm still not familar with the picture. Please let me know if I didn't understand the related codes correctly.

By the way, I still try to figure out how to add the corresponding unit tests for these changes.

@LinuxSuRen LinuxSuRen changed the title fix: no data receive from grpc WIP: fix: no data receive from grpc Sep 22, 2023
@wu-sheng

Copy link
Copy Markdown
Member

I can see gRPC plugin exists in dev only with tests. Have you cross verified with that?

@wu-sheng

Copy link
Copy Markdown
Member

FYI @Alipebt as you added gRPC plugin.

@LinuxSuRen

LinuxSuRen commented Sep 22, 2023

Copy link
Copy Markdown
Contributor Author

I can see gRPC plugin exists in dev only with tests. Have you cross verified with that?

Could you be more specific? I just checked the result before and after with this PR.

By the way, I checked the interface name of gRPC client. It is type ClientConnInterface interface. I'm not sure how *ClientConn" works. Maybe I missed something such as version.

https://github.com/grpc/grpc-go/blob/fe0dc2275d7dfdd61c6915bd3a4ec5bff37963e3/clientconn.go#L618

Any way, please let me know if anyone konw the difference.

@LinuxSuRen LinuxSuRen changed the title WIP: fix: no data receive from grpc fix: no data receive from grpc Sep 22, 2023
@wu-sheng

Copy link
Copy Markdown
Member

I mean this is the test,

All contributed plugins, including the ones made by the maintainers, require tests with various declared versions, as well as codes to help further users/contributora know what are tested.

This doc could help you to understand the tests. https://skywalking.apache.org/docs/skywalking-go/next/en/development-and-contribution/write-plugin-testing/

All these make maintainers don't debug the plugin for users and contributors. You could cross check, do local verification, and submit a patch or an enhancement with new test codes.

"github.com/dave/dst/dstutil"
)

type Buildin struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need to add this? It's not related to the grpc plugin.

@LinuxSuRen LinuxSuRen Sep 22, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about this. I forgot to remove the unrelated lines.

},
{
PackagePath: "",
At: instrument.NewMethodEnhance("*ClientConnInterface", "Invoke",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface cannot be intercepted, and I think intercepting ClientConnInterface is not effective.

ClientConn implements this interface, and when user make RPC calls, the Invoke and NewStream methods implemented by ClientConn are executed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me do more tests. I didn't get the tracing data of gRPC before. Below is my usage.

https://github.com/LinuxSuRen/api-testing/blob/58905fdd8f42b9f988f6312c7fe72034e0e12fc7/pkg/runner/grpc.go#L329

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean you need more intercepting points to support more gRPC usage, that is good.

You need to update the tests accordingly, with new usage of the gRPC APIs, and new expected segments/spans.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I need more time to make sure my use case is correct. I will add the corresponding tests after that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel very confused. The e2e test seem correct, but it cannot work in my case. So, I tend to close this PR until I can figure it out.

By the way, I didn't find a way to control if sending the data to SK server or not. For some use cases (at least in my cas), SkyWalking is not required for the installation. So, I'm wonderfing if there is a way to control it.

I found a possible solution is that. Read an environment variable SW_AGENT_ENABLED, return false if its value is false.

return opts.Package == "github.com/apache/skywalking-go/agent/reporter"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I didn't find a way to control if sending the data to SK server or not

No, you can't. That is kernel responsibility, including connection management, TLS, traffic limitation, etc.

For some use cases (at least in my cas), SkyWalking is not required for the installation

What do you mean some cases? Do you mean some URL or protocol? Or something else? You want to compile the agent into your binary, but not using it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean some cases? Do you mean some URL or protocol? Or something else? You want to compile the agent into your binary, but not using it?

Yes. Users might only want to install the tool instead of other optional component. For example my test tool, the following could start a server:

atest server

It will output the following errors if no SK server given. I'm thinking about if it's possible to avoid printing the errors.

skywalking-go 2023/09/25 14:58:14 open stream error rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 0.0.0.0:11800: connect: connection refused"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous discussion, we were not considering a general use tool would adopt this agent. So, the old proposal is going to package two binaries, one with the agent, the other is not. This should be good enough for a business service.

@mrproliu Do we have the mechanism for the runtime configuration for now? If so, maybe we could consider add one to disable the agent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanation. Consider my project is very small and simple, having mutiple distribution is not a good choice. As you mentioned, it's not problem for those business vendors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's focus on the feature at here.

@Alipebt

Alipebt commented Sep 22, 2023

Copy link
Copy Markdown
Contributor

What data are you referring to? I think the picture you provided is gRPC related data.

@wu-sheng

Copy link
Copy Markdown
Member

What data are you referring to? I think the picture you provided is gRPC related data.

I am wondering that too. @LinuxSuRen Could you explain what is your point of asking? The agent would not intercept your all codes, or not have to be the codes(APIs) you are calling. The meaning of exit spans(your screenshots) measures the performance of remote peer(server side and the network) as much as possible.
Also, for the distributed tracing, the trace would continue if the remote server has been instrumented. You could check the gRPC calling you made, there is a sw8 header injected by the agent to make the trace continuous.

@wu-sheng

Copy link
Copy Markdown
Member

This is a background you should learn about distributed tracing, https://research.google/pubs/pub36356/.
And we are not measuring the performance of lines of codes unless you begin to touch the part called profiling.

@LinuxSuRen

Copy link
Copy Markdown
Contributor Author

What data are you referring to? I think the picture you provided is gRPC related data.

I can see the data from that picture when I build skywalking-go-agent with this PR.

hi @wu-sheng , for the background of my project. The workflow is below:

A -> HTTP API -> call the extension which is a gRPC server.

So, sk could get the gRPC tracing data if I understand correctly. Currently, I only inject sk into the gRPC client side.

@wu-sheng

Copy link
Copy Markdown
Member

Follow this if that is your point, #103 (comment)

@LinuxSuRen

Copy link
Copy Markdown
Contributor Author

Close this PR until I could figure it out.

@LinuxSuRen LinuxSuRen closed this Sep 26, 2023
@wu-sheng wu-sheng added the TBD To be decided later. label Sep 26, 2023
@wu-sheng wu-sheng added this to the 0.3.0 milestone Sep 26, 2023
@LinuxSuRen

Copy link
Copy Markdown
Contributor Author

Finally, I figured out the reason. It's too embarrassing that I used 0.0.2 which does have not the gRPC plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TBD To be decided later.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants