NVIDIA One Logger Core

2.3.1 · active · verified Thu Apr 16

nv-one-logger-core is the foundational logging library within the NVIDIA one-logger ecosystem, providing core logging functionality, including spans, events, and attributes. It enables tracking of GPU application progress and helps identify overhead. The library also integrates with OpenTelemetry (OTEL) for backend telemetry. The current version is 2.3.1, with recent releases indicating an active development cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the nv-one-logger-core with OpenTelemetry console exporter, create a logger, and use spans to track operations. The `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable can be set for OTLP exporters.

import os
from nv_one_logger.core.api import Logger, Span
from nv_one_logger.otel.api import configure_otel
from nv_one_logger.otel.config import OTELConfig

# Configure OpenTelemetry to export to console for demonstration
otel_config = OTELConfig(
    exporter_type='console', # Options: 'console', 'otlp_grpc', 'otlp_http'
    service_name='my-application',
    endpoint=os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', '') # Set if using otlp_grpc or otlp_http
)
configure_otel(otel_config)

# Get a logger instance
logger = Logger.get_logger("my_app_logger")

# Log a simple message
logger.info("Application started.")

# Create a span to track an operation
with Span.create("process_data", logger=logger) as span:
    span.set_attribute("input_size", 100)
    logger.debug("Processing data...")
    # Simulate some work
    result = sum(range(100))
    span.set_attribute("output_result", result)
    logger.info("Data processed successfully.")

logger.info("Application finished.")

view raw JSON →