Skip to content

Commit

Permalink
add note about WithStatsDCollector in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanime authored and rShetty committed Jun 3, 2020
1 parent b1d6562 commit 2f1fd27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,16 @@ client := hystrix.NewClient(
hystrix.WithHystrixTimeout(1000 * time.Millisecond),
hystrix.WithMaxConcurrentRequests(30),
hystrix.WithErrorPercentThreshold(20),
hystrix.WithStatsDCollector("localhost:8125", "myapp.hystrix"),
)

// The rest is the same as the previous example
```

In the above example, there are two timeout values used: one for the hystrix configuration, and one for the HTTP client configuration. The former determines the time at which hystrix should register an error, while the latter determines when the client itself should return a timeout error. Unless you have any special requirements, both of these would have the same values.

You can choose to export hystrix metrics to a statsD collector with the `hystrix.WithStatsDCollector(<statsd addr>, <metrics-prefix>)` option when initializing the client as shown above.

### Creating a hystrix-like circuit breaker with fallbacks

You can use the `hystrix.NewClient` function to create a client wrapped in a hystrix-like circuit breaker by passing in your own custom fallbacks:
Expand Down

0 comments on commit 2f1fd27

Please sign in to comment.