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

Prometheus client library packages not found in chain code container spun by peer container #22

Open
pvrbharg opened this issue Jun 14, 2019 · 1 comment

Comments

@pvrbharg
Copy link

Hi,

I am trying to custom instrument my sample chaincode example_cc using Prometheus client golang library. The program works correctly natively in non-container environment. It fails at run time when I try to containerize the change [specifically at the instantiate step - when peer container tries to build chaincode example_cc with shim into an image and start the image in its own dev chaincode container]. I have used Go Module dependency resolution. I am using go.mod and go.sum mechanisms to resolve dependencies. I am seeing the following errors:
++++
hlbcadmin@ubuntu:~/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli$ go run fabric-cli.go chaincode instantiate --cid orgchannel --ccp=github.com/securekey/example_cc --ccid ExampleCC --v v0 --args '{"Args":["A","1","B","2"]}' --policy "AND('Org1MSP.member','Org2MSP.member')" --config ../../test/fixtures/config/config_test_local.yaml
[fabriccli] 2019/06/12 13:06:05 UTC - chaincode.glob..func4 -> ERRO Error while running instantiateAction: error instantiating chaincode: sending deploy transaction proposal failed: Transaction processing for endorser [localhost:7051]:
Chaincode status Code: (500) UNKNOWN. Description: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/github.com/securekey/example_cc/example_cc.go:27:5: cannot find package "github.com/prometheus/client_golang/prometheus" in any of:
/opt/go/src/github.com/prometheus/client_golang/prometheus (from $GOROOT)
/chaincode/input/src/github.com/prometheus/client_golang/prometheus (from $GOPATH)
/opt/gopath/src/github.com/prometheus/client_golang/prometheus
chaincode/input/src/github.com/securekey/example_cc/example_cc.go:29:2: cannot find package "github.com/prometheus/client_golang/prometheus/promauto" in any of:
/opt/go/src/github.com/prometheus/client_golang/prometheus/promauto (from $GOROOT)
/chaincode/input/src/github.com/prometheus/client_golang/prometheus/promauto (from $GOPATH)
/opt/gopath/src/github.com/prometheus/client_golang/prometheus/promauto
chaincode/input/src/github.com/securekey/example_cc/example_cc.go:28:5: cannot find package "github.com/prometheus/client_golang/prometheus/promhttp" in any of:
/opt/go/src/github.com/prometheus/client_golang/prometheus/promhttp (from $GOROOT)
/chaincode/input/src/github.com/prometheus/client_golang/prometheus/promhttp (from $GOPATH)
/opt/gopath/src/github.com/prometheus/client_golang/prometheus/promhttp
"
++++

My question - where exactly should I stage my vendor folder with client library packages for Prometheus and how do I make the child container spun by peer with chaincode+shim in to find the Prometheus client packages?

I am willing to share my project as a zip file if that helps. Thanks.

@pvrbharg
Copy link
Author

Dear team, I had some detailed discussions in the rocket chat with @nyet and @troyronda - per team wisdom - I may be underestimating the effort here... Not sure - I did various experiments and none of them are working or bearing fruits with the outcomes I had in mind. I did vendor where all I thought I should do and still the result ended up in failure. As I said - I am willing to share my project tree if it helps. My latest experimental results are in the attachment. I also posted a question for our fabric developers in the fabric chat and waiting for some response. I can connect with the developers and contributors directly if I need to.
fabricsdkgo-vendoring-issue-June162019.txt
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant