如何使用Rollbar缩短团队的调试时间

Real-world debugging

This article was sponsored by Rollbar. Thank you for supporting the sponsors who make SitePoint possible.

本文由Rollbar赞助。 感谢您支持使SitePoint成为可能的赞助商。

As a SitePoint reader, you write perfect error-free code on every project…

作为SitePoint阅读器,您可以在每个项目上编写完美的无错误代码。

But can you say the same for every member of your team?

但是您能对团队中的每个成员说同样的话吗?

The more sophisticated your product, the larger your team and the more bugs you’ll discover. You may have robust testing procedures, but can you be sure the latest edition of your framework is error-free? What about third-party modules, databases and components? Is the language or runtime perfect? Are you certain about the underlying deployment Operating System? Can the whole stack be considered fool-proof for the most foolish of users?!

您的产品越复杂,您的团队就越大,您将发现更多的错误。 您可能具有健全的测试程序,但是可以确定最新版本的框架没有错误吗? 第三方模块,数据库和组件呢? 语言或运行时是否完美? 您是否确定基础部署操作系统? 对于最愚蠢的用户,整个堆栈是否可以视为傻瓜?

Understanding that errors are inevitable is the first step. The considerably more complex second step is recording errors, tracking frequencies, prioritizing issues, coding a solution, testing the fixes and deploying to a live server. Without careful management, teams can spend longer fixing bugs than writing new code.

第一步是要了解错误是不可避免的。 第二步要复杂得多,这是记录错误,跟踪频率,确定问题的优先级,编码解决方案,测试修补程序并部署到实时服务器。 没有仔细的管理,与编写新代码相比,团队可能花费更多的时间来修复错误。

Fortunately, Rollbar can drastically reduce debugging time and costs. The service is trusted by companies such as Heroku, Walmart, LogMeIn, Lyft, Twitch and Intuit to centrally manage critical errors on web sites, web applications, mobile and desktop apps.

幸运的是, Rollbar可以大大减少调试时间和成本。 该服务受到 Heroku,Walmart,LogMeIn,Lyft,Twitch和Intuit等公司的信任,可以集中管理网站,Web应用程序,移动和桌面应用程序上的严重错误。

At the time of writing, Rollbar has logged almost 13 billion errors (and that’s just my shoddy code!).

在撰写本文时, Rollbar已记录了将近130亿个错误(那只是我的伪劣代码!)

调试Rollbar方式 (Debugging the Rollbar Way)

Rollbar unites your tools into one seamless error-handling workflow. A few minutes of set-up can save considerable effort over the longer term.

Rollbar将您的工具组合到一个无缝的错误处理工作流程中 。 从长远来看,几分钟的设置可以节省大量的精力。

1.注册 (1. Sign Up)

Sign up from the Rollbar home page for an initial free trial. You can use an email address or link your GitHub account.

Rollbar主页注册以进行初始免费试用。 您可以使用电子邮件地址或链接您的GitHub帐户。

A quick set-up guide runs the first time you log in.

首次登录时,将运行快速设置指南。

2.创建一个新项目 (2. Create a New Project)

Enter a project name and choose from one of the many languages and frameworks. All popular mobile, desktop and web back and front-end platforms are available.

输入项目名称,然后从多种语言和框架中选择一种。 所有流行的移动,桌面和Web后端和前端平台均可用。

Create a New Project

On creation, your project is assigned a unique access token which identifies all messages sent to the Rollbar system.

创建后,将为您的项目分配一个唯一的访问令牌,该令牌标识发送到Rollbar系统的所有消息。

3.将Rollbar集成到您的项目中 (3. Integrate Rollbar into Your Project)

Integration will vary according to your project’s language. For PHP, you can install a Rollbar component using Composer or by downloading two files. Include rollbar.php, initialize and send a test message:

集成将根据您项目的语言而有所不同。 对于PHP,可以使用Composer或下载两个文件来安装Rollbar组件 。 包括rollbar.php,初始化并发送测试消息:

<?php
// include Rollbar component
require_once 'rollbar.php';

// initialize Rollbar
Rollbar::init(array('access_token' => 'your-project-token'));

// send a test message
Rollbar::report_message('testing 123', 'info');

You can then add one or more exception handlers to capture all errors:

然后,您可以添加一个或多个异常处理程序以捕获所有错误:

// catch exception and send to Rollbar
try {
  throw new Exception('test exception');
} catch (Exception $e) {
  Rollbar::report_exception($e);
}

For Node.js Express projects, you can install the Rollbar module using npm:

