Skip to content

Commit 46ba74d

Browse files
authored
Added OTel blog post (#8140)
1 parent e7286c5 commit 46ba74d

File tree

6 files changed

+217
-0
lines changed

6 files changed

+217
-0
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
path: "/blog/2025/03/17/telemetry"
3+
date: "2025-03-17"
4+
title: "Open Telemetry for All Your Services"
5+
tags: ["nitro", "open-telemetry", "dotnet", "aspnetcore"]
6+
author: Pascal Senn
7+
featuredImage: "header.png"
8+
authorUrl: https://github.com/pascalsenn
9+
authorImageUrl: https://avatars.githubusercontent.com/u/14233220?v=4
10+
---
11+
12+
# Open Telemetry for All Your Services (and More!)
13+
14+
We’re thrilled to introduce **OpenTelemetry support for all your .NET-based services** - not just your GraphQL Servers. Whether you have REST APIs, background workers, or any other .NET applications, you can now unify and analyze your telemetry data in Nitro. This marks a significant step in helping you gain deeper insights across your entire infrastructure.
15+
16+
With **ChilliCream.Nitro.Telemetry** version 15.0.0 and 14.1.0, simply call the extension method `AddNitroTelemetry` in your service registration to integrate Nitro with any .NET service. All you need to do is configure OpenTelemetry exporters, and Nitro will collect and visualize your logs and traces:
17+
18+
```csharp
19+
services.ConfigureOpenTelemetryTracerProvider(x => x.AddNitroExporter());
20+
services.ConfigureOpenTelemetryLoggerProvider(x => x.AddNitroExporter());
21+
22+
services.AddNitroTelemetry(options =>
23+
{
24+
options.ApiId = apiId;
25+
options.ApiKey = apiKey;
26+
options.Stage = stage;
27+
});
28+
```
29+
30+
On the trace overview of your API in the Nitro dashboard, select **OpenTelemetry** from the dropdown on the top right. You’ll be able to inspect all your HTTP requests, background workers, or anything else you’re tracking with OTEL. We’ve also **drastically improved telemetry performance**, so these insights will load and refresh faster than ever.
31+
32+
![Telemetry Overview](./otel1.png)
33+
34+
In this post, you’ll also learn about:
35+
36+
- **Personal Access Tokens (PATs)**, which bring more secure and granular authentication options to your automation workflows.
37+
- **Enhanced Non-Interactive Command Execution** in the Nitro CLI, enabling full automation for API lifecycle tasks.
38+
- The difference between **API Keys** and **PATs**, helping you choose the right authentication mechanism for every scenario.
39+
40+
Read on to discover how you can level up your .NET observability and API management automation, all within one powerful platform.
41+
42+
---
43+
44+
## Introducing Personal Access Tokens (PATs)
45+
46+
To provide more flexibility and security in your automation processes, we have introduced **Personal Access Tokens (PATs)**. PATs allow you to authenticate with the Nitro platform in a secure and granular manner, ideal for scripting and automated tasks.
47+
48+
### What are PATs?
49+
50+
Personal Access Tokens are tokens associated with your user account that grant access to the Nitro API.
51+
52+
- **Automation-Friendly**: PATs are perfect for use in CI/CD pipelines, scripts, and other automated workflows where you need to authenticate non-interactively.
53+
- **User-Specific**: Unlike API keys tied to a specific API, PATs are linked to your user account, providing access across multiple APIs.
54+
55+
### How to Create a PAT
56+
57+
You can create a PAT using the following command:
58+
59+
```shell
60+
nitro pat create --description "My Automation Token" --expires 180
61+
```
62+
63+
- `--description`: A description for the token to help you identify it later.
64+
- `--expires`: The number of days after which the token will expire (default is 180 days).
65+
66+
## Non-Interactive Command Execution
67+
68+
We have improved the Nitro CLI to support full non-interactive execution for all commands. This enhancement empowers you to automate every aspect of your API lifecycle management, from creating APIs and editing stages to generating API keys.
69+
70+
### Benefits of Non-Interactive Commands
71+
72+
- **Automation**: Integrate Nitro CLI commands into your scripts and CI/CD pipelines without manual intervention.
73+
- **Consistency**: Ensure consistent execution of tasks across different environments.
74+
- **Efficiency**: Automate repetitive tasks to save time and reduce human error.
75+
76+
### How to Use Commands Non-Interactively
77+
78+
All commands now accept input via command-line options or environment variables, allowing you to bypass interactive prompts. For example, to create an API non-interactively:
79+
80+
```shell
81+
nitro api create --name "My API" --path "/my-api" --workspace-id "workspace123"
82+
```
83+
84+
You can also set environment variables for inputs:
85+
86+
```shell
87+
export NITRO_API_NAME="My API"
88+
export NITRO_API_PATH="/my-api"
89+
export NITRO_WORKSPACE_ID="workspace123"
90+
nitro api create
91+
```
92+
93+
### Parsing Command Output
94+
95+
By default, Nitro CLI provides human-readable output. When automating, you might need machine-readable output. Use the `--output json` option to get the output in JSON format:
96+
97+
```shell
98+
nitro api-key list --output json
99+
```
100+
101+
This output can then be parsed using tools like `jq`:
102+
103+
```shell
104+
nitro api-key list --output json | jq '.'
105+
```
106+
107+
## API Keys vs. PAT
108+
109+
**API Keys**
110+
111+
- **Purpose**: Designed for application-level authentication, such as telemetry reporting from your GraphQL server.
112+
- **Scope**: Tied to a specific API and workspace.
113+
- **Creation**: Generated using the `nitro api-key create` command.
114+
- **Usage**: Best for telemetry, fusion, client registry, or other application-level tasks where you need to authenticate a specific API.
115+
116+
**Personal Access Tokens (PATs)**
117+
118+
- **Purpose**: Intended for user-level authentication, suitable for automating tasks that require broader access across APIs.
119+
- **Scope**: Associated with your user account, has workspace permissions.
120+
- **Creation**: Generated using the `nitro pat create` command.
121+
- **Usage**: Best for scripts, automation tools, and CI/CD pipelines that need to perform various operations on the Nitro platform.
122+
123+
---
124+
125+
## Get Started Today
126+
127+
With **expanded OpenTelemetry integration**, **personal access tokens**, and **full non-interactive command support**, it’s never been easier to automate your API management workflows while simultaneously gaining comprehensive insights into your.NET services. Try out the improved telemetry overview, create your first PAT, and add Nitro to your automation pipelines to take full advantage of these new features.
128+
129+
### Need Help? We’ve Got You Covered!
130+
131+
Whether you’re integrating OpenTelemetry for the first time or looking to streamline your API automation, our **support contracts** provide expert guidance to help you get up and running quickly. From troubleshooting to best practices, our team is here to ensure your success. [Learn more about our support plans](https://chillicream.com/services/support) and get tailored assistance for your specific needs.
132+
133+
### Resources
134+
135+
- **Documentation**: Check out our [updated documentation](https://chillicream.com/docs/nitro) for a deeper look at the new commands and options.
136+
- **Support**: If you have any questions or need assistance, feel free to reach out to our support team on slack!
Loading
Loading

website/src/docs/docs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
"path": "operation-monitoring",
7171
"title": "Operation Monitoring"
7272
},
73+
{
74+
"path": "service-monitoring",
75+
"title": "Service Monitoring"
76+
},
7377
{ "path": "logging", "title": "Logging" }
7478
]
7579
},

