The Bearer Agent monitors the HTTP requests performed on your application. Installing it is as easy as adding a new dependency to your application. The agent does not redirect your traffic or introduce any network latency to API calls.
Once your application is using the Bearer Agent, HTTP requests performed on your application are logged to the Bearer platform and available on your Bearer Dashboard. This helps you monitor all your API usage in a few lines of code.
The agent has been built around three core concepts:
Scalability. The Bearer Agent is able to ingest and log tens of thousands of HTTP requests per second.
Lightweight. Using mostly asynchronous methods, the agent does not impact the performance of your application.
Code-isolation. If, for unexpected reasons, the agent fails, it will fail silently without impacting your application.
Looking for a solution to integrate with APIs more easily, as well as a way to connect from the browser? Check out our open-source project Pizzly.
Installing the Bearer Agent generally only takes a few minutes. All you need is an account on Bearer.sh. To get started, select your platform below:
Add bearer-agent
to your project's Gemfile
:
gem 'bearer-agent'
Next, run bundle
to install the latest version of bearer-agent
.
bundle
Alternately, you can install it yourself by running the following command:
gem install bearer-agent
Next, initialize the Bearer Agent with your Secret Key:
require 'bearer-agent'Bearer.init_config do |config|config.secret_key = "YOUR_BEARER_SECRET_KEY" # Required, string: Your Bearer Secret Keyend
Your Bearer Secret Key, config.secret_key
, can be found in the settings for your app on the Bearer Dashboard.
By default, the Bearer Agent will filter out common sensitive data. To configure the agent further, view the full Ruby Agent Documentation.
Navigate to your project directory and install the @bearer/node-agent
module:
npm install --save @bearer/node-agent# ORyarn add @bearer/node-agent
Now, open the entry point of your application (e.g., index.js
or main.js
) and initialize the Bearer Agent at the top:
const Bearer = require('@bearer/node-agent')Bearer.init({ secretKey: 'YOUR_BEARER_SECRET_KEY' }).then(() => {console.log('Bearer Initialized!')})
The Bearer Agent is asynchronous. If initializing at the top level we suggest using the then
approach above, however you can use async/await where it is supported. Your Bearer Secret Key, secretKey
, can be found in the settings for your app on the Bearer Dashboard.
We strongly recommend initializing the Bearer agent as early as possible in your codebase. This ensure that all external HTTP requests performed on your application are monitored.
By default, the Bearer Agent will filter out common sensitive data. To configure the agent further, view the full Node.js Agent Documentation.
Install the bearer-agent
with pip
:
pip install bearer-agent
Now, at the entry point for your application require and initialize the agent:
import bearer_agentbearer_agent.init(secret_key="YOUR_SECRET_KEY", strip_sensitive_data=True)
Your Bearer Secret Key, secret_key
, can be found in the settings for your app on the Bearer Dashboard.
By default, the Bearer Agent will filter out common sensitive data. To configure the agent further, view the full Python Agent Documentation.
Install the agent with Composer:
composer require bearer/php-agent
Now, initialize the Bearer Agent in the core of your application:
require_once __DIR__ . '/vendor/autoload.php';\Bearer\Agent::init(['secretKey' => 'YOUR_BEARER_SECRET_KEY']);
Your Bearer Secret Key can be found in the settings for your app on the Bearer Dashboard.
By default, the Bearer Agent will filter out common sensitive data. To configure the agent further, view the full PHP Agent documentation.
Navigate to your project directory, and install the go-agent
with go get
.
go get github.com/bearer/go-agent
Next, open your application's main process file and initialize the Bearer Agent in the main
function.
import bearer "github.com/bearer/go-agent"func main() {agent := bearer.New("app_secretkey")defer agent.Close()}
Your Bearer Secret Key can be found in the settings for your app on the Bearer Dashboard.
By default, the Bearer Agent will filter out common sensitive data. To configure the agent further, view the full Go Agent Documentation.
Now when you run your application, all API calls will be monitored and available on your Bearer Dashboard.