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

conduit bugfix: silence usage data on error #1205

Merged
merged 1 commit into from
Aug 26, 2022

Conversation

Eric-Warehime
Copy link
Contributor

Summary

Cobra prints usage data when the RunE function exits with an error, but that's pretty counterintuitive. If an error returned from conduit is on account of improper usage, the error should contain the proper info.

Cobra has an open issue about the need for docs on this as well. Found this solution there spf13/cobra#914

Test Plan

After fix (running using changes in #1204 )

> ./cmd/conduit/conduit -d ~/.algorand/conduit/
{"__type":"Conduit","_name":"main","level":"info","msg":"Data Directory: /Users/eric/.algorand/conduit/ ","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Auto-loading Conduit Configuration: /Users/eric/.algorand/conduit/conduit.yml","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Log level set to: info","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Conduit configuration is valid","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Found Importer: algod","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Found Processor: block_evaluator","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Found Exporter: postgresql","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"info","msg":"Starting Pipeline Initialization","time":"2022-08-26T13:40:09-07:00"}
{"__type":"Conduit","_name":"main","level":"error","msg":"Pipeline start failure: Pipeline.Start(): could not initialize Exporter (postgresql): connect failure constructing db, postgres: connecting to postgres: failed to connect to `host=localhost user=algorand database=indexer_db`: dial error (dial tcp 127.0.0.1:45432: connect: connection refused)","time":"2022-08-26T13:40:09-07:00"}
Error: Pipeline.Start(): could not initialize Exporter (postgresql): connect failure constructing db, postgres: connecting to postgres: failed to connect to `host=localhost user=algorand database=indexer_db`: dial error (dial tcp 127.0.0.1:45432: connect: connection refused)
ERRO[0000] Pipeline.Start(): could not initialize Exporter (postgresql): connect failure constructing db, postgres: connecting to postgres: failed to connect to `host=localhost user=algorand database=indexer_db`: dial error (dial tcp 127.0.0.1:45432: connect: connection refused) 

@Eric-Warehime Eric-Warehime added Not-Yet-Enabled Feature is not yet enabled at this time Skip-Release-Notes Reserved for PRs which do not need to be included in Release Notes labels Aug 26, 2022
@codecov
Copy link

codecov bot commented Aug 26, 2022

Codecov Report

❗ No coverage uploaded for pull request base (conduit@adbae7e). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             conduit    #1205   +/-   ##
==========================================
  Coverage           ?   60.10%           
==========================================
  Files              ?       64           
  Lines              ?     8895           
  Branches           ?        0           
==========================================
  Hits               ?     5346           
  Misses             ?     3075           
  Partials           ?      474           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -114,6 +114,7 @@ func conduitCmd() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runConduitCmdWithConfig(cfg)
},
SilenceUsage: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I love these types of bug fixes

@Eric-Warehime Eric-Warehime merged commit 13aaba6 into algorand:conduit Aug 26, 2022
@Eric-Warehime Eric-Warehime deleted the silence-usage-failure branch August 26, 2022 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not-Yet-Enabled Feature is not yet enabled at this time Skip-Release-Notes Reserved for PRs which do not need to be included in Release Notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants