Skip to content

Commit 72b2a8d

Browse files
committed
chore: readme opentelemetry
1 parent cbff1fb commit 72b2a8d

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ It will launch per default on port 6464.
209209
NOMAD_ADDR=http://localhost:6464 nomad job run job.hcl
210210
```
211211

212-
### Other Configuration
212+
## Other Configuration
213213

214214
### NACP Server
215215

@@ -290,6 +290,43 @@ e.g.:
290290
}
291291
```
292292

293+
### OpenTelemetry
294+
295+
NACP has built-in support for OpenTelemetry (OTLP) to provide observability and monitoring capabilities for admission requests and responses.
296+
297+
The OpenTelemetry exporter can be configured using the following settings in the configuration file:
298+
299+
```hcl
300+
telemetry {
301+
logging {
302+
type = "otel" # Use OpenTelemetry
303+
}
304+
metrics {
305+
enabled = true # Enable metrics collection
306+
}
307+
tracing {
308+
enabled = true # Enable tracing
309+
}
310+
}
311+
```
312+
313+
The OTLP exporter is configured using the common OpenTelemetry environment variables. You can set these variables to specify the endpoint, and other settings for the OTLP exporter. (e.g., `OTEL_SERVICE_NAME=nacp`, `OTEL_RESOURCE_ATTRIBUTES=...`, etc.)
314+
315+
### slog logging
316+
317+
To use `log/slog` for logging, you can configure the telemetry logging settings in your NACP configuration file. This allows you to set the logging type, level, and handler.
318+
319+
```hcl
320+
telemetry {
321+
logging {
322+
type = "slog" # Use slog for logging
323+
level = "info" # Set the logging level (e.g., debug, info, warn, error)
324+
slog {
325+
handler = "text" # Set the slog handler (e.g., text, json)
326+
}
327+
}
328+
}
329+
```
293330

294331
# Note
295332
This work was inspired by the internal [Nomad Admission Controller](https://github.com/hashicorp/nomad/blob/v1.5.0/nomad/job_endpoint_hooks.go#L74)

example/example1/example1.nomad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
job "app" {
22

33
meta {
4-
4+
costcenter = "cccode-123"
55
}
66
group "app" {
77

0 commit comments

Comments
 (0)