Coder Social home page Coder Social logo

Comments (5)

jba avatar jba commented on July 20, 2024

Unfortunately the file format is binary. It uses this protobuf: https://github.com/google/go-replayers/blob/master/grpcreplay/proto/grpcreplay/grpcreplay.proto.

Can you post a reproduction of the problem here? I'll try to debug.

from go-replayers.

jba avatar jba commented on July 20, 2024

To display the contents of the .replay file, use Fprint.

from go-replayers.

gmgchow avatar gmgchow commented on July 20, 2024

I tried debugging using Fprint and found that at this line, both e and err are nil so the function exits. I am not sure why e is nil.

This is a sample of how I am trying to use this tool: https://play.golang.org/p/5nm9S3kjpaV . Basically if no .replay file is found, I want to create one so that the next time the same test is run, it will replay the traffic that was recorded.

from go-replayers.

vangent avatar vangent commented on July 20, 2024

I am not sure why e is nil.

It looks to me like this happens when the replay file is empty (

return nil, nil
)

You could try using callbacks to see which RPCs are getting recorded:
https://godoc.org/github.com/google/go-replayers/grpcreplay#hdr-Callbacks

Also, make sure your recorder is getting closed correctly; your code looks like it is calling Close, but silently swallowing errors, so just verify that that is working.

from go-replayers.

jba avatar jba commented on July 20, 2024

@gmgchow, e and error are nil at end of file. If all you see from Fprint is

initial state: ...

then you have no records in your replay file.

Are you checking the error returned from Fprint? Maybe there is some other problem.

Also, as @vangent mentioned, you need to handle the error when you close the file (after line 18 in your playground snippet).

Unrelated, but here is a simpler version of ReplayFileExists:

func FileIsReadable(file string) bool {
	_, err := os.Stat(file)
	return err == nil
}

While Stat may return other errors that don't necessarily mean the file doesn't exist, any error suggests that there will be a problem reading the file.

from go-replayers.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.