├── .gitignore
├── .mvn
├── jvm.config
├── maven.config
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── .settings.xml
├── LICENSE.txt
├── README.md
├── grafana
├── config
│ └── provisioning
│ │ ├── dashboards
│ │ ├── Resilience4JDashboard-1571775123060.json
│ │ └── dashboard.yml
│ │ └── datasources
│ │ └── datasource.yml
├── docker-compose.yml
└── prometheus
│ └── prometheus.yml
├── mvnw
├── mvnw.cmd
├── pom.xml
├── spring-cloud-circuitbreaker-demo-reactive-resilience4j
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── springframework
│ │ │ └── cloud
│ │ │ └── circuitbreaker
│ │ │ └── demo
│ │ │ └── reactiveresilience4jcircuitbreakerdemo
│ │ │ ├── DemoController.java
│ │ │ ├── HttpBinService.java
│ │ │ └── ReactiveResilience4JCircuitbreakerDemoApplication.java
│ └── resources
│ │ └── application.yml
│ └── test
│ └── java
│ └── org
│ └── springframework
│ └── cloud
│ └── circuitbreaker
│ └── demo
│ └── reactiveresilience4jcircuitbreakerdemo
│ └── ReactiveResilience4JCircuitbreakerDemoApplicationTests.java
├── spring-cloud-circuitbreaker-demo-reactive
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── springframework
│ │ │ └── cloud
│ │ │ └── circuitbreaker
│ │ │ └── demo
│ │ │ └── reactive
│ │ │ ├── CompletableFutureDemoController.java
│ │ │ ├── CompletableFutureHttpBinService.java
│ │ │ ├── RxJava2DemoController.java
│ │ │ ├── RxJava2HttpBinService.java
│ │ │ └── SpringCloudCircuitbreakerDemoReactiveApplication.java
│ └── resources
│ │ └── application.properties
│ └── test
│ └── java
│ └── org
│ └── springframework
│ └── cloud
│ └── circuitbreaker
│ └── demo
│ └── reactive
│ └── SpringCloudCircuitbreakerDemoReactiveApplicationTests.java
└── spring-cloud-circuitbreaker-demo-resilience4j
├── .gitignore
├── pom.xml
└── src
├── main
├── java
│ └── org
│ │ └── springframework
│ │ └── cloud
│ │ └── circuitbreaker
│ │ └── demo
│ │ └── resilience4jcircuitbreakerdemo
│ │ ├── DemoController.java
│ │ ├── HttpBinService.java
│ │ └── Resilience4JCircuitbreakerDemoApplication.java
└── resources
│ └── application.yml
└── test
└── java
└── org
└── springframework
└── cloud
└── circuitbreaker
└── demo
└── resilience4jcircuitbreakerdemo
└── Resilience4JCircuitbreakerDemoApplicationTests.java
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
--------------------------------------------------------------------------------
/.mvn/maven.config:
--------------------------------------------------------------------------------
1 | -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring
2 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-cloud-samples/spring-cloud-circuitbreaker-demo/faafc24da64df3a6a2b2bc2dffaf68342839a626/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
--------------------------------------------------------------------------------
/.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | repo.spring.io
6 | ${env.CI_DEPLOY_USERNAME}
7 | ${env.CI_DEPLOY_PASSWORD}
8 |
9 |
10 |
11 |
12 |
18 | spring
19 | true
20 |
21 |
22 | spring-snapshots
23 | Spring Snapshots
24 | https://repo.spring.io/libs-snapshot-local
25 |
26 | true
27 |
28 |
29 |
30 | spring-milestones
31 | Spring Milestones
32 | https://repo.spring.io/libs-milestone-local
33 |
34 | false
35 |
36 |
37 |
38 | spring-releases
39 | Spring Releases
40 | https://repo.spring.io/release
41 |
42 | false
43 |
44 |
45 |
46 |
47 |
48 | spring-snapshots
49 | Spring Snapshots
50 | https://repo.spring.io/libs-snapshot-local
51 |
52 | true
53 |
54 |
55 |
56 | spring-milestones
57 | Spring Milestones
58 | https://repo.spring.io/libs-milestone-local
59 |
60 | false
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | https://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | https://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | This repo contains a collection of apps that demonstrate how to using Spring Cloud CircuitBreaker
4 | with various circuit breaker implementations.
5 |
6 | # Non-Reactive Samples
7 |
8 | The non-reactive example can be found in `spring-cloud-circuitbreaker-resilience4j`.
9 |
10 | When these apps are running there are two endpoints available for testing
11 |
12 | 1. `/get` - This endpoint makes a request to [httpbin's `/get` endpoint](http://httpbin.org/#/HTTP_Methods/get_get) and returns the data
13 |
14 | 2. `/delay/{seconds}` - This endpoint makes a request to [httpbin's `/delay` endpoint](http://httpbin.org/#/Dynamic_data/get_delay__delay_) passing
15 | the delay in the response in seconds. Since this request can take a significant amount
16 | of time it is wrapped in a circuit breaker. If the `seconds` parameter is greater than or
17 | equal to 3 the circuit breaker will time out and return the response `{"hello": "world"}`.
18 |
19 | # Reactive Samples
20 |
21 | There are two reactive samples in this repo, `spring-cloud-circuitbreaker-demo-reactive` and `spring-cloud-circuibreaker-demo-reactive-resilience4j`.
22 |
23 | ## Resilience4J Reactive Samples
24 |
25 | Both of these samples contain the same two endpoints as the non-reactive samples
26 | (which in this case return a `Mono`), but also
27 | contain an additional endpoint to demonstrate the use of `Flux`. This endpoint can be
28 | accessed by calling `/fluxdelay/{seconds}`. It has the same functionality as `/delay/{seconds}`
29 | but the fallback returns a `Flux`.
30 |
31 | ## spring-cloud-circuitbreaker-demo-reactive
32 |
33 | This sample demonstrates how to using Spring Cloud CircuitBreaker with reactive types from
34 | RxJava2 and CompletableFuture. There are four endpoints available for testing in this app
35 |
36 | 1. `/rxjava2/get`
37 | 2. `/rxjava2/delay/{seconds}`
38 | 3. `/completablefuture/get`
39 | 4. `/completablefuture/delay/{seconds}`
40 |
41 | Each of these have the same functionality as the other endpoints in the other apps.
42 |
43 | # Resilience4J and Metrics
44 |
45 | With Spring Cloud CircuitBreaker and Resilience4J you can easily collect metrics about
46 | the circuit breakers in your app. This is demoed in both `spring-cloud-circuitbreaker-demo-resilience4j`
47 | and `spring-cloud-circuitbreaker-demo-reactive-resilience4j`. You can see the metrics available
48 | by hitting `/actuator/metrics`.
49 |
50 | NOTE: The code wrapped by the circuit breaker needs to be executed before any metrics appear
51 |
52 | You can also have these metrics collected by Prometheus and visualized in Grafana. To demonstrate
53 | this, the repo contains a Docker Compose file that will start Prometheus and Grafana locally
54 | and scrape the metrics being surfaces at `/actuator/prometheus`. To see it in action
55 |
56 | 1. Start either `spring-cloud-circuitbreaker-demo-resilience4j` or `spring-cloud-circuitbreaker-demo-reactive-resilience4j`.
57 | 2. `cd` into the `grafana` directory in the root of the repo
58 | 3. Run `docker-compose up`
59 | 4. Go to http://localhost:3000 and login with the username `admin` and the password `admin`
60 | 5. There will be a datasource pointing to the docker container running Prometheus and dashboard already configured to visualize the Resilience4J metrics
61 | 6. Make some requests to the `/delay` endpoint. You can easily do this with a tool like `watch`.
62 | For example `watch -n 1 http :8080/delay/5`.
63 | 7. If you refresh the Grafana dashboard or set its automatic refresh you should see the graphs begin to change
64 | as requests are made.
65 |
--------------------------------------------------------------------------------
/grafana/config/provisioning/dashboards/Resilience4JDashboard-1571775123060.json:
--------------------------------------------------------------------------------
1 | {
2 | "annotations": {
3 | "list": [
4 | {
5 | "builtIn": 1,
6 | "datasource": "-- Grafana --",
7 | "enable": true,
8 | "hide": true,
9 | "iconColor": "rgba(0, 211, 255, 1)",
10 | "name": "Annotations & Alerts",
11 | "type": "dashboard"
12 | }
13 | ]
14 | },
15 | "editable": true,
16 | "gnetId": null,
17 | "graphTooltip": 0,
18 | "id": 2,
19 | "links": [],
20 | "panels": [
21 | {
22 | "aliasColors": {},
23 | "bars": false,
24 | "dashLength": 10,
25 | "dashes": false,
26 | "datasource": null,
27 | "fill": 1,
28 | "fillGradient": 0,
29 | "gridPos": {
30 | "h": 8,
31 | "w": 12,
32 | "x": 0,
33 | "y": 0
34 | },
35 | "id": 18,
36 | "legend": {
37 | "avg": false,
38 | "current": false,
39 | "max": false,
40 | "min": false,
41 | "show": true,
42 | "total": false,
43 | "values": false
44 | },
45 | "lines": true,
46 | "linewidth": 1,
47 | "nullPointMode": "null",
48 | "options": {
49 | "dataLinks": []
50 | },
51 | "percentage": false,
52 | "pointradius": 2,
53 | "points": false,
54 | "renderer": "flot",
55 | "seriesOverrides": [],
56 | "spaceLength": 10,
57 | "stack": false,
58 | "steppedLine": false,
59 | "targets": [
60 | {
61 | "expr": "resilience4j_circuitbreaker_state",
62 | "refId": "A"
63 | }
64 | ],
65 | "thresholds": [],
66 | "timeFrom": null,
67 | "timeRegions": [],
68 | "timeShift": null,
69 | "title": "resilience4j_circuitbreaker_state",
70 | "tooltip": {
71 | "shared": true,
72 | "sort": 0,
73 | "value_type": "individual"
74 | },
75 | "type": "graph",
76 | "xaxis": {
77 | "buckets": null,
78 | "mode": "time",
79 | "name": null,
80 | "show": true,
81 | "values": []
82 | },
83 | "yaxes": [
84 | {
85 | "format": "short",
86 | "label": null,
87 | "logBase": 1,
88 | "max": null,
89 | "min": null,
90 | "show": true
91 | },
92 | {
93 | "format": "short",
94 | "label": null,
95 | "logBase": 1,
96 | "max": null,
97 | "min": null,
98 | "show": true
99 | }
100 | ],
101 | "yaxis": {
102 | "align": false,
103 | "alignLevel": null
104 | }
105 | },
106 | {
107 | "aliasColors": {},
108 | "bars": false,
109 | "dashLength": 10,
110 | "dashes": false,
111 | "datasource": null,
112 | "fill": 1,
113 | "fillGradient": 0,
114 | "gridPos": {
115 | "h": 8,
116 | "w": 12,
117 | "x": 12,
118 | "y": 0
119 | },
120 | "id": 16,
121 | "legend": {
122 | "avg": false,
123 | "current": false,
124 | "max": false,
125 | "min": false,
126 | "show": true,
127 | "total": false,
128 | "values": false
129 | },
130 | "lines": true,
131 | "linewidth": 1,
132 | "nullPointMode": "null",
133 | "options": {
134 | "dataLinks": []
135 | },
136 | "percentage": false,
137 | "pointradius": 2,
138 | "points": false,
139 | "renderer": "flot",
140 | "seriesOverrides": [],
141 | "spaceLength": 10,
142 | "stack": false,
143 | "steppedLine": false,
144 | "targets": [
145 | {
146 | "expr": "resilience4j_circuitbreaker_slow_calls",
147 | "refId": "A"
148 | }
149 | ],
150 | "thresholds": [],
151 | "timeFrom": null,
152 | "timeRegions": [],
153 | "timeShift": null,
154 | "title": "resilience4j_circuitbreaker_slow_calls",
155 | "tooltip": {
156 | "shared": true,
157 | "sort": 0,
158 | "value_type": "individual"
159 | },
160 | "type": "graph",
161 | "xaxis": {
162 | "buckets": null,
163 | "mode": "time",
164 | "name": null,
165 | "show": true,
166 | "values": []
167 | },
168 | "yaxes": [
169 | {
170 | "format": "short",
171 | "label": null,
172 | "logBase": 1,
173 | "max": null,
174 | "min": null,
175 | "show": true
176 | },
177 | {
178 | "format": "short",
179 | "label": null,
180 | "logBase": 1,
181 | "max": null,
182 | "min": null,
183 | "show": true
184 | }
185 | ],
186 | "yaxis": {
187 | "align": false,
188 | "alignLevel": null
189 | }
190 | },
191 | {
192 | "aliasColors": {},
193 | "bars": false,
194 | "dashLength": 10,
195 | "dashes": false,
196 | "datasource": null,
197 | "fill": 1,
198 | "fillGradient": 0,
199 | "gridPos": {
200 | "h": 8,
201 | "w": 12,
202 | "x": 0,
203 | "y": 8
204 | },
205 | "id": 14,
206 | "legend": {
207 | "avg": false,
208 | "current": false,
209 | "max": false,
210 | "min": false,
211 | "show": true,
212 | "total": false,
213 | "values": false
214 | },
215 | "lines": true,
216 | "linewidth": 1,
217 | "nullPointMode": "null",
218 | "options": {
219 | "dataLinks": []
220 | },
221 | "percentage": false,
222 | "pointradius": 2,
223 | "points": false,
224 | "renderer": "flot",
225 | "seriesOverrides": [],
226 | "spaceLength": 10,
227 | "stack": false,
228 | "steppedLine": false,
229 | "targets": [
230 | {
231 | "expr": "resilience4j_circuitbreaker_slow_call_rate",
232 | "refId": "A"
233 | }
234 | ],
235 | "thresholds": [],
236 | "timeFrom": null,
237 | "timeRegions": [],
238 | "timeShift": null,
239 | "title": "resilience4j_circuitbreaker_slow_call_rate",
240 | "tooltip": {
241 | "shared": true,
242 | "sort": 0,
243 | "value_type": "individual"
244 | },
245 | "type": "graph",
246 | "xaxis": {
247 | "buckets": null,
248 | "mode": "time",
249 | "name": null,
250 | "show": true,
251 | "values": []
252 | },
253 | "yaxes": [
254 | {
255 | "format": "short",
256 | "label": null,
257 | "logBase": 1,
258 | "max": null,
259 | "min": null,
260 | "show": true
261 | },
262 | {
263 | "format": "short",
264 | "label": null,
265 | "logBase": 1,
266 | "max": null,
267 | "min": null,
268 | "show": true
269 | }
270 | ],
271 | "yaxis": {
272 | "align": false,
273 | "alignLevel": null
274 | }
275 | },
276 | {
277 | "aliasColors": {},
278 | "bars": false,
279 | "dashLength": 10,
280 | "dashes": false,
281 | "datasource": null,
282 | "fill": 1,
283 | "fillGradient": 0,
284 | "gridPos": {
285 | "h": 8,
286 | "w": 12,
287 | "x": 12,
288 | "y": 8
289 | },
290 | "id": 12,
291 | "legend": {
292 | "avg": false,
293 | "current": false,
294 | "max": false,
295 | "min": false,
296 | "show": true,
297 | "total": false,
298 | "values": false
299 | },
300 | "lines": true,
301 | "linewidth": 1,
302 | "nullPointMode": "null",
303 | "options": {
304 | "dataLinks": []
305 | },
306 | "percentage": false,
307 | "pointradius": 2,
308 | "points": false,
309 | "renderer": "flot",
310 | "seriesOverrides": [],
311 | "spaceLength": 10,
312 | "stack": false,
313 | "steppedLine": false,
314 | "targets": [
315 | {
316 | "expr": "resilience4j_circuitbreaker_failure_rate",
317 | "refId": "A"
318 | }
319 | ],
320 | "thresholds": [],
321 | "timeFrom": null,
322 | "timeRegions": [],
323 | "timeShift": null,
324 | "title": "resilience4j_circuitbreaker_failure_rate",
325 | "tooltip": {
326 | "shared": true,
327 | "sort": 0,
328 | "value_type": "individual"
329 | },
330 | "type": "graph",
331 | "xaxis": {
332 | "buckets": null,
333 | "mode": "time",
334 | "name": null,
335 | "show": true,
336 | "values": []
337 | },
338 | "yaxes": [
339 | {
340 | "format": "short",
341 | "label": null,
342 | "logBase": 1,
343 | "max": null,
344 | "min": null,
345 | "show": true
346 | },
347 | {
348 | "format": "short",
349 | "label": null,
350 | "logBase": 1,
351 | "max": null,
352 | "min": null,
353 | "show": true
354 | }
355 | ],
356 | "yaxis": {
357 | "align": false,
358 | "alignLevel": null
359 | }
360 | },
361 | {
362 | "aliasColors": {},
363 | "bars": false,
364 | "dashLength": 10,
365 | "dashes": false,
366 | "datasource": null,
367 | "fill": 1,
368 | "fillGradient": 0,
369 | "gridPos": {
370 | "h": 8,
371 | "w": 12,
372 | "x": 0,
373 | "y": 16
374 | },
375 | "id": 10,
376 | "legend": {
377 | "avg": false,
378 | "current": false,
379 | "max": false,
380 | "min": false,
381 | "show": true,
382 | "total": false,
383 | "values": false
384 | },
385 | "lines": true,
386 | "linewidth": 1,
387 | "nullPointMode": "null",
388 | "options": {
389 | "dataLinks": []
390 | },
391 | "percentage": false,
392 | "pointradius": 2,
393 | "points": false,
394 | "renderer": "flot",
395 | "seriesOverrides": [],
396 | "spaceLength": 10,
397 | "stack": false,
398 | "steppedLine": false,
399 | "targets": [
400 | {
401 | "expr": "resilience4j_circuitbreaker_calls_total",
402 | "refId": "A"
403 | }
404 | ],
405 | "thresholds": [],
406 | "timeFrom": null,
407 | "timeRegions": [],
408 | "timeShift": null,
409 | "title": "resilience4j_circuitbreaker_calls_seconds_sum",
410 | "tooltip": {
411 | "shared": true,
412 | "sort": 0,
413 | "value_type": "individual"
414 | },
415 | "type": "graph",
416 | "xaxis": {
417 | "buckets": null,
418 | "mode": "time",
419 | "name": null,
420 | "show": true,
421 | "values": []
422 | },
423 | "yaxes": [
424 | {
425 | "format": "short",
426 | "label": null,
427 | "logBase": 1,
428 | "max": null,
429 | "min": null,
430 | "show": true
431 | },
432 | {
433 | "format": "short",
434 | "label": null,
435 | "logBase": 1,
436 | "max": null,
437 | "min": null,
438 | "show": true
439 | }
440 | ],
441 | "yaxis": {
442 | "align": false,
443 | "alignLevel": null
444 | }
445 | },
446 | {
447 | "aliasColors": {},
448 | "bars": false,
449 | "dashLength": 10,
450 | "dashes": false,
451 | "datasource": null,
452 | "fill": 1,
453 | "fillGradient": 0,
454 | "gridPos": {
455 | "h": 8,
456 | "w": 12,
457 | "x": 12,
458 | "y": 16
459 | },
460 | "id": 8,
461 | "legend": {
462 | "avg": false,
463 | "current": false,
464 | "max": false,
465 | "min": false,
466 | "show": true,
467 | "total": false,
468 | "values": false
469 | },
470 | "lines": true,
471 | "linewidth": 1,
472 | "nullPointMode": "null",
473 | "options": {
474 | "dataLinks": []
475 | },
476 | "percentage": false,
477 | "pointradius": 2,
478 | "points": false,
479 | "renderer": "flot",
480 | "seriesOverrides": [],
481 | "spaceLength": 10,
482 | "stack": false,
483 | "steppedLine": false,
484 | "targets": [
485 | {
486 | "expr": "resilience4j_circuitbreaker_calls_seconds_sum",
487 | "refId": "A"
488 | }
489 | ],
490 | "thresholds": [],
491 | "timeFrom": null,
492 | "timeRegions": [],
493 | "timeShift": null,
494 | "title": "resilience4j_circuitbreaker_calls_seconds_sum",
495 | "tooltip": {
496 | "shared": true,
497 | "sort": 0,
498 | "value_type": "individual"
499 | },
500 | "type": "graph",
501 | "xaxis": {
502 | "buckets": null,
503 | "mode": "time",
504 | "name": null,
505 | "show": true,
506 | "values": []
507 | },
508 | "yaxes": [
509 | {
510 | "format": "short",
511 | "label": null,
512 | "logBase": 1,
513 | "max": null,
514 | "min": null,
515 | "show": true
516 | },
517 | {
518 | "format": "short",
519 | "label": null,
520 | "logBase": 1,
521 | "max": null,
522 | "min": null,
523 | "show": true
524 | }
525 | ],
526 | "yaxis": {
527 | "align": false,
528 | "alignLevel": null
529 | }
530 | },
531 | {
532 | "aliasColors": {},
533 | "bars": false,
534 | "dashLength": 10,
535 | "dashes": false,
536 | "datasource": null,
537 | "fill": 1,
538 | "fillGradient": 0,
539 | "gridPos": {
540 | "h": 8,
541 | "w": 12,
542 | "x": 0,
543 | "y": 24
544 | },
545 | "id": 6,
546 | "legend": {
547 | "avg": false,
548 | "current": false,
549 | "max": false,
550 | "min": false,
551 | "show": true,
552 | "total": false,
553 | "values": false
554 | },
555 | "lines": true,
556 | "linewidth": 1,
557 | "nullPointMode": "null",
558 | "options": {
559 | "dataLinks": []
560 | },
561 | "percentage": false,
562 | "pointradius": 2,
563 | "points": false,
564 | "renderer": "flot",
565 | "seriesOverrides": [],
566 | "spaceLength": 10,
567 | "stack": false,
568 | "steppedLine": false,
569 | "targets": [
570 | {
571 | "expr": "resilience4j_circuitbreaker_calls_seconds_max",
572 | "refId": "A"
573 | }
574 | ],
575 | "thresholds": [],
576 | "timeFrom": null,
577 | "timeRegions": [],
578 | "timeShift": null,
579 | "title": "resilience4j_circuitbreaker_calls_seconds_max",
580 | "tooltip": {
581 | "shared": true,
582 | "sort": 0,
583 | "value_type": "individual"
584 | },
585 | "type": "graph",
586 | "xaxis": {
587 | "buckets": null,
588 | "mode": "time",
589 | "name": null,
590 | "show": true,
591 | "values": []
592 | },
593 | "yaxes": [
594 | {
595 | "format": "short",
596 | "label": null,
597 | "logBase": 1,
598 | "max": null,
599 | "min": null,
600 | "show": true
601 | },
602 | {
603 | "format": "short",
604 | "label": null,
605 | "logBase": 1,
606 | "max": null,
607 | "min": null,
608 | "show": true
609 | }
610 | ],
611 | "yaxis": {
612 | "align": false,
613 | "alignLevel": null
614 | }
615 | },
616 | {
617 | "aliasColors": {},
618 | "bars": false,
619 | "dashLength": 10,
620 | "dashes": false,
621 | "datasource": null,
622 | "fill": 1,
623 | "fillGradient": 0,
624 | "gridPos": {
625 | "h": 8,
626 | "w": 12,
627 | "x": 12,
628 | "y": 24
629 | },
630 | "id": 4,
631 | "legend": {
632 | "avg": false,
633 | "current": false,
634 | "max": false,
635 | "min": false,
636 | "show": true,
637 | "total": false,
638 | "values": false
639 | },
640 | "lines": true,
641 | "linewidth": 1,
642 | "nullPointMode": "null",
643 | "options": {
644 | "dataLinks": []
645 | },
646 | "percentage": false,
647 | "pointradius": 2,
648 | "points": false,
649 | "renderer": "flot",
650 | "seriesOverrides": [],
651 | "spaceLength": 10,
652 | "stack": false,
653 | "steppedLine": false,
654 | "targets": [
655 | {
656 | "expr": "resilience4j_circuitbreaker_calls_seconds_count",
657 | "refId": "A"
658 | }
659 | ],
660 | "thresholds": [],
661 | "timeFrom": null,
662 | "timeRegions": [],
663 | "timeShift": null,
664 | "title": "resilience4j_circuitbreaker_calls_seconds_count",
665 | "tooltip": {
666 | "shared": true,
667 | "sort": 0,
668 | "value_type": "individual"
669 | },
670 | "type": "graph",
671 | "xaxis": {
672 | "buckets": null,
673 | "mode": "time",
674 | "name": null,
675 | "show": true,
676 | "values": []
677 | },
678 | "yaxes": [
679 | {
680 | "format": "short",
681 | "label": null,
682 | "logBase": 1,
683 | "max": null,
684 | "min": null,
685 | "show": true
686 | },
687 | {
688 | "format": "short",
689 | "label": null,
690 | "logBase": 1,
691 | "max": null,
692 | "min": null,
693 | "show": true
694 | }
695 | ],
696 | "yaxis": {
697 | "align": false,
698 | "alignLevel": null
699 | }
700 | },
701 | {
702 | "aliasColors": {},
703 | "bars": false,
704 | "dashLength": 10,
705 | "dashes": false,
706 | "datasource": null,
707 | "fill": 1,
708 | "fillGradient": 0,
709 | "gridPos": {
710 | "h": 9,
711 | "w": 12,
712 | "x": 0,
713 | "y": 32
714 | },
715 | "id": 2,
716 | "legend": {
717 | "avg": false,
718 | "current": false,
719 | "max": false,
720 | "min": false,
721 | "show": true,
722 | "total": false,
723 | "values": false
724 | },
725 | "lines": true,
726 | "linewidth": 1,
727 | "nullPointMode": "null",
728 | "options": {
729 | "dataLinks": []
730 | },
731 | "percentage": false,
732 | "pointradius": 2,
733 | "points": false,
734 | "renderer": "flot",
735 | "seriesOverrides": [],
736 | "spaceLength": 10,
737 | "stack": false,
738 | "steppedLine": false,
739 | "targets": [
740 | {
741 | "expr": "resilience4j_circuitbreaker_buffered_calls",
742 | "refId": "A"
743 | }
744 | ],
745 | "thresholds": [],
746 | "timeFrom": null,
747 | "timeRegions": [],
748 | "timeShift": null,
749 | "title": "resilience4j_circuitbreaker_buffered_calls",
750 | "tooltip": {
751 | "shared": true,
752 | "sort": 0,
753 | "value_type": "individual"
754 | },
755 | "type": "graph",
756 | "xaxis": {
757 | "buckets": null,
758 | "mode": "time",
759 | "name": null,
760 | "show": true,
761 | "values": []
762 | },
763 | "yaxes": [
764 | {
765 | "format": "short",
766 | "label": null,
767 | "logBase": 1,
768 | "max": null,
769 | "min": null,
770 | "show": true
771 | },
772 | {
773 | "format": "short",
774 | "label": null,
775 | "logBase": 1,
776 | "max": null,
777 | "min": null,
778 | "show": true
779 | }
780 | ],
781 | "yaxis": {
782 | "align": false,
783 | "alignLevel": null
784 | }
785 | }
786 | ],
787 | "schemaVersion": 20,
788 | "style": "dark",
789 | "tags": [],
790 | "templating": {
791 | "list": []
792 | },
793 | "time": {
794 | "from": "now-5m",
795 | "to": "now"
796 | },
797 | "timepicker": {},
798 | "timezone": "",
799 | "title": "Resilience4J Dashboard",
800 | "uid": "cT25vjTZz",
801 | "version": 9
802 | }
--------------------------------------------------------------------------------
/grafana/config/provisioning/dashboards/dashboard.yml:
--------------------------------------------------------------------------------
1 | apiVersion: 1
2 |
3 | providers:
4 | - name: 'Prometheus'
5 | orgId: 1
6 | folder: ''
7 | type: file
8 | disableDeletion: false
9 | editable: true
10 | options:
11 | path: /etc/grafana/provisioning/dashboards
--------------------------------------------------------------------------------
/grafana/config/provisioning/datasources/datasource.yml:
--------------------------------------------------------------------------------
1 | # config file version
2 | apiVersion: 1
3 |
4 | # list of datasources that should be deleted from the database
5 | deleteDatasources:
6 | - name: Prometheus
7 | orgId: 1
8 |
9 | # list of datasources to insert/update depending
10 | # whats available in the database
11 | datasources:
12 | # name of the datasource. Required
13 | - name: Prometheus
14 | # datasource type. Required
15 | type: prometheus
16 | # access mode. direct or proxy. Required
17 | access: proxy
18 | # org id. will default to orgId 1 if not specified
19 | orgId: 1
20 | # url
21 | url: http://prometheus:9090
22 | # database password, if used
23 | #password:
24 | # database user, if used
25 | #user:
26 | # database name, if used
27 | #database:
28 | # enable/disable basic auth
29 | #basicAuth: true
30 | # basic auth username
31 | #basicAuthUser: admin
32 | # basic auth password
33 | #basicAuthPassword: foobar
34 | # enable/disable with credentials headers
35 | #withCredentials:
36 | # mark as default datasource. Max one per org
37 | isDefault: true
38 | #