Azure Monitor OpenTelemetry with Node.js to have graphql operation name

Hi,

I recently introduced Node.js azure observability to send telemetry to Azure monitor as mentioned in the documentation learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-configuration?tabs=nodejs

Below is the code snippet that was added for NextJS to track the api calls

import { useAzureMonitor } from ‘applicationinsights’;

import type { AzureMonitorOpenTelemetryOptions } from ‘applicationinsights’;

import { resourceFromAttributes } from ‘@opentelemetry/resources’;

import { ATTR_SERVICE_NAME } from ‘@opentelemetry/semantic-conventions’;

const connectionString = process.env.NEXT_PUBLIC_APP_INSIGHTS_CONNECTION_STRING;

if (connectionString) {

const serviceAttributes = {

[ATTR_SERVICE_NAME]: 'gtis2-nextjs-server',

};

const resource = resourceFromAttributes(serviceAttributes);

const options: AzureMonitorOpenTelemetryOptions = {

azureMonitorExporterOptions: {

  connectionString,

},

resource,

};

// eslint-disable-next-line react-hooks/rules-of-hooks

useAzureMonitor(options);

console.log(

`[Azure Observability] OpenTelemetry with Azure Monitor initialized successfully!`,

);

}

The app insights telemetry under gtis2-nextjs-server , I am only seeing POST /api/graphql. I want to see the graphql operation name as well. I am attaching the screenshotimage (1).jpg

Read more here: Source link