对于Node.js Express项目,可以使用npm安装Rollbar模块:

npm install --save rollbar

Then add Rollbar error-handling middleware:

然后添加Rollbar错误处理中间件:

var 
  rollbar = require('rollbar'),
  express = require('express'),
  app = express();

// Rollbar middleware
app.use(rollbar.errorHandler('your-project-token'));

// basic route
app.get('/', function (req, res) {
  res.send('Hello World!');
});

// start server
app.listen(3000);

Rollbar provides notification libraries for Android, Clojure, ColdFusion, Dart, Erlang, Flash, Go, Haskell, iOS, Java, JavaScript (client), .NET, Node.js, PHP, Python, Ruby and web server logs. Alternatively, you can use the fully documented RESTful API for other languages.

Rollbar为Android,Clojure,ColdFusion,Dart,Erlang,Flash,Go,Haskell,iOS,Java,JavaScript(客户端)、. NET,Node.js,PHP,Python,Ruby和Web服务器日志提供通知库。 另外,您可以将完整记录的RESTful API用于其他语言。

4.访问您的Rollbar仪表板 (4. Access Your Rollbar Dashboard)

The Rollbar dashboard provides a live overview of all errors with the frequency of occurrence:

Rollbar仪表板提供了所有错误的实时概述以及发生的频率:

Access Your Rollbar Dashboard

You can analyze individual issues to:

您可以分析单个问题以:

  • track the users, devices and browsers affected

    跟踪受影响的用户,设备和浏览器
  • locate similar or related errors

    找到类似或相关的错误
  • discuss the issues with other team members, and

    与其他团队成员讨论问题,以及
  • replay web service calls to reproduce the same error.

    重播Web服务调用以重现相同的错误。

From the Settings panel you can also:

在“ 设置”面板中,您还可以:

  • add further team collaborators

    添加其他团队合作者
  • apply grouping rules to reduce noise, and

    应用分组规则以减少噪音,以及
  • connect other services…

    连接其他服务…

5.连接其他服务 (5. Connect Other Services)

Team members will have differing notification and issue-tracking preferences. Rollbar allows you send alerts and tasks via a range of popular channels including email, GitHub issues, BitBucket issues, JIRA, Pivotal Tracker, Trello, PagerDuty, Slack and more:

团队成员将具有不同的通知和问题跟踪首选项。 Rollbar允许您通过一系列受欢迎的渠道发送警报和任务,包括电子邮件,GitHub问题,BitBucket问题,JIRA,Pivotal Tracker,Trello,PagerDuty,Slack等:

Connect Other Services

You can assign a developer to a task from the dashboard and know it has been updated in their bug-tracking tool of choice.

您可以从仪表板向开发人员分配任务,并在其所选的错误跟踪工具中知道该任务已更新。

6.修复和部署 (6. Fix and Deploy)

Finally, Rollbar can be integrated with deployment platforms such as Heroku, Capistrano, Engine Yard and Fabric. Rollbar monitors the deployed fixes and marks issues as “resolved” on all connected services.

最后,Rollbar可以与部署平台集成,例如Heroku,Capistrano,Engine Yard和Fabric。 Rollbar监视已部署的修补程序,并将所有连接的服务上的问题标记为“已解决”。

Not every fix goes to plan, so Rollbar will alert you immediately whenever a historical regression occurs.

并非所有修复计划都如期进行,因此Rollbar会在发生历史回归时立即提醒您。

滚动条主要功能 (Key Rollbar Features)

Rollbar supports:

Rollbar支持:

  • a wide range of languages and frameworks

    多种语言和框架
  • all popular messaging systems

    所有流行的消息传递系统
  • the most-used deployment platforms

    最常用的部署平台
  • instant error reporting

    即时错误报告
  • installation on your own premises

    在自己的场所安装
  • guaranteed privacy

    保证隐私

Should you need more convincing…

如果您需要更令人信服的…

轻松整合 (Easy Integration)

Rollbar can be integrated into your web, desktop or mobile application in minutes. It’ll be quicker than it took to read this article!

Rollbar可以在数分钟内集成到您的Web,桌面或移动应用程序中。 它比阅读本文要快!

优秀的文档 (Excellent Documentation)

I wish all documentation was as good as Rollbar’s! The guides are well-organized, concise and provide plenty of examples in all languages.

我希望所有文档都和Rollbar一样好! 指南井井有条,简洁明了,并提供了所有语言的大量示例。

The RESTful API guide is essential should you need to support another language or integrate your services with Rollbar.

