Jump to content

Platform engineering: Monitor Backstage with Application Insights


Recommended Posts

Guest DavidHernandez
Posted

smallvv2px200.png.57c634de9abfe21f018707cba7b75dc8.png

 

 

 

The platform engineering journey requires abundant information to make informed decisions. Understanding how developers use the platform—how frequently and for how long—is invaluable. Since the internal developer portal (IDP) serves as the central hub for developers’ regular tasks, it becomes the ideal location for monitoring these activities and collecting essential data.

 

 

 

Backstage, a common IDP implementation, provides an excellent opportunity to demonstrate how to integrate monitoring. In this article, we’ll explore how to add monitoring to the Backstage portal using Azure Monitor, specifically Application Insights.

 

 

Upon reviewing the Backstage documentation, we find that the portal is already instrumented using OpenTelemetry. Furthermore, Application Insights is a supported provider for OpenTelemetry.

 

This is excellent news, as it streamlines the process and saves time that would otherwise be spent manually adding tracing calls to the Backstage code.

 

 

 

To enable OpenTelemetry instrumentation, follow the steps in the official documentation(Setup OpenTelemetry | Backstage Software Catalog and Developer Platform). Start by adding the required packages using the following command:

 

 

 

yarn --cwd packages/backend add \

   @opentelemetry/sdk-node \

   @opentelemetry/auto-instrumentations-node \

   /monitor-opentelemetry-exporter

 

 

 

 

Next, create a new file named [iCODE]instrumentation.js[/iCODE] inside the [iCODE]backend/src[/iCODE] folder.

 

The content of the file should be:

 

 

 

const { NodeSDK } = require('@opentelemetry/sdk-node');
const {
 getNodeAutoInstrumentations,
} = require('@opentelemetry/auto-instrumentations-node');
const { AzureMonitorTraceExporter } = require("@azure/monitor-opentelemetry-exporter");
const { AzureMonitorMetricExporter } = require("@azure/monitor-opentelemetry-exporter");

// Create an exporter instance
const azTraceExporter = new AzureMonitorTraceExporter({
   connectionString:
     process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "<YourAppInsightsConnectionString>"
 });

const sdk = new NodeSDK({
 traceExporter: azTraceExporter,
 instrumentations: [getNodeAutoInstrumentations()],
});

sdk.start();

 

 

 

 

 

And with that...we are done!

 

 

 

Browse some pages within the Backstage portal and in a few minutes, telemetry will be available in Application Insights.

 

Here are some samples of information that has been gathered. All this information is out-of-the-box reports, so without any other customization, we can obtain a wealth of information.

 

 

We can check if the portal is returning errors, if the response time is within acceptable parameters, how many requests are made and the usage pattern...

 

 

 

largevv2px999.thumb.png.6e2dc59ebe7d7c38c6189b522aa34483.png

 

Examine the details of a request to Backstage, the time taken to serve the request and the time spent on all dependencies...

 

largevv2px999.png.ee666928722414bbe9b4c7995fe72af0.png

 

Retrieve information from the accessed URLs, for example, to identify the most common searches and ascertain developers' interests.

 

largevv2px999.png.c4b8d2b957a7c055d24332d1161c5bf0.png

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...