-
Notifications
You must be signed in to change notification settings - Fork 10
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
Electrum Endpoints and Prometheus #9
Conversation
git fetch --tags | ||
|
||
# Get latest tag name | ||
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id check the tag to make sure its "vX.X.X" here to make sure you don't get any unexpected tags
@@ -102,7 +123,18 @@ func parseArgs(searchRequest *pb.SearchRequest) *server.Args { | |||
} | |||
|
|||
if serveCmd.Happened() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be a switch
statement
@@ -174,15 +213,46 @@ func main() { | |||
ctx, cancel := context.WithTimeout(context.Background(), time.Second) | |||
defer cancel() | |||
|
|||
log.Println(args) | |||
if args.CmdType == server.SearchCmd { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be a switch
statement
} | ||
|
||
message NoParamsThisIsSilly {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol is this really necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I meant to change that name, although the empty message is necessary for a function that doesn't take params in grpc.
} | ||
*/ | ||
message BlockHeaderOutput { | ||
string hash = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackrobison @shyba we should review these names to make sure we use all these and they make sense for us. they are holdovers from bitcoin/electrum, but we may want to pick better ones (like nTx
is not great)
rpc Search (SearchRequest) returns (Outputs) {} | ||
rpc GetBlock (BlockRequest) returns (BlockOutput) {} | ||
rpc GetBlockHeader (BlockRequest) returns (BlockHeaderOutput) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need both GetBlockHeader and GetHeaders?
rpc Ping (NoParamsThisIsSilly) returns (google.protobuf.StringValue) {} | ||
rpc Version (NoParamsThisIsSilly) returns (google.protobuf.StringValue) {} | ||
rpc Features (NoParamsThisIsSilly) returns (google.protobuf.StringValue) {} | ||
rpc Broadcast(NoParamsThisIsSilly) returns (google.protobuf.UInt64Value) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? in fact it might be good to document all these methods here a bit
func (s *Server) GetBlock(ctx context.Context, blockReq *pb.BlockRequest) (*pb.BlockOutput, error) { | ||
|
||
log.Println("In GetBlock") | ||
rpcClient := jsonrpc.NewClientWithOpts("http://localhost"+":29245", &jsonrpc.RPCClientOpts{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the host and port should be configurable, or at the very least global constants of some sort
) | ||
|
||
var ( | ||
myCounters = map[string]prometheus.Metric{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at https://github.com/lbryio/odysee-api/tree/master/internal/metrics for how we do prometheus elsewhere. fyi anything you put into the internal
top-level package will not be exported. so things like metrics should go there
eb52878
to
61636f3
Compare
No description provided.