Skip to main content

Observability SDK for Training Performance Metrics

The SageMaker HyperPod Observability SDK is a Python library for emitting training events from machine learning workloads running on Amazon SageMaker HyperPod clusters. It provides OpenTelemetry-compliant event structures and flexible export capabilities to give you deep visibility into your training jobs.


Overview

HyperPod's observability add-on delivers infrastructure-level training metrics out of the box. The Observability SDK extends this capability by adding application-level visibility from inside your training process, capturing batch timing, checkpoint duration, validation phases, and training lifecycle boundaries.

When the observability add-on is enabled with advanced training metrics, events emitted by the SDK are processed into metrics and surfaced on the Grafana Training dashboard under the Core Training Performance and Overall Training Health metrics sections. Together, the infrastructure-level and SDK-level metrics provide a complete, end-to-end picture of your training performance.


Requirements

Before using the SDK, ensure the following prerequisites are met:

  • Python 3.11 or later
  • A HyperPod EKS cluster with the observability add-on installed and advanced training metrics enabled
  • The latest version of the observability add-on (required for SDK metrics dashboard panels)

Key Features

  • Zero external dependencies for the core SDK. OTLP export requires the [otlp] extra.
  • Built-in framework adapters for PyTorch Lightning and Keras. Any other framework, including PyTorch, XGBoost, JAX, or custom training loops, is supported through manual instrumentation.
  • OpenTelemetry-compliant events emitted as LogRecords with trace and span correlation for paired START/END events.

Frameworks Supported

The following table summarizes instrumentation support across frameworks:

Framework Auto Programmatic Manual
PyTorch Lightning ✅ ✅ ✅
Keras (TF / PyTorch / JAX backend) - ✅ ✅
PyTorch - - ✅
XGBoost, JAX, custom frameworks - - ✅

Installation

Install the core SDK (stdout export only) or include the OTLP exporter for full pipeline integration:

pip install sagemaker-hyperpod-observability-sdk           # core (stdout only)
pip install sagemaker-hyperpod-observability-sdk[otlp]     # with OTLP exporter

Quick Start

Auto-instrumentation (PyTorch Lightning)

No code changes are required. Set the following environment variable and run your training script:

export HYPERPOD_OBSERVABILITY_AUTO_INSTRUMENT=true
python train.py

The SDK automatically detects PyTorch Lightning and registers callbacks for batch, validation, checkpoint, and training lifecycle events.

Programmatic Instrumentation

If you prefer to register adapters explicitly, use the following approach for your framework.

PyTorch Lightning:

from sagemaker_hyperpod_observability_sdk import AutoInstrumentor, Config, FrameworkType
from sagemaker_hyperpod_observability_sdk.common.types import ExporterType

config = Config(exporters=[ExporterType.OTLP], auto_instrument=True)
instrumentor = AutoInstrumentor.create(config)
instrumentor.start()

callback = instrumentor.get_adapter(FrameworkType.PYTORCH_LIGHTNING).get_callback()
trainer = Trainer(callbacks=[callback])
trainer.fit(model, train_loader, val_loader)

Keras:

from sagemaker_hyperpod_observability_sdk import Config, KerasAdapter
from sagemaker_hyperpod_observability_sdk.common.types import ExporterType
from sagemaker_hyperpod_observability_sdk.core.event_processor import EventProcessor

config = Config(exporters=[ExporterType.OTLP])
event_processor = EventProcessor.create(config)
callback = KerasAdapter.create(event_processor).get_callback()

model.fit(X, y, callbacks=[callback])

Manual Instrumentation (PyTorch, XGBoost, JAX, and custom frameworks)

For frameworks without a built-in adapter, use ManualInstrumentor to emit events directly from your training loop.

Using a context manager:

from sagemaker_hyperpod_observability_sdk import Config
from sagemaker_hyperpod_observability_sdk.common.types import ExporterType
from sagemaker_hyperpod_observability_sdk.instrumentors.manual_instrumentor import ManualInstrumentor

config = Config(exporters=[ExporterType.OTLP])
instrumentor = ManualInstrumentor.create(config)

for epoch in range(num_epochs):
    for batch in train_loader:
        with instrumentor.training_context_manager("BATCH"):
            loss = model(batch)
            loss.backward()
            optimizer.step()

    with instrumentor.training_context_manager("VALIDATION"):
        validate(model, val_loader)

instrumentor.close()

Using a decorator:

@instrumentor.training_decorator("BATCH")
def train_step(batch):
    loss = model(batch)
    loss.backward()
    optimizer.step()
    return loss

Emitting events directly:

instrumentor.emit_event("CHECKPOINT_START", global_step=1000)
save_checkpoint(model, path)
instrumentor.emit_event("CHECKPOINT_SYNC_END", global_step=1000)

Configuration

Configuration follows this precedence order: programmatic config > environment variables > JSON file > defaults.

JSON configuration file (sagemaker-hyperpod-observability.json):

{
  "exporters": ["otlp"],
  "frameworks": ["pytorch_lightning"],
  "auto_instrument": true,
  "otlp_config": {
    "endpoint": "hyperpod-otel-collector.hyperpod-observability:4317",
    "timeout": 30,
    "insecure": true
  }
}

Programmatic configuration:

