website/src/docs/nitro/apis/operation-reporting.md
Nitro's Operation Reporting feature provides comprehensive insights into the GraphQL operations executed on your server. This functionality is essential for maintaining visibility over server activities, including both persisted and executed operations. By leveraging Operation Reporting, developers and system administrators can gain a clearer understanding of what operations are executed and available on the server.
Operation Reporting is an integrated feature in Nitro and is enabled by default when using Nitro services. To integrate these services into your project, the ChilliCream.Nitro NuGet package must be added.
To install the Nitro services, run the following command in your project's root directory:
dotnet add package ChilliCream.Nitro
After installing the package, you need to configure the services in your startup class. Below is a sample implementation in C#:
public void ConfigureServices(IServiceCollection services)
{
services
.AddGraphQL()
.AddQueryType<Query>()
.AddNitro(x =>
{
x.ApiKey = "<<your-api-key>>";
x.ApiId = "QXBpCmc5NGYwZTIzNDZhZjQ0NjBmYTljNDNhZDA2ZmRkZDA2Ng==";
x.Stage = "dev";
});
}
Tip: Using Environment Variables
Alternatively, you can set the required values using environment variables. This method allows you to call
AddNitrowithout explicitly passing parameters.
NITRO_API_KEYmaps toApiKeyNITRO_API_IDmaps toApiIdNITRO_STAGEmaps toStagecsharppublic void ConfigureServices(IServiceCollection services) { services .AddGraphQL() .AddQueryType<Query>() .AddNitro() }In this setup, the API key, ID, and stage are set through environment variables.
Once Operation Reporting is enabled and configured, all GraphQL operations processed by your server will be reported to Nitro. These operations can be viewed and analyzed in the Operations tab within the Nitro interface.
Operations tab in Nitro to view the list of reported operations.