├── .DS_Store ├── .babelrc ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── __tests__ ├── socketIOtest.js └── supertest.js ├── client ├── App.jsx ├── assets │ ├── CogIcon.jsx │ ├── GraphIcon.jsx │ ├── HomeIcon.jsx │ ├── KafkaPeekLogo.jsx │ ├── Logout.jsx │ ├── UserIcon.jsx │ └── images │ │ ├── kafkaPeek-demo.png │ │ └── kafkaPeek-logo.png ├── components │ ├── HealthBinBout.jsx │ ├── HealthJVM.jsx │ ├── HealthMsgIn.jsx │ ├── PerfReqPerSec.jsx │ ├── PerfReqTotalTime.jsx │ ├── PerfResQueueTime.jsx │ ├── PerfResSendTime.jsx │ ├── StaticMetricDisplay.jsx │ └── notificationComponents │ │ ├── BytesInPer.jsx │ │ ├── BytesOutPer.jsx │ │ ├── OfflinePart.jsx │ │ ├── OngoingMetrics.jsx │ │ └── UnderRep.jsx ├── containers │ ├── Header.jsx │ ├── HealthDashboard.jsx │ ├── Landing.jsx │ ├── Notifications.jsx │ ├── PerfDashboard.jsx │ └── Sidebar.jsx ├── database │ └── db.json ├── index.html ├── index.js └── styles │ ├── _dashboard.scss │ ├── _header.scss │ ├── _landing.scss │ ├── _login.scss │ ├── _notifications.scss │ ├── _ongoingMetrics.scss │ ├── _sidebar.scss │ └── application.scss ├── consumer └── index.js ├── docker-compose.yml ├── etc ├── jmx_exporter │ └── config.yml └── prometheus │ └── prometheus.yml ├── grafana ├── dashboards │ ├── grafana_dashboard_broker_hard_disk_usage.json │ ├── grafana_dashboard_broker_jvm_os.json │ ├── grafana_dashboard_broker_performance.json │ ├── grafana_dashboard_broker_zookeeper.json │ ├── grafana_dashboard_client_consumers_fetch_lag.json │ ├── grafana_dashboard_cluster_healthcheck.json │ ├── grafana_dashboard_cluster_replication.json │ └── grafana_dashboard_topics_logs.json └── provisioning │ ├── dashboards │ └── kafka.yaml │ └── datasources │ └── datasource.yaml ├── index.html ├── jest.config.js ├── package-lock.json ├── package.json ├── producer └── index.js ├── server ├── controllers │ ├── oauthController.js │ ├── slackController.js │ └── utils.js ├── queries.js ├── router │ └── routes.js └── server.js ├── test-teardown-globals.js └── webpack.config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/KafkaPeek/8e7529f6375fb8170dc300f5e38eac608c9efc13/.DS_Store -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | presets: ["@babel/preset-env", "@babel/preset-react"] 3 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | #Security risk 107 | .DS_store -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | dipennagpal@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | ![KafkaPeek Logo](./client/assets/images/kafkaPeek-logo.png "KafkaPeek Logo") 4 | 5 |
6 | 7 |

KafkaPeek

8 | 9 | KafkaPeek is a developer tool that monitors key metrics in your local Kafka deployment. 10 | 11 | #### Key Health Metrics Tracked 12 | 13 | - Bytes In Per Sec 14 | - Bytes Out Per Sec 15 | - JVM Heap Usage (MB) 16 | - Under Replicated Partitions 17 | - Offline Partition Count 18 | - Active Controller Count 19 | - Brokers Running 20 | 21 | #### Key Performance Metrics Tracked 22 | 23 | - Requests Per Sec 24 | - Request Total Time (s) 25 | - Request Queue Time (ms) 26 | - Response Send Time (ms) 27 | ## Tech Stack 28 | 29 | **Client:** [React](https://reactjs.org/), [React Router](https://reactrouter.com/en/main), [ApexCharts](https://apexcharts.com), [Socket.io](https://socket.io) 30 | 31 | **Server:** [Node](https://nodejs.org/en/), [Express](https://expressjs.com/), [Socket.io](https://socket.io) [KafkaJS](https://kafka.js.org) 32 | 33 | 34 | **DevOps:** [Apache Kafka](https://kafka.apache.org/), [Prometheus](https://prometheus.io/), [JMX Exporter](https://github.com/prometheus/jmx_exporter), [Grafana](https://grafana.com), [Docker](https://www.docker.com), [Git](https://git-scm.com/), [Github](https://github.com/) 35 | 36 | 37 | ## Features 38 | 39 | - Live monitoring of key health metrics of a Kafka Broker 40 | - Secured login through Github OAuth 41 | - Slack alerts if metrics go beyond user set specifications 42 | - Customization of dashboard metrics based on the organizations needs 43 | - Ability to save graphs in real time 44 | 45 | 46 | ## Installation 47 | 48 | Install KafkaPeek with npm to install all dependencies 49 | 50 | ```bash 51 | npm install 52 | ``` 53 | 54 | ## Deployment 55 | 56 | To deploy this project run the following commands in the terminal: 57 | 58 | 1. Deploy your kafka cluster 59 | ```bash 60 | docker-compose up 61 | ``` 62 | 63 | 2. In a new terminal window, deploy the producer: 64 | ```bash 65 | npm run start:producer 66 | ``` 67 | 68 | 3. In a new terminal window, deploy the consumer: 69 | ```bash 70 | npm run start:consumer 71 | ``` 72 | 73 | 4. In a new terminal window, deploy the application on: 74 | 75 | Deploy application on dev server (localhost:8080) 76 | ```bash 77 | npm run dev 78 | ``` 79 | 80 | OR 81 | 82 | Deploy application on production server (localhost:4000) 83 | ```bash 84 | npm run build 85 | ``` 86 | then 87 | ```bash 88 | npm start 89 | ``` 90 | Now you have a fully functioning Kafka broker with one demo producer and consumer. 91 | 92 | ## Demo 93 | 94 |