如果您需要支持另一种语言或将服务与Rollbar集成,则RESTful API指南至关重要。

快速和高级搜索 (Quick and Advanced Search)

The Rollbar dashboard offers quick searching options but, if that’s not enough, you can use the new Rollbar Query Language (RQL) — an SQL-like syntax for running queries on your Rollbar data.

Rollbar仪表板提供快速搜索选项,但如果还不够,您可以使用新的Rollbar查询语言(RQL) —一种类似于SQL的语法,用于在Rollbar数据上运行查询。

JavaScript源地图 (JavaScript Source Maps)

Errors are reported from your production systems, which may (or should) be hosting minified versions of your client-side JavaScript files. Minification can rename function names and renumber lines. Rollbar allows you to upload associated JavaScript source maps which ensures messages are identified with the original, uncompressed source code.

错误是从生产系统报告的,生产系统可能(或应该)托管客户端JavaScript文件的缩小版本。 缩小可以重命名函数名称并重新编号行。 使用Rollbar,您可以上传关联的JavaScript源映射 ,以确保使用未经压缩的原始源代码标识消息。

具有成本效益 (Cost Effective)

Rollbar is free for personal projects and prototypes. Pricing is based on the number of events raised per monthregardless of team size. Adding another collaborator costs nothing.

Rollbar对于个人项目和原型是免费的。 定价基于每月引发的事件数 - 与团队规模无关 。 添加另一个协作者不会花费任何费用。

The average Rollbar team has 30 developers but the system can scale to projects of unlimited sizes.

Rollbar团队平均每个团队有30个开发人员,但是系统可以扩展到无限大小的项目。

节省团队时间 (Team Time Saving)

The biggest benefit: Rollbar saves considerable time. Team members have a central location which collates all reported errors and distributes tasks to whichever messaging and bug-tracking system they prefer.

最大的好处: Rollbar节省了大量时间 。 团队成员位于中心位置,可以整理所有报告的错误并将任务分配到他们喜欢的任何消息传递和错误跟踪系统。

Sign-up for Rollbar today — there’s a fully-featured, no-obligation 14-day trial period which requires no credit card or initial payment. You’ll soon wonder how you developed without Rollbar.

立即注册Rollbar-有功能齐全,无义务的14天试用期,无需信用卡或首次付款。 您很快就会想知道没有Rollbar怎么发展。

翻译自: https://www.sitepoint.com/how-to-improve-your-teams-debugging-times-with-rollbar/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
if(!empty($data)){ if($data['LEVEL'] == 'Level 11' || $data['LEVEL'] == 'Level 10A' || $data['LEVEL'] == 'Level 10B'){ $hsg_action=array('更換SPK模組','拆SPK模組,更換Dock screw','拆SPK模組,更換SPK module screw','拆SPK模組,取出螺絲/異物/Shim','更換SPK模組(OK2Repair)','更換Supervent模組','更換Supervent模組(OK2Repair)','更換E75 seal','更換Meru O-ring','更換Vent seal','更換HB O-Ring','(同)更換Hold BTN&UAT2 flex','(同)更換HSG','拆Dock flex,取出螺絲/異物/Shim','拆UAT2 flex,取出螺絲/異物/Shim','拆Vol BTN flex,取出螺絲/異物/shim','更換Dock flex','更換Dock flex(報廢,SQE原材不良)','更換Dock flex(報廢,制程不良)','更換Hold BTN','更換Hold BTN BKT','更換Vol BTN flex','更換Hold BTN flex','更換Hold BTN rollbar','更換Hold BTN&UAT2 flex','更換HSG','更換HSG(報廢)','更換HSG(報廢,SQE原材不良)','更換HSG(報廢,制程不良)','更換Mic1','更換Mic1 seal','更換Mic3','更換Mic3 seal','更換Mic4','更換Mic4 seal','更換Ringer BTN','更換RS/VB screw washer','更換UAT2 flex','更換Vol BTN flex','更換Vol BTN rollbar','更換Volume BTN','更換Hold BTN flex(OK2Repair)','更換HSG(OK2Repair)'); $FA_action = array(); foreach($hsg_action as $k){ $FA_action[] = "炸機(".$k.")"; } $cos_action = array(); foreach($hsg_action as $v){ $cos_action[] = "(外)".$v; } $hsg_action = array_merge($hsg_action,$FA_action,$cos_action); foreach($actionArr as $v){ if(in_array($v,$hsg_action)){ $return = '1'; break; } else{ $return = '0'; } } }这条if判断每一行代表什么意思有什么作用
07-22

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值