Day 41 - Have you added monitoring system to your API or you don't know how to?. Read this now!.

Day 41 - Have you added monitoring system to your API or you don't know how to?. Read this now!.

ยท

2 min read

Good day ๐Ÿ‘‹

Today is Day 41, I will be adding a monitoring tool to my API. I need observe the health and the performance of our company's API in real-time. This will enable me to easily identify issues. Infact, my non-technical colleagues can monitor it alongside.

Without further ado, let's get started

I will be using treblle. If you don't know what it is, I explained it in my last article, click here to view

First of all, open an account with treblle.

You can go to documentation, select the platform you're using, as for me it's node/express, if you are also using expressjs, click here.

Me: Wow, it's so straight-forward. I don't even need it to continue, do I ๐Ÿ˜?

Nobody: do continue, man.

Following the instruction, we first install using npm or yarn

const treblle = require('@treblle/express') // import treblle
const app = express()

// set the middleware and config options
app.use(
  treblle({
    apiKey: process.env.TREBLLE_API_KEY,
    projectId: process.env.TREBLLE_PROJECT_ID
  })
)

We need the apiKey and projectId

Nobody: How do we get it?

Me: I think we will get them once we create the project in our dashboards.

Let's get straight to creating project.

Once, you log in, you see the dashboard. You can safely click on create new project

set the name of the project, the URL of your API, the platform you are using, and the environment type (local, staging, production, development).

Boom ๐Ÿฅณ๐Ÿฅณ. I can see my apiKey and projectId. Infact there are instructions we can follow, but fortunately we've done all. Only keys remain.

Scroll down and you will see the apiKey and projectId, add to your .env file and update the config options.

You are good to go. You can check the number and types of request sent, the endpoints the client used, the problems encountered, the flows, your API overall score according the number of requests, both failed and successful, performance, quality and security, and lastly, you can update the settings according to your preference.

Updated the deployment, it automatically sent request and then booms - so beautiful. I also sent a request. Infact, it tracked the location of the client, this tool has exposed me ๐Ÿ˜‚๐Ÿ˜‚

Thanks ๐Ÿ™. God bless ๐Ÿ™. Bye ๐Ÿ‘‹.

ย