from sagemaker_hyperpod_observability_sdk import Config
from sagemaker_hyperpod_observability_sdk.common.types import ExporterType
from sagemaker_hyperpod_observability_sdk.config.config_models import OTLPConfig

config = Config(
    exporters=[ExporterType.OTLP],
    auto_instrument=True,
    otlp_config=OTLPConfig(
        endpoint="hyperpod-otel-collector.hyperpod-observability:4317",
        insecure=True,
    ),
)

Supported Events

The SDK emits the following event types. Paired START/END events carry trace and span correlation for accurate duration measurement.

Event Description Lightning Keras Manual
BATCH_START / BATCH_END Training batch boundaries ✅ ✅ ✅
TRAINING_START / TRAINING_END Training session lifecycle ✅ ✅ ✅
VALIDATION_START / VALIDATION_END Validation phase boundaries ✅ ✅ ✅
CHECKPOINT_START / CHECKPOINT_SYNC_END Synchronous checkpoint - - ✅
CHECKPOINT_SYNC_END / CHECKPOINT_ASYNC_END Asynchronous checkpoint - - ✅
CHECKPOINT_SAVED Checkpoint saved (unpaired event) ✅ - ✅
EXCEPTION_DETECTED Application-level fault ✅ - ✅
Custom events User-defined events - - ✅

Dashboard Metrics

When the observability add-on is enabled with advanced training metrics, events emitted by the SDK are processed into metrics and surfaced on the Grafana Training dashboard under the Core Training Performance and Overall Training Health metrics sections. If you are on the older version of the observability add-on, upgrade the add-on to the latest version to make these panels visible.

Metric Description
training_batch_count The number of training batches completed
training_batch_time_ms Cumulative time spent executing training batches, in milliseconds
training_evaluation_passes Number of complete evaluation passes
training_evaluation_time_ms Total time spent in evaluation, in milliseconds
training_checkpoint_count Total number of checkpoint operations, carrying a source label: source="manual" for explicit checkpoints and source="auto" for CHECKPOINT_SAVED events
training_checkpoint_time_ms Total time taken to complete all checkpoint operations, including both synchronous and asynchronous phases, in milliseconds
training_checkpoint_sync_time_ms Time spent in the synchronous portion of checkpoint operations, in milliseconds
training_checkpoint_async_time_ms Time spent in the asynchronous portion of checkpoint operations, in milliseconds
training_lost_step_count Number of training steps that were lost due to faults or unexpected restarts
training_reprocessing_time_ms Time spent re-running training steps after recovering from a fault, in milliseconds
training_fault_detection_time_ms Elapsed time between the last successfully completed batch and the point at which a fault was detected, in milliseconds
training_system_restart_time_ms Time elapsed between fault recovery and the resumption of training, in milliseconds

Accessing dashboards

To view your SageMaker HyperPod cluster's metrics in Amazon Managed Grafana, perform the following steps:

  • Open the Amazon SageMaker AI console at https://console.aws.amazon.com/sagemaker/.
  • Go to your cluster's details page.
  • On the Dashboard tab, locate the HyperPod Observability section, and choose Open dashboard in Grafana.

Adding new users to an Amazon Managed Grafana workspace

For information about how to add users to an Amazon Managed Grafana workspace, see "Use AWS IAM Identity Center with your Amazon Managed Grafana workspace" in the Amazon Managed Grafana User Guide.


Additional Resources


Security

For information on reporting security issues, see CONTRIBUTING.


License

This SDK is licensed under the Apache-2.0 License. See LICENSE for full details.

Metadata

Release files for sagemaker-hyperpod-observability-sdk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sagemaker-hyperpod-observability-sdk 1.0.1
File Size Uploaded Provenance Actions
sagemaker_hyperpod_observability_sdk-1.0.1.tar.gz 145.2 kB With provenance Details for sagemaker_hyperpod_observability_sdk-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sagemaker-hyperpod-observability-sdk 1.0.1
File Interpreter ABI Platform Actions
sagemaker_hyperpod_observability_sdk-1.0.1-py3-none-any.whl Python 3 none any Details for sagemaker_hyperpod_observability_sdk-1.0.1-py3-none-any.whl

Total release size: 196.1 kB

Release files / sagemaker_hyperpod_observability_sdk-1.0.1.tar.gz

Download URL sagemaker_hyperpod_observability_sdk-1.0.1.tar.gz
Size 145.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04b0961a0696ba4ec29e48d869fc70315c90d34105880be07477d0c6f51b123a
BLAKE2b-256 checksum
How to use checksums
5bebdd88679171d65aa35ad1a226aaf48a5a82b1215e817518455e661d5cd5f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / sagemaker_hyperpod_observability_sdk-1.0.1-py3-none-any.whl

Download URL sagemaker_hyperpod_observability_sdk-1.0.1-py3-none-any.whl
Size 50.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a826e86ccdbb0133e55d0c371fc731ccd7eee161b84f4b2c7cd7e90a485f973
BLAKE2b-256 checksum
How to use checksums
a24f9dfde830579f4683f0f268af4764278f605cc5c45c5ed6e0ce4bc75dfe4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for sagemaker-hyperpod-observability-sdk 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sagemaker_hyperpod_observability_sdk-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page