Skip to content
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

gRPC plugin issue | TypeError: Cannot read property 'replace' of undefined #1260

Closed
giri-jeedigunta opened this issue Jun 30, 2020 · 5 comments · Fixed by #1289
Closed

gRPC plugin issue | TypeError: Cannot read property 'replace' of undefined #1260

giri-jeedigunta opened this issue Jun 30, 2020 · 5 comments · Fixed by #1289
Assignees
Labels
bug Something isn't working

Comments

@giri-jeedigunta
Copy link

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

    "@opentelemetry/node": "^0.9.0"
    "@opentelemetry/plugin-grpc": "^0.9.0"

What version of Node are you using?

v13.10.1

What did you do?

I have a gRPC Client and Server applications. I'm trying to get the telemetry on the client application for both gRPC and http requests.

If possible, provide a recipe for reproducing the error.

A simple alive service in my proto file: I also have other unary and BiDi stream calls but I have commented out to test the simple alive call.

rpc alive ( Ok ) returns (Ok); 

in my nodejs I have called this:

const sendAliveHint = () => {
    const md = new grpc.Metadata();
    md.add('myApp', 'Client_App');
    client.alive({}, md, (err, result) => {
        if(err){
            console.error(`Error in connecting to the server`,err);
            
        } else {
            console.info(`[ALIVE] Server responded: ${JSON.stringify(result)}`);
        }
    });
};

What did you expect to see?

I was not expecting to see any errors and track the metrics on prometheus for both gRPC and http

What did you see instead?

I see this error and the app crashes:

/my-repo/node_modules/@opentelemetry/plugin-grpc/build/src/grpc.js:196
                const name = `grpc.${original.path.replace('/', '')}`;
                                                   ^

TypeError: Cannot read property 'replace' of undefined
    at ServiceClient.clientMethodTrace [as alive] (/my-repo/node_modules/@opentelemetry/plugin-grpc/build/src/grpc.js:196:52)
    at sendAliveHint (/my-repo/client/src/index.js:56:12)
    at Timeout._onTimeout (/my-repo/client/src/index.js:176:5)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
[nodemon] app crashed - waiting for file changes before starting...

Additional context

Add any other context about the problem here.

@giri-jeedigunta giri-jeedigunta added the bug Something isn't working label Jun 30, 2020
@dyladan
Copy link
Member

dyladan commented Jul 1, 2020

I will look into this today

@dyladan
Copy link
Member

dyladan commented Jul 1, 2020

@markwolff it looks like whatever original method which was wrapped with massWrap doesn't have a path property.

@markwolff markwolff self-assigned this Jul 1, 2020
@markwolff
Copy link
Member

@giri-jeedigunta Can you include your package.json version of grpc as well? This seems like a scenario covered here:

rpc UnaryMethod (TestRequest) returns (TestReply) {}

@giri-jeedigunta
Copy link
Author

@giri-jeedigunta Can you include your package.json version of grpc as well? This seems like a scenario covered here:

rpc UnaryMethod (TestRequest) returns (TestReply) {}

gRPC version:

    "google-protobuf": "^3.11.4",
    "grpc": "^1.24.2",

I will take a look at the test. Thank you !

@giri-jeedigunta
Copy link
Author

giri-jeedigunta commented Jul 8, 2020

@markwolff I've spent some time today to analyse this further. This issue is happening when I'm directly using the .proto file to define the service definition not a js file as showcased in the grpc the example.

I have forked the repo and modified the existing gRPC example to reproduce the issue I'm facing.
Here it is: https://github.com/giri-jeedigunta/opentelemetry-js/tree/master/examples/grpc

Also, I do not see this error occurring on gRPC server (npm run jaeger:server). This specifically happens only on the gRPC client (npm run jaeger:client).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants