appsignal

AppSignal Ruby Gem 2.10: Better Diagnose (And More)

Tom de Bruijn

Tom de Bruijn on

AppSignal Ruby Gem 2.10: Better Diagnose (And More)

In case you missed it, we released Ruby gem 2.10. It focusses mostly on diagnose and configuration. Though a bit late, here's a round-up of what's in the release.

The Idea Behind 2.10 Improvements

We support many setups and configurations, and this means that sometimes things occur that we didn't anticipate.

AppSignal is made by developers, for developers. Our team of developers handles all of the support requests personally. We believe you deserve to be Shibboleet by default.

Still, some users may prefer to fix things themselves. To help with that, we have found that running our diagnose tool helps a lot. This often points to the cause of a problem, making it easier to change the app's config to get things running. In other cases, it helps us pinpoint where things are going wrong so we can point you to a solution.

That's why improving things in the diagnose and the configuration was somewhat of a focus in this release.

Config Error Handling

We've improved how we validate some of AppSignal's config. This includes better error handling and checking config options for empty values.

The config/appsignal.yml config file supports ERB, which allows Ruby code to be executed in the YAML file. While this is very powerful, it can also break. When it does, the errors would bubble up and the application would crash. At AppSignal, we never want the application to crash caused by something in AppSignal. For this reason, the Ruby gem now catches the error and logs it to STDOUT and the AppSignal log file.

yaml
# This would crash the app if the APPSIGNAL_PUSH_API_KEY system environment was # not present when the application starts. Now it prints the error instead. production: push_api_key: <%= ENV.fetch("APPSIGNAL_PUSH_API_KEY") %>

This would print and log:

shell
appsignal: An error occurred while loading the AppSignal config file. Skipping file config. File: "/app/config/appsignal.yml" KeyError: key not found: "APPSIGNAL_PUSH_API_KEY"

Better Config Option Value Validation

When starting AppSignal, the Ruby gem validates the config options read from a variety of sources.

While any value for a config option, in some cases, would work, for one crucial config option, it most certainly won't. The push_api_key config option must be set for any data to be reported to AppSignal. We'd like to make sure it has a value, and that value is not an empty string.

From now on, the push_api_key config option will be checked for empty strings so that AppSignal will not be reported as "active" when it has this invalid configuration.

yaml
# The APPSIGNAL_PUSH_API_KEY system environment would be an empty string in # this scenario. # export APPSIGNAL_PUSH_API_KEY=" " production: push_api_key: <%= ENV["APPSIGNAL_PUSH_API_KEY"] %>

This would log:

shell
[2020-01-30T16:33:06 (process) #96089][ERROR] appsignal: Push API key not set after loading config

Deprecated JavaScript Middleware

Did you hear? We now have a dedicated JavaScript for Front-end integration 🎉

Previously, we supported this through our Appsignal::Rack::JSExceptionCatcher middleware, but in this release, we've deprecated this middleware in favor of our new dedicated JavaScript library. This library integrates with popular frameworks to provide even better insights.

Please update to our new JavaScript for Front-end integration and get better front-end error reporting!

Diagnose Improvements

The Ruby gem's diagnose command will help you debug any issues an app's AppSignal configuration may have. This is mostly presented in plain colorless text. Our server-side diagnose report viewer can analyze and report problems more accurately and be updated without releasing a new integration.

Even so, we understand that sometimes it's easier to view the report locally. For that scenario, we've added some coloring to important warnings that the diagnose command outputs, making it easier to spot problems locally.

PS: In order to use our --send-report feature, it's required to update the AppSignal Ruby gem first to version 2.10.1 or newer.

Command Line Without Color

Color in the terminal output is great! Right?

Sometimes you may not want the colorful output in the terminal. For this reason, our commands all support a --no-color option to make the output more readable on setups where the color codes are not rendered (properly).

shell
appsignal install --no-color PUSH_API_KEY appsignal diagnose --no-color

Since the Ruby gem 2.10.0 release, we've released two more patch releases with even more improvements. Be sure to upgrade to the latest version when upgrading.

Please see the changelog for more details about these improvements, deprecations and other changes. And as always: get in touch if you encounter problems after upgrading. We're happy to help!

Tom de Bruijn

Tom de Bruijn

Tom is a developer at AppSignal, organizer, and writer from Amsterdam, The Netherlands.

All articles by Tom de Bruijn

Become our next author!

Find out more

AppSignal monitors your apps

AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

Discover AppSignal
AppSignal monitors your apps