website/src/docs/nitro/open-telemetry/operation-monitoring.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ It helps you to understand which resolver is impacting your system the most, whi
1616
All the reporting is done on a per API basis. An api represents one of your deployments. To monitor you services you need to create an API in Nitro.
1717
The api needs to be from type "Api Service" or "Api Gateway".
1818

19+
> **Note:** You can use Nitro to monitor any .NET service, not just GraphQL APIs. This includes REST APIs, gRPC services, and background jobs. Checkout the [Service Monitoring](https://chillicream.com/docs/nitro/open-telemetry/service-monitoring) section for more details.
20+
1921
To install the Nitro services, run the following commands in your project's root directory:
2022

2123
```bash
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: "Service Monitoring"
3+
---
4+
5+
Nitro’s OpenTelemetry support extends beyond GraphQL, allowing you to gather and analyze telemetry data from any .NET application. Whether you have REST APIs, background workers, or other services, you can seamlessly centralize logging and tracing in Nitro for a unified observability experience.
6+
7+
> **Note**: If you are looking specifically for GraphQL telemetry, please refer to the [Operation Monitoring](https://chillicream.com/docs/nitro/open-telemetry/operation-monitoring/#connect-your-service-to-the-telemetry-system) section.
8+
9+
## Prerequisites
10+
11+
1. **.NET Application**: You’ll need a .NET project (e.g., ASP.NET Core, worker service, etc.) where you want to enable telemetry.
12+
2. **ChilliCream.Nitro.Telemetry**: Make sure to reference version **15.0.0** or **14.1.0** of the `ChilliCream.Nitro.Telemetry` package.
13+
3. **OpenTelemetry**: Have the OpenTelemetry packages or extensions configured in your project.
14+
15+
## Quick Start
16+
17+
### 1. Install Required Packages
18+
19+
In your .NET project, install the following NuGet packages if they are not already present:
20+
21+
```shell
22+
dotnet add package ChilliCream.Nitro.Telemetry --version 15.0.0
23+
dotnet add package OpenTelemetry --version <appropriate version>
24+
dotnet add package OpenTelemetry.Extensions.Hosting --version <appropriate version>
25+
```
26+
27+
### 2. Configure OpenTelemetry Exporters
28+
29+
Configure your OpenTelemetry **tracer** and **logger** providers to export data to Nitro. For example, in your `Program.cs` or `Startup.cs`:
30+
31+
```csharp
32+
services.ConfigureOpenTelemetryTracerProvider(x => x.AddNitroExporter());
33+
services.ConfigureOpenTelemetryLoggerProvider(x => x.AddNitroExporter());
34+
```
35+
36+
If you’re using ASP.NET Core, you might do this in the `ConfigureServices` method.
37+
38+
You can also add additional instrumentation as needed, such as for HTTP requests or background jobs.
39+
40+
```shell
41+
dotnet add package OpenTelemetry.Extensions.Hosting
42+
dotnet add package OpenTelemetry.Instrumentation.AspNetCore
43+
```
44+
45+
```csharp
46+
services.ConfigureOpenTelemetryTracerProvider(x =>
47+
{
48+
x.AddAspNetCoreInstrumentation();
49+
x.AddNitroExporter();
50+
});
51+
```
52+
53+
### 3. Register Nitro Telemetry
54+
55+
Next, register Nitro telemetry with the appropriate **API credentials** in the same method:
56+
57+
```csharp
58+
services.AddNitroTelemetry(options =>
59+
{
60+
options.ApiId = apiId; // Replace with your Nitro API ID
61+
options.ApiKey = apiKey; // Replace with your Nitro API Key
62+
options.Stage = stage; // Replace with your environment or stage name
63+
});
64+
```
65+
66+
These options tell Nitro where to send the collected telemetry.
67+
68+
### 4. View Your Traces
69+
70+
Once your service is running, head over to the **Nitro dashboard**.
71+
72+
- Select your API.
73+
- Choose **OpenTelemetry** from the trace overview dropdown.
74+
75+
You’ll see a unified view of all the HTTP requests, background worker jobs, or other .NET processes you’re tracking through OpenTelemetry.

0 commit comments

Comments
 (0)