Main Dashboard

95 | 96 | 97 | ![Alt Text](https://media.giphy.com/media/kfKhKpAbezCIxwCW9D/giphy.gif) 98 | 99 |

Slack Notifications

100 | 101 | 102 | ![Alt Text](https://media.giphy.com/media/0ykVFzaLsVZao1XgGR/giphy.gif) 103 | 104 | 105 | ## Running Tests 106 | 107 | To run tests, run the following command 108 | 109 | ```bash 110 | npm run test socketIOtest.js 111 | ``` 112 | ```bash 113 | npm run test supertest.js 114 | ``` 115 | 116 | ## Roadmap 117 | 118 | - Web Based Application 119 | - Customized Developer Options 120 | - Github OAuth Authentication 121 | - User Account Information 122 | - User Settings 123 | - NoSql Database - Error Logs/Accounts/Archived Metrics 124 | 125 | 126 | ## Acknowledgements 127 | 128 | - [Awesome Readme Templates](https://awesomeopensource.com/project/elangosundar/awesome-README-templates) 129 | - [Awesome README](https://github.com/matiassingers/awesome-readme) 130 | - [How to write a Good readme](https://bulldogjob.com/news/449-how-to-write-a-good-readme-for-your-github-project) 131 | 132 | 133 | ## Authors 134 | 135 | - Dipen Nagpal: [Github](https://github.com/dnagpal1) | [LinkedIn](www.linkedin.com/in/dipen-nagpal) 136 | - Nicholas Echevarria: [Github](https://github.com/nick-echevarria) | [LinkedIn](https://www.linkedin.com/in/nicholasechevarria/) 137 | - Luis Navarro: [Github](https://github.com/luis-e-navarro) | [LinkedIn](https://linkedin.com/in/luis-e-navarro) 138 | - Juan Kang: [Github](https://github.com/juanpakang) | [LinkedIn](https://www.linkedin.com/in/juankang/) 139 | -------------------------------------------------------------------------------- /__tests__/socketIOtest.js: -------------------------------------------------------------------------------- 1 | const { createServer } = require("http"); 2 | const { Server } = require("socket.io"); 3 | const Client = require("socket.io-client"); 4 | const { httpServer } = require('../server/server'); 5 | const { fetchQuery, resetCounter } = require('../server/queries'); 6 | // const {params} = require('../client/containers/Health_Dashboard') 7 | describe("Testing KafkaPeek websocket", () => { 8 | let io, serverSocket, clientSocket; 9 | 10 | beforeAll((done) => { 11 | const httpServer = createServer(); 12 | io = new Server(httpServer); 13 | httpServer.listen(() => { 14 | const port = httpServer.address().port; 15 | clientSocket = new Client(`http://localhost:${port}`); 16 | io.on("connection", (socket) => { 17 | serverSocket = socket; 18 | }); 19 | clientSocket.on("connect", done); 20 | }); 21 | }); 22 | 23 | afterAll(() => { 24 | io.close(); 25 | clientSocket.close(); 26 | }); 27 | 28 | test("should return kafka metrics with the right size and value", (done) => { 29 | clientSocket.on("health", (args) => { 30 | console.log(args) 31 | expect(args.bytesInPerSec).toHaveLength(60) 32 | expect(args.bytesOutPerSec).toHaveLength(60) 33 | expect(args.messagesInPerSec).toHaveLength(60) 34 | expect(args.jvmHeapUsage).toHaveLength(60) 35 | expect(args.activeControllerCount).toBe('1') 36 | expect(args.underRepPartitions).toBe('0') 37 | expect(args.brokersRunning).toBe('1') 38 | expect(args.offlinePartitions).toBe('0') 39 | done(); 40 | }); 41 | const args = { 42 | 'bytesInPerSec': ['kafka_server_broker_topic_metrics_bytesinpersec_rate','[10m:10s]'], 43 | 'bytesOutPerSec': ['kafka_server_broker_topic_metrics_bytesoutpersec_rate','[10m:10s]'], 44 | 'messagesInPerSec': ['kafka_server_broker_topic_metrics_messagesinpersec_rate','[10m:10s]'], 45 | 'jvmHeapUsage': ['kafka_jvm_heap_usage{env="cluster-demo", type="used"}','[10m:10s]'], 46 | 'activeControllerCount': ["sum(kafka_controller_activecontrollercount)",""], 47 | 'underRepPartitions': ['kafka_server_replica_manager_underreplicatedpartitions',''], 48 | 'offlinePartitions': ['kafka_controller_offlinepartitionscount',''], 49 | 'brokersRunning': ['count(kafka_server_brokerstate)',''] 50 | } 51 | 52 | const fetchFunc = async () => { 53 | const fetchObj = {}; 54 | for (const [k, v] of Object.entries(args)) { 55 | fetchObj[k] = await fetchQuery(v[0], v[1]); 56 | } 57 | serverSocket.emit("health", fetchObj); 58 | }; 59 | fetchFunc() 60 | 61 | }); 62 | 63 | test("should work (with ack)", (done) => { 64 | serverSocket.on("hi", (cb) => { 65 | cb("hello"); 66 | }); 67 | clientSocket.emit("hi", (arg) => { 68 | expect(arg).toBe("hello"); 69 | done(); 70 | }); 71 | }); 72 | }); -------------------------------------------------------------------------------- /__tests__/supertest.js: -------------------------------------------------------------------------------- 1 | const { io } = require('socket.io-client'); 2 | const request = require('supertest'); 3 | const {app} = require('../server/server'); 4 | 5 | const client_id = process.env.GITHUB_CLIENT_ID; 6 | const client_secret = process.env.GITHUB_CLIENT_SECRET; 7 | const callback_url = 'http://localhost:4000/auth/github/callback'; 8 | 9 | describe('Route integration', () => { 10 | 11 | describe('/', () => { 12 | describe('GET', () => { 13 | //Testing to ensure server responds with status 200 and text/html content type when a GET request is sent to the main page 14 | it('responds with 200 status and text/html content type', () => { 15 | return request(app) 16 | .get('/') 17 | .expect('Content-Type', /text\/html/) 18 | .expect(200) 19 | }); 20 | }); 21 | }); 22 | 23 | describe('/auth', () => { 24 | describe('GET', () => { 25 | test('should respond with github url', async () => { 26 | const response = await request(app) 27 | .get('/auth/github') 28 | .query({user: 'tester@test.com', oauth: 'testoauth2'}) 29 | // .set('Authorization', `${token}`) 30 | .expect(302) 31 | }) 32 | }) 33 | }) 34 | }); -------------------------------------------------------------------------------- /client/App.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | import { Routes, Route } from 'react-router-dom'; 3 | import axios from 'axios'; 4 | import Landing from './containers/Landing'; 5 | import Notifications from './containers/Notifications'; 6 | import PerfDashboard from './containers/PerfDashboard'; 7 | import HealthDashboard from './containers/HealthDashboard'; 8 | const URL_PARAMS = new URLSearchParams(window.location.search); 9 | const accessToken = URL_PARAMS.get('token'); 10 | 11 | const App = () => { 12 | const [ongoingGate, setongoingGate] = useState(false) 13 | const [ongoingList, setongoingList] = useState([]) 14 | const [active, setActive] = useState('health'); 15 | const [user, setUser] = useState({ 16 | name: '', 17 | id: '', 18 | login: '', 19 | email: '', 20 | }); 21 | 22 | useEffect(() => { 23 | const getGithubUser = async (access_token) => { 24 | const res = await axios.get('https://api.github.com/user', { 25 | headers: { 26 | Authorization: `bearer ${access_token}`, 27 | }, 28 | }); 29 | const userObj = { 30 | name: res.data.name, 31 | id: res.data.id, 32 | login: res.data.login, 33 | email: res.data.emil 34 | }; 35 | setUser(userObj); 36 | }; 37 | if (accessToken) { 38 | getGithubUser(accessToken); 39 | } 40 | }, [accessToken]); 41 | 42 | return ( 43 |
44 | 45 | 49 | } 50 | /> 51 | 55 | } 56 | /> 57 | } 60 | /> 61 | 66 | } 67 | /> 68 | 69 |
70 | ); 71 | }; 72 | 73 | export default App; 74 | -------------------------------------------------------------------------------- /client/assets/CogIcon.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const CogIcon = () => { 4 | return ( 5 | 10 | 15 | 16 | ); 17 | }; 18 | 19 | export default CogIcon; 20 | -------------------------------------------------------------------------------- /client/assets/GraphIcon.jsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | import React from 'react'; 4 | 5 | const GraphIcon = () => { 6 | return ( 7 | 12 | 15 | 16 | ); 17 | } 18 | 19 | export default GraphIcon; 20 | -------------------------------------------------------------------------------- /client/assets/HomeIcon.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const HomeIcon = () => { 4 | return ( 5 | 6 | 7 | 8 | 9 | ); 10 | }; 11 | 12 | 13 | export default HomeIcon; 14 | -------------------------------------------------------------------------------- /client/assets/KafkaPeekLogo.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const KafkaPeekLogo = () => { 4 | return ( 5 | 11 | 16 | 17 | ); 18 | }; 19 | 20 | export default KafkaPeekLogo; 21 | -------------------------------------------------------------------------------- /client/assets/Logout.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Logout = () => { 4 | return ( 5 | 6 | 7 | 8 | 9 | ); 10 | }; 11 | 12 | export default Logout; 13 | -------------------------------------------------------------------------------- /client/assets/UserIcon.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const UserIcon = () => { 4 | return ( 5 | 10 | 15 | 16 | ); 17 | }; 18 | 19 | export default UserIcon; 20 | -------------------------------------------------------------------------------- /client/assets/images/kafkaPeek-demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/KafkaPeek/8e7529f6375fb8170dc300f5e38eac608c9efc13/client/assets/images/kafkaPeek-demo.png -------------------------------------------------------------------------------- /client/assets/images/kafkaPeek-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/KafkaPeek/8e7529f6375fb8170dc300f5e38eac608c9efc13/client/assets/images/kafkaPeek-logo.png -------------------------------------------------------------------------------- /client/components/HealthBinBout.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class HealthBinBout extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ 11 | name: 'Bytes In/sec', 12 | data: props.series 13 | }, { 14 | name: 'Bytes Out/sec', 15 | data: props.series 16 | }], 17 | options: { 18 | chart: { 19 | id: 'realtime', 20 | height: '100%', 21 | width: '100%', 22 | type: 'line', 23 | animations: { 24 | enabled: true, 25 | easing: 'linear', 26 | dynamicAnimation: { 27 | speed: 300, 28 | }, 29 | }, 30 | toolbar: { 31 | show: true, 32 | }, 33 | zoom: { 34 | enabled: false, 35 | }, 36 | }, 37 | dataLabels: { 38 | enabled: false, 39 | }, 40 | stroke: { 41 | curve: 'smooth', 42 | }, 43 | title: { 44 | text: 'Bytes In/sec & Bytes Out/sec', 45 | align: 'left', 46 | }, 47 | 48 | noData: { 49 | text: "CLICK TO GET METRICS...", 50 | }, 51 | 52 | markers: { 53 | size: 0, 54 | hover: { 55 | size: 0 56 | } 57 | }, 58 | 59 | xaxis: { 60 | type: 'datetime', 61 | range: 600000, 62 | }, 63 | yaxis: { 64 | min: 0, 65 | max: 2500, 66 | decimalsInFloat: 2, 67 | opposite: true, 68 | labels: { 69 | offsetX: -10 70 | } 71 | }, 72 | legend: { 73 | show: true, 74 | floating: true, 75 | horizontalAlign: 'left', 76 | onItemClick: { 77 | toggleDataSeries: false 78 | }, 79 | position: 'top', 80 | offsetY: -20, 81 | offsetX: 300 82 | }, 83 | 84 | }, 85 | }; 86 | } 87 | 88 | render() { 89 | return ( 90 |
91 | 98 |
99 | ); 100 | } 101 | } 102 | 103 | export default HealthBinBout; 104 | -------------------------------------------------------------------------------- /client/components/HealthJVM.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class HealthJVM extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ data: props.series }], 11 | options: { 12 | chart: { 13 | id: 'realtime', 14 | height: '100%', 15 | width: '100%', 16 | type: 'line', 17 | animations: { 18 | enabled: true, 19 | easing: 'linear', 20 | dynamicAnimation: { 21 | speed: 300, 22 | }, 23 | }, 24 | toolbar: { 25 | show: true, 26 | }, 27 | zoom: { 28 | enabled: false, 29 | }, 30 | }, 31 | dataLabels: { 32 | enabled: false, 33 | }, 34 | stroke: { 35 | curve: 'smooth', 36 | }, 37 | title: { 38 | text: 'JVM Heap Usage MB', 39 | align: 'left', 40 | }, 41 | 42 | markers: { 43 | size: 0, 44 | hover: { 45 | size: 0 46 | } 47 | }, 48 | 49 | xaxis: { 50 | type: 'datetime', 51 | range: 600000, 52 | }, 53 | yaxis: { 54 | min: 0, 55 | max: 1500, 56 | decimalsInFloat: 2, 57 | opposite: true, 58 | labels: { 59 | offsetX: -10 60 | } 61 | }, 62 | legend: { 63 | show: true, 64 | floating: true, 65 | horizontalAlign: 'left', 66 | onItemClick: { 67 | toggleDataSeries: false 68 | }, 69 | position: 'top', 70 | offsetY: -20, 71 | offsetX: 300 72 | }, 73 | 74 | }, 75 | }; 76 | } 77 | 78 | render() { 79 | return ( 80 |
81 | 88 |
89 | ); 90 | } 91 | } 92 | 93 | export default HealthJVM; 94 | -------------------------------------------------------------------------------- /client/components/HealthMsgIn.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class HealthMsgIn extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ data: props.series }], 11 | options: { 12 | chart: { 13 | id: 'realtime', 14 | height: '100%', 15 | width: '100%', 16 | type: 'line', 17 | animations: { 18 | enabled: true, 19 | easing: 'linear', 20 | dynamicAnimation: { 21 | speed: 300, 22 | }, 23 | }, 24 | toolbar: { 25 | show: true, 26 | }, 27 | zoom: { 28 | enabled: false, 29 | }, 30 | }, 31 | dataLabels: { 32 | enabled: false, 33 | }, 34 | stroke: { 35 | curve: 'smooth', 36 | }, 37 | title: { 38 | text: 'Messages In Per Second', 39 | align: 'left', 40 | }, 41 | 42 | markers: { 43 | size: 0, 44 | hover: { 45 | size: 0 46 | } 47 | }, 48 | 49 | xaxis: { 50 | type: 'datetime', 51 | range: 600000, 52 | }, 53 | yaxis: { 54 | min: 0, 55 | max: 300, 56 | decimalsInFloat: 2, 57 | opposite: true, 58 | labels: { 59 | offsetX: -10 60 | } 61 | }, 62 | legend: { 63 | show: true, 64 | floating: true, 65 | horizontalAlign: 'left', 66 | onItemClick: { 67 | toggleDataSeries: false 68 | }, 69 | position: 'top', 70 | offsetY: -20, 71 | offsetX: 300 72 | }, 73 | 74 | }, 75 | }; 76 | } 77 | 78 | render() { 79 | return ( 80 |
81 | 88 |
89 | ); 90 | } 91 | } 92 | 93 | export default HealthMsgIn; 94 | -------------------------------------------------------------------------------- /client/components/PerfReqPerSec.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class PerfReqPerSec extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ data: props.series }], 11 | options: { 12 | chart: { 13 | id: 'realtime', 14 | height: '100%', 15 | width: '100%', 16 | type: 'line', 17 | animations: { 18 | enabled: true, 19 | easing: 'linear', 20 | dynamicAnimation: { 21 | speed: 300, 22 | }, 23 | }, 24 | toolbar: { 25 | show: true, 26 | }, 27 | zoom: { 28 | enabled: false, 29 | }, 30 | }, 31 | dataLabels: { 32 | enabled: false, 33 | }, 34 | stroke: { 35 | curve: 'smooth', 36 | }, 37 | title: { 38 | text: 'Requests Per Second', 39 | align: 'left', 40 | }, 41 | 42 | markers: { 43 | size: 0, 44 | hover: { 45 | size: 0 46 | } 47 | }, 48 | 49 | xaxis: { 50 | type: 'datetime', 51 | range: 600000, 52 | }, 53 | yaxis: { 54 | min: 0, 55 | max: 300, 56 | decimalsInFloat: 2, 57 | opposite: true, 58 | labels: { 59 | offsetX: -10 60 | } 61 | }, 62 | legend: { 63 | show: true, 64 | floating: true, 65 | horizontalAlign: 'left', 66 | onItemClick: { 67 | toggleDataSeries: false 68 | }, 69 | position: 'top', 70 | offsetY: -20, 71 | offsetX: 300 72 | }, 73 | 74 | }, 75 | }; 76 | } 77 | 78 | render() { 79 | return ( 80 |
81 | 88 |
89 | ); 90 | } 91 | } 92 | 93 | export default PerfReqPerSec; 94 | -------------------------------------------------------------------------------- /client/components/PerfReqTotalTime.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class PerfReqTotalTime extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ 11 | name: 'Mean', 12 | data: props.series 13 | }, { 14 | name: '99th Percentile', 15 | data: props.series 16 | }, { 17 | name: '75th Percentile', 18 | data: props.series 19 | }], 20 | options: { 21 | chart: { 22 | id: 'realtime', 23 | height: '100%', 24 | width: '100%', 25 | type: 'line', 26 | animations: { 27 | enabled: true, 28 | easing: 'linear', 29 | dynamicAnimation: { 30 | speed: 300, 31 | }, 32 | }, 33 | toolbar: { 34 | show: true, 35 | }, 36 | zoom: { 37 | enabled: false, 38 | }, 39 | }, 40 | dataLabels: { 41 | enabled: false, 42 | }, 43 | stroke: { 44 | curve: 'smooth', 45 | }, 46 | title: { 47 | text: 'Request Total Time', 48 | align: 'left', 49 | }, 50 | 51 | noData: { 52 | text: "CLICK TO GET METRICS...", 53 | }, 54 | 55 | markers: { 56 | size: 0, 57 | hover: { 58 | size: 0 59 | } 60 | }, 61 | 62 | xaxis: { 63 | type: 'datetime', 64 | range: 600000, 65 | }, 66 | yaxis: { 67 | min: 2, 68 | max: 6, 69 | decimalsInFloat: 2, 70 | opposite: true, 71 | labels: { 72 | offsetX: -10 73 | } 74 | }, 75 | legend: { 76 | show: true, 77 | floating: true, 78 | horizontalAlign: 'left', 79 | onItemClick: { 80 | toggleDataSeries: false 81 | }, 82 | position: 'top', 83 | offsetY: -20, 84 | offsetX: 300 85 | }, 86 | 87 | }, 88 | }; 89 | } 90 | 91 | render() { 92 | return ( 93 |
94 | 101 |
102 | ); 103 | } 104 | } 105 | 106 | export default PerfReqTotalTime; 107 | -------------------------------------------------------------------------------- /client/components/PerfResQueueTime.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | class PerfResQueueTime extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | 8 | this.state = { 9 | series: [{ data: props.series }], 10 | options: { 11 | chart: { 12 | id: 'realtime', 13 | height: '100%', 14 | width: '100%', 15 | type: 'line', 16 | animations: { 17 | enabled: true, 18 | easing: 'linear', 19 | dynamicAnimation: { 20 | speed: 300, 21 | }, 22 | }, 23 | toolbar: { 24 | show: true, 25 | }, 26 | zoom: { 27 | enabled: false, 28 | }, 29 | }, 30 | dataLabels: { 31 | enabled: false, 32 | }, 33 | stroke: { 34 | curve: 'smooth', 35 | }, 36 | title: { 37 | text: 'Response Queue Time (ms)', 38 | align: 'left', 39 | }, 40 | 41 | markers: { 42 | size: 0, 43 | hover: { 44 | size: 0 45 | } 46 | }, 47 | 48 | xaxis: { 49 | type: 'datetime', 50 | range: 600000, 51 | }, 52 | yaxis: { 53 | min: 0.0001, 54 | max: 4, 55 | decimalsInFloat: 2, 56 | opposite: true, 57 | labels: { 58 | offsetX: -10 59 | } 60 | }, 61 | legend: { 62 | show: true, 63 | floating: true, 64 | horizontalAlign: 'left', 65 | onItemClick: { 66 | toggleDataSeries: false 67 | }, 68 | position: 'top', 69 | offsetY: -20, 70 | offsetX: 300 71 | }, 72 | 73 | }, 74 | }; 75 | } 76 | 77 | render() { 78 | return ( 79 |
80 | 87 |
88 | ); 89 | } 90 | } 91 | 92 | export default PerfResQueueTime; 93 | -------------------------------------------------------------------------------- /client/components/PerfResSendTime.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactApexChart from 'react-apexcharts'; 4 | 5 | class PerfResSendTime extends React.Component { 6 | constructor(props) { 7 | super(props); 8 | 9 | this.state = { 10 | series: [{ data: props.series }], 11 | options: { 12 | chart: { 13 | id: 'realtime', 14 | height: '100%', 15 | width: '100%', 16 | type: 'line', 17 | animations: { 18 | enabled: true, 19 | easing: 'linear', 20 | dynamicAnimation: { 21 | speed: 300, 22 | }, 23 | }, 24 | toolbar: { 25 | show: true, 26 | }, 27 | zoom: { 28 | enabled: false, 29 | }, 30 | }, 31 | dataLabels: { 32 | enabled: false, 33 | }, 34 | stroke: { 35 | curve: 'smooth', 36 | }, 37 | title: { 38 | text: 'Response Send Time (ms)', 39 | align: 'left', 40 | }, 41 | 42 | markers: { 43 | size: 0, 44 | hover: { 45 | size: 0 46 | } 47 | }, 48 | 49 | xaxis: { 50 | type: 'datetime', 51 | range: 600000, 52 | }, 53 | yaxis: { 54 | min: 0.0001, 55 | max: 2, 56 | decimalsInFloat: 2, 57 | opposite: true, 58 | labels: { 59 | offsetX: -10 60 | } 61 | }, 62 | legend: { 63 | show: true, 64 | floating: true, 65 | horizontalAlign: 'left', 66 | onItemClick: { 67 | toggleDataSeries: false 68 | }, 69 | position: 'top', 70 | offsetY: -20, 71 | offsetX: 300 72 | }, 73 | 74 | }, 75 | }; 76 | } 77 | 78 | render() { 79 | return ( 80 |
81 | 88 |
89 | ); 90 | } 91 | } 92 | 93 | export default PerfResSendTime; 94 | -------------------------------------------------------------------------------- /client/components/StaticMetricDisplay.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const StaticMetricDisplay = ({ metric, title, container }) => { 4 | return ( 5 |
6 | {title} 7 |
{metric}
8 |
9 | ); 10 | } 11 | 12 | export default StaticMetricDisplay; 13 | -------------------------------------------------------------------------------- /client/components/notificationComponents/BytesInPer.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Select from 'react-select' 3 | 4 | 5 | const BytesInPer = ({bytesInFunc}) => { 6 | 7 | const intervals = [ 8 | { value: {thresholdNumber: "1600", thresholdLabel: "BytesIn PerSec"}, label: "> 1600" }, 9 | { value: {thresholdNumber: "1900", thresholdLabel: "BytesIn PerSec"}, label: "> 1900" }, 10 | { value: {thresholdNumber: "2200", thresholdLabel: "BytesIn PerSec"}, label: "> 2200" }, 11 | { value: {thresholdNumber: "2600", thresholdLabel: "BytesIn PerSec"}, label: "> 2600" } 12 | ]; 13 | 14 | const onChange = async selectedOption => { 15 | await setMetric(selectedOption); 16 | }; 17 | 18 | return ( 19 |
20 |

BytesIn

21 |

Network throughput can affect Kafka’s performance if you are sending messages across data centers, if your topics have a large number of consumers, or if your replicas are catching up to their leaders. Tracking network throughput on your brokers gives you more information as to where potential bottlenecks may lie, and can inform decisions like whether or not you should enable end-to-end compression of your messages. 22 | The following options are thresholds that you can pick from for your BytesInPerSec Metric. 23 |

24 |
25 |
26 | 27 |
28 |
29 |
30 | ); 31 | } 32 | 33 | export default BytesOutPer; -------------------------------------------------------------------------------- /client/components/notificationComponents/OfflinePart.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Select from 'react-select' 3 | 4 | 5 | const OfflinePart = () => { 6 | 7 | return ( 8 |

Offline Partitions

9 |

10 | The Offline Partitions metric displays the number of partitions that do not have an active leader. 11 | The two most common causes of offline partitions are when all brokers hosting replicas for a partition are down, or when no in-sync replicas can become a partition leader due to a mismatch in message counts between the replicas. 12 | This is a critical metric, as any partitions that are offline (ie. without a leader) will not be accessible since read and write operations are only performed on the leader of a partition. 13 |

14 |
15 |
16 | Expected threshold is anything over 0. 17 |
18 |
19 |
20 | ); 21 | } 22 | 23 | export default OfflinePart; -------------------------------------------------------------------------------- /client/components/notificationComponents/OngoingMetrics.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Select from 'react-select' 3 | 4 | 5 | const OngoingMetrics = ({ongoingList}) => { 6 | 7 | return ( 8 |
9 |

ONGOING METRICS

10 |
11 | 14 |
15 |
16 | ); 17 | } 18 | 19 | export default OngoingMetrics; -------------------------------------------------------------------------------- /client/components/notificationComponents/UnderRep.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Select from 'react-select' 3 | 4 | 5 | const UnderRep = () => { 6 | 7 | return ( 8 |

Under Replicated Partitions

9 |

10 | In a healthy cluster, the number of in sync replicas (ISRs) should be exactly equal to the total number of replicas. 11 | If partition replicas fall too far behind their leaders, the follower partition is removed from the ISR pool, and you should see a corresponding increase in IsrShrinksPerSec. 12 | If a broker becomes unavailable, the value of UnderReplicatedPartitions will increase sharply. 13 | Since Kafka’s high-availability guarantees cannot be met without replication, investigation is certainly warranted should this metric value exceed zero for extended time periods. 14 | 15 |

16 |
17 |
18 | Expected threshold is anything over 0. 19 |
20 |
21 |
22 | ); 23 | } 24 | 25 | export default UnderRep; -------------------------------------------------------------------------------- /client/containers/Header.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import KafkaPeekLogo from '../assets/KafkaPeekLogo'; 4 | 5 | const Header = ({ user }) => { 6 | const { id } = user; 7 | 8 | const signinButton = ( 9 | 14 | ); 15 | 16 | const dashboardButton = ( 17 | 20 | ); 21 | 22 | return ( 23 |
24 |
25 | 26 | KafkaPeek 27 |
28 |
29 | 34 | 39 |
40 |
{id == '' || id == null ? signinButton : dashboardButton}
41 |
42 | ); 43 | }; 44 | 45 | export default Header; 46 | -------------------------------------------------------------------------------- /client/containers/HealthDashboard.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect, useRef } from 'react'; 2 | import { io } from "socket.io-client"; 3 | import Sidebar from './Sidebar'; 4 | import HealthBinBout from '../components/HealthBinBout'; 5 | import HealthJVM from '../components/HealthJVM'; 6 | import HealthMsgIn from '../components/HealthMsgIn'; 7 | import StaticMetricDisplay from '../components/StaticMetricDisplay'; 8 | 9 | const socket = io('http://localhost:4000', { 10 | autoConnect: false 11 | }); 12 | 13 | export const params = { 14 | 'bytesInPerSec': ['kafka_server_broker_topic_metrics_bytesinpersec_rate', '[10m:10s]'], 15 | 'bytesOutPerSec': ['kafka_server_broker_topic_metrics_bytesoutpersec_rate', '[10m:10s]'], 16 | 'messagesInPerSec': ['kafka_server_broker_topic_metrics_messagesinpersec_rate', '[10m:10s]'], 17 | 'jvmHeapUsage': ['kafka_jvm_heap_usage{env="cluster-demo", type="used"}', '[10m:10s]'], 18 | 'activeControllerCount': ["sum(kafka_controller_activecontrollercount)", ""], 19 | 'underRepPartitions': ['kafka_server_replica_manager_underreplicatedpartitions', ''], 20 | 'offlinePartitions': ['kafka_controller_offlinepartitionscount', ''], 21 | 'brokersRunning': ['count(kafka_server_brokerstate)', ''] 22 | } 23 | 24 | const emitFunc = () => { 25 | socket.emit('health', params) 26 | } 27 | 28 | const stopFunc = () => { 29 | socket.emit('stop'); 30 | } 31 | 32 | const HealthDashboard = ({ active, setActive}) => { 33 | let startMetric = useRef(false); 34 | const [buttonText, setButtonText] = useState('Get Metrics'); 35 | 36 | // dynamic metrics 37 | const [bytesIn, setBytesIn] = useState([]); 38 | const [bytesOut, setBytesOut] = useState([]); 39 | const [msgsIn, setMsgsIn] = useState([]); 40 | const [jvmUsage, setJvmUsage] = useState([]); 41 | 42 | // static metrics 43 | const [activeControllerCount, setActiveControllerCount] = useState(0); 44 | const [offlinePartitions, setOfflinePartitions] = useState(0); 45 | const [underReplicatedPartitions, setUnderReplicatedPartitions] = useState(0); 46 | const [brokersRunning, setBrokersRunning] = useState(0); 47 | 48 | const handleClick = () => { 49 | if (!startMetric.current) { 50 | socket.connect() 51 | emitFunc(); 52 | setButtonText('Pause') 53 | startMetric.current = !startMetric.current; 54 | } else { 55 | stopFunc(); 56 | setButtonText('Get Metrics') 57 | startMetric.current = !startMetric.current; 58 | } 59 | }; 60 | 61 | const handleHealthDisconnect = () => { 62 | socket.disconnect() 63 | } 64 | 65 | useEffect(() => { 66 | socket.on('health', (data) => { 67 | if (data.bytesInPerSec) setBytesIn(currentData => [...currentData, ...data.bytesInPerSec]) 68 | if (data.bytesOutPerSec) setBytesOut(currentData => [...currentData, ...data.bytesOutPerSec]); 69 | if (data.messagesInPerSec) setMsgsIn(currentData => [...currentData, ...data.messagesInPerSec]); 70 | if (data.jvmHeapUsage) setJvmUsage(currentData => [...currentData, ...data.jvmHeapUsage]); 71 | if (data.activeControllerCount) setActiveControllerCount(data.activeControllerCount); 72 | if (data.offlinePartitions) setOfflinePartitions(data.offlinePartitions); 73 | if (data.underRepPartitions) setUnderReplicatedPartitions(data.underRepPartitions); 74 | if (data.brokersRunning) setBrokersRunning(data.brokersRunning); 75 | }) 76 | }, []); 77 | 78 | return ( 79 |
80 | 81 |
82 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
93 |
94 | ); 95 | }; 96 | 97 | export default HealthDashboard; 98 | -------------------------------------------------------------------------------- /client/containers/Landing.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link, useNavigate } from 'react-router-dom'; 3 | import Header from './Header'; 4 | 5 | const Landing = ({ user }) => { 6 | const navigate = useNavigate(); 7 | 8 | if (user.name !== '' || user.name !== null) { 9 | window.history.replaceState({}, document.title, "/" + `${user.login}`); 10 | navigate("/h_dashboard"); 11 | } 12 | 13 | return ( 14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 |
22 |
23 |

24 | Keep a keen eye on your 25 |
26 | Kafka clusters 27 |

28 |

29 | {' '} 30 | KafkaPeek helps engineering teams of all sizes quickly and easily stay up 31 | to date on the status of deployments 32 |

33 | 34 | 35 | 36 |
37 |
38 | ); 39 | }; 40 | 41 | export default Landing; 42 | -------------------------------------------------------------------------------- /client/containers/Notifications.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Sidebar from './Sidebar'; 3 | import Select from 'react-select' 4 | import { useState, useEffect, useRef } from 'react'; 5 | import axios from 'axios' 6 | import BytesInPer from '../components/notificationComponents/BytesInPer.jsx'; 7 | import BytesOutPer from '../components/notificationComponents/BytesOutPer.jsx' 8 | import OfflinePart from '../components/notificationComponents/OfflinePart.jsx'; 9 | import UnderRep from '../components/notificationComponents/UnderRep'; 10 | import OngoingMetrics from '../components/notificationComponents/OngoingMetrics.jsx'; 11 | 12 | 13 | const Notifications = ({ active, setActive, user, ongoingGate, setongoingGate, ongoingList, setongoingList }) => { 14 | // axios gate 15 | const [gate, setGate] = useState(false) 16 | 17 | // renders user selections 18 | const [displayedMetric, setdisplayedMetric] = useState() 19 | 20 | // final render component that will be displayed 21 | const [displayedComponent, setdisplayedComponent] = useState() 22 | 23 | // displayed value metric 24 | const [metric, setMetric] = useState(); 25 | 26 | // ongoing notifications 27 | const [ongoingMetrics, setongoingMetrics] = useState({ 28 | bytesInPerSec: false, 29 | bytesOutPerSec: false, 30 | offlinePartitions: false, 31 | underRepPartitions: false 32 | }) 33 | 34 | // bytesIn (state, func) 35 | const [bytesInterval, setbytesInterval] = useState(); 36 | function bytesInFunc(interval) { 37 | setGate(true) 38 | setbytesInterval(interval.value.thresholdNumber) 39 | setdisplayedMetric([ 40 |
41 |
42 | {`${interval.value.thresholdLabel} `} 43 | {`Anything over: ${interval.value.thresholdNumber}`} 44 |
45 |
]) 46 | } 47 | 48 | // bytesOut (state, func) 49 | function bytesOutFunc(interval) { 50 | setGate(true) 51 | setbytesInterval(interval.value.thresholdNumber) 52 | setdisplayedMetric([ 53 |
54 |
55 | {`${interval.value.thresholdLabel} `} 56 | {`Anything over: ${interval.value.thresholdNumber}`} 57 |
58 |
]) 59 | } 60 | 61 | const subComponents = { 62 | bytesInPerSec: [], 63 | bytesOutPerSec: [], 64 | offlinePartitions: [], 65 | underRepPartitions: [] 66 | } 67 | 68 | // select-react 69 | const metrics = [ 70 | { value: "bytesInPerSec", label: "BytesIn PerSec", }, 71 | { value: "bytesOutPerSec", label: "BytesOut PerSec" }, 72 | { value: "offlinePartitions", label: "Offline Partitions" }, 73 | { value: "underRepPartitions", label: "Under Replicated Partitions" } 74 | ]; 75 | 76 | const onChange = async selectedOption => { 77 | await setMetric(selectedOption); 78 | const currentNode = subComponents[selectedOption.value] 79 | const currentMetric = selectedOption.label 80 | let threshold; 81 | if (currentMetric === "Offline Partitions" || currentMetric === "Under Replicated Partitions") { 82 | threshold = 0 83 | setGate(true) 84 | setbytesInterval(threshold) 85 | setdisplayedMetric([ 86 |
87 |
88 | {`${selectedOption.label} `} 89 | {`Anything over: ${threshold}`} 90 |
91 |
]) 92 | } else { 93 | setGate(false) 94 | setdisplayedMetric([ 95 |
96 |
97 | {`${selectedOption.label} `} 98 |
99 |
]) 100 | } 101 | await setdisplayedComponent(currentNode) 102 | }; 103 | 104 | // sends message to slack 105 | const trackMetrics = async () => { 106 | if (gate) { 107 | const compared = metric.value; 108 | if (!ongoingMetrics[compared]) { 109 | const objectToSend = Object.assign({}, metric, { name: user.name }, { threshold: bytesInterval }) 110 | await axios.post("http://localhost:4000/auth/form-submit", objectToSend) 111 | .then(({ data }) => { 112 | console.log(data) 113 | }) 114 | .catch(err => { 115 | console.error(err.toJSON()); 116 | }); 117 | const newOngoing = [...ongoingList] 118 | newOngoing.push(
  • {`${metric.label}`} {' > '} {`${bytesInterval}`}

  • ) 119 | setongoingList(newOngoing) 120 | ongoingMetrics[compared] = true 121 | setongoingGate(true) 122 | return 123 | } else { 124 | alert('You already have that metric') 125 | return 126 | } 127 | } else { 128 | alert('Please choose a threshold to track') 129 | return 130 | } 131 | } 132 | 133 | return ( 134 |
    135 | 136 |
    137 |
    138 |

    Set up Slack Notifications

    139 |
    140 |
    141 |