可观测性#
关于可观测性#
NeMo Retriever Text Reranking NIM 支持导出 OpenTelemetry 兼容格式的指标和追踪。此外,该微服务及其底层的 NVIDIA Triton 推理服务器 通过 Prometheus 端点公开指标。
要收集这些指标和追踪,请将它们导出到正在运行的 OpenTelemetry Collector 实例,然后该实例可以将它们导出到任何 OTLP 兼容的后端。
指标和追踪#
您可以从 NIM 微服务和 Triton 推理服务器实例收集指标。
以下环境变量与从 NIM 微服务导出 OpenTelemetry 指标和追踪有关。
变量 |
描述 |
---|---|
|
指定要在导出的指标中使用的服务名称。 |
|
指定 OTLP gRPC 接收器的端点。 |
|
指定将指标以 OTLP 格式导出到指定的 |
|
指定将追踪以 OTLP 格式导出到指定的 |
NIM 微服务和 Triton 推理服务器也以 Prometheus 格式公开指标。您可以通过 NIM 微服务 API 在 <nim-host>:8000/v1/metrics
访问这些指标,并通过 Triton 指标端点在 <nim-host>:8002/metrics
访问这些指标。
启用 OpenTelemetry#
以下示例要求 OpenTelemetry Collector gRPC 接收器在端口 <opentelemetry-collector-grpc-port>
上的 <opentelemetry-collector-host>
上运行。
export IMG_NAME=nvcr.io/nim/nvidia/llama-3.2-nv-rerankqa-1b-v2
export IMG_TAG=1.3.0
# Choose a container name for bookkeeping
export CONTAINER_NAME=$(basename $IMG_NAME)
# Set the OTEL environment variables to enable metrics exporting
export OTEL_SERVICE_NAME=$CONTAINER_NAME
export OTEL_METRICS_EXPORTER=otlp
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<opentelemetry-collector-host>:<opentelemetry-collector-grpc-port>"
docker run --runtime=nvidia -it --rm --name=$CONTAINER_NAME \
... \
-e OTEL_SERVICE_NAME \
-e OTEL_METRICS_EXPORTER \
-e OTEL_TRACES_EXPORTER \
-e OTEL_EXPORTER_OTLP_ENDPOINT \
... \
$IMG_NAME:$IMG_TAG
接收和导出遥测数据#
以下 OpenTelemetry Collector 配置启用了指标和追踪导出。
定义了两个接收器
一个 OTLP 接收器,用于从 NIM 微服务接收指标和追踪数据。
一个 Prometheus 接收器,用于抓取 Triton 推理服务器指标。
定义了三个导出器
一个 Zipkin 导出器,用于导出到正在运行的 Zipkin 实例。
一个 OTLP gRPC 导出器,用于导出到下游收集器或后端,例如 Datadog。
一个调试导出器,用于将接收到的数据打印到控制台。此导出器对于测试和开发目的很有用。
追踪由 OTLP 接收器独家接收,并由 Zipkin 和调试导出器导出。指标由 OTLP 和 Prometheus 接收器接收。指标由 OTLP 和调试导出器导出。
receivers:
otlp:
protocols:
grpc:
http:
cors:
allowed_origins:
- "*"
prometheus:
config:
scrape_configs:
- job_name: nim-triton-metrics
scrape_interval: 10s
static_configs:
- targets: ["<nim-endpoint>:8002"]
exporters:
# NOTE: Prior to v0.86.0 use `logging` instead of `debug`.
zipkin:
endpoint: "<zipkin-endpoint>:<zipkin-port>/api/v2/spans"
otlp:
endpoint: "<otlp-metrics-endpoint>:<otlp-metrics-port>"
tls:
insecure: true
debug:
verbosity: detailed
service:
pipelines:
traces:
receivers: [otlp]
exporters: [debug, zipkin]
metrics:
receivers: [otlp, prometheus]
exporters: [debug, otlp]