Skip to main content

Respan instrumentation plugin for AWS SageMaker Runtime

Project description

respan-instrumentation-sagemaker

Respan instrumentation plugin for AWS SageMaker Runtime calls made through boto3.

Installation

pip install respan-ai respan-instrumentation-sagemaker boto3

Usage

import json

import boto3
from respan import Respan
from respan_instrumentation_sagemaker import SageMakerInstrumentor

respan = Respan(instrumentations=[SageMakerInstrumentor()])
client = boto3.client("sagemaker-runtime", region_name="us-east-1")

response = client.invoke_endpoint(
    EndpointName="my-llm-endpoint",
    Body=json.dumps({"inputs": "Reply with one short sentence."}).encode("utf-8"),
    ContentType="application/json",
    Accept="application/json",
)

body = json.loads(response["Body"].read())
print(body[0]["generated_text"])
respan.flush()

The instrumentor patches botocore.client.BaseClient._make_api_call and only emits spans for SageMaker Runtime operations. It currently normalizes InvokeEndpoint, InvokeEndpointWithResponseStream, and InvokeEndpointAsync into canonical Respan LLM spans.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_sagemaker-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_sagemaker-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_sagemaker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d946be1482d5c0d59acdefd33caeb8d26a0f22201c9f63981242803b3fd7e0b4
MD5 c3f901cfc929c09d1047dd4491804927
BLAKE2b-256 3c0abf2fda36ac48450c11e32f617e1030233538ee4ee395089e03dfae5e8fb5

See more details on using hashes here.

File details

Details for the file respan_instrumentation_sagemaker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_sagemaker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fb19c221e4a760c5db9057abc69fc4c6b3516e3be68f841e73e930a25ceba56
MD5 4c09b9046d4dddf293c69c5991308a1a
BLAKE2b-256 d49348a33596aa6e8376d176e1822291416a829ccc1a6cd92de3a0123573353c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page