Saravanan666/pypi-org huggingface dataset:
Package: opentelemetry-ext-lightstep
Lightstep OpenTelemetry Python ExporterThis is the Lightstep exporter for OpenTelemetryInstallpipinstallopentelemetry-ext-lightstepConfigurefromopentelemetryimporttracefromopentelemetry.ext.lightstepimportLightStepSpanExporterfromopentelemetry.sdk.trace.exportimportBatchExportSpanProcessorexporter=LightstepSpanExporter(name="test-service",token=<PROJECT_ACCESS_TOKEN>,host=<SATELLITE_URL>,port=<SATELLITE_PORT>,service_version="1.2.3",)span_processor=BatchExportSpanProcessor(exporter)trace.get_tracer_provider().add_span_processor(span_processor)ExamplesSee theexamplesdirectory.
Package: opentelemetry-hook-sampler
opentelemetry-hook-samplerCustom function based sampler foropentelemetry-python.How to install$ pip install opentelemetry-hook-samplerHow to useimportopentelemetry.tracefromopentelemetry.sdk.resourcesimportSERVICE_NAMEfromopentelemetry.sdk.traceimportTracerProviderfromopentelemetry_hook_samplerimportHookSamplerdefsampler_hook():"""Sample 1 in 10 traces.The example is static, but you can get info from any context availablein your application. E.g. http request, celery task, thread locals, etc."""return10resource=Resource(attributes={SERVICE_NAME:"foo"})sampler=HookSampler(sampler_hook)provider=TracerProvider(resource=resource,sampler=sampler)opentelemetry.trace.set_tracer_provider(provider)Honeycomb specificHoneycomb expectsaSampleRateattribute to normalize data. It is not OpenTelemetry spec, but
it is supported throughopentelemetry_hook_sampler.HoneycombHookSampler.Sampler examplesdjango-threadlocalsBe careful, threadlocals module don't work with async Django.fromthreadlocals.threadlocalsimportget_current_requestdefsampler_hook():request=get_current_request()# 10% /foo requestsifrequest.path=='/foo':return10return1django-gfromdjango_gimportget_current_requestdefsampler_hook():request=get_current_request()# 10% /foo requestsifrequest.path=='/foo':return10return1celeryimportcelerydefsampler_hook():task_name=celery.current_app.current_worker_task.request.task# 10% foo.bar.baz tasksiftask_name=='foo.bar.baz':return10return1
Package: opentelemetry-instrument-anthropic
opentelemetry-instrument-anthropic-pyAutoinstrumentation for Anthropic's client library.Project site:https://github.com/fxchen/opentelemetry-instrument-anthropic-pyUsageInstallaionpoetry add opentelemetry-instrument-anthropic
poetry run opentelemetry-bootstrap -a install
poetry run opentelemetry-instrument python your_app.pyUsing auto instrumentation agentpoetry add opentelemetry-instrument-anthropic
poetry run opentelemetry-bootstrap -a install
poetry run opentelemetry-instrument python your_app.pyManuallyfrom anthropic import Anthropic, HUMAN_PROMPT, AI_PROMPT
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor

AnthropicInstrumentor().instrument()

client = Anthropic()
client.completions.create(
    prompt=f"{HUMAN_PROMPT}\nHello world\n{AI_PROMPT}",
    )🔗 Examplechat.pyIn this folder there's a readme on how to:Execute a chat completion against AnthropicSend traces to your console or your OLTP provider!AcknowledgmentsThank you very much toPhillip Carterand instrumentation by the OpenTelemetry Community! This instrumentation was heavily inspired by conversation and thisOpenAI library.
Package: opentelemetry-instrumentation-anthropic
OpenTelemetry Anthropic InstrumentationThis library allows tracing Anthropic prompts and completions sent with the officialAnthropic library.Installationpipinstallopentelemetry-instrumentation-anthropicPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-asyncio
AsyncioInstrumentor: Tracing Requests Made by the Asyncio LibraryThe opentelemetry-instrumentation-asyncio package allows tracing asyncio applications.
It also includes metrics for duration and counts of coroutines and futures. Metrics are generated even if coroutines are not traced.Set the names of coroutines you want to trace.exportOTEL_PYTHON_ASYNCIO_COROUTINE_NAMES_TO_TRACE=coro_name,coro_name2,coro_name3If you want to trace specific blocking functions executed with theto_threadfunction of asyncio, set the name of the functions inOTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE.exportOTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE=func_name,func_name2,func_name3You can enable tracing futures withOTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLEDexportOTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=trueRun instrumented application1. coroutine# export OTEL_PYTHON_ASYNCIO_COROUTINE_NAMES_TO_TRACE=sleepimportasynciofromopentelemetry.instrumentation.asyncioimportAsyncioInstrumentorAsyncioInstrumentor().instrument()asyncdefmain():awaitasyncio.create_task(asyncio.sleep(0.1))asyncio.run(main())2. future# export OTEL_PYTHON_ASYNCIO_FUTURE_TRACE_ENABLED=trueloop=asyncio.get_event_loop()future=asyncio.Future()future.set_result(1)task=asyncio.ensure_future(future)loop.run_until_complete(task)3. to_thread# export OTEL_PYTHON_ASYNCIO_TO_THREAD_FUNCTION_NAMES_TO_TRACE=funcimportasynciofromopentelemetry.instrumentation.asyncioimportAsyncioInstrumentorAsyncioInstrumentor().instrument()asyncdefmain():awaitasyncio.to_thread(func)deffunc():passasyncio.run(main())asyncio metric typesasyncio.process.duration(seconds) - Duration of asyncio processasyncio.process.count(count) - Number of asyncio processAPIInstallationpip install opentelemetry-instrumentation-asyncioReferencesOpenTelemetry asyncio/ TracingOpenTelemetry ProjectOpenTelemetry Python Examples
Package: opentelemetry-instrumentation-aws-lambda
This library provides an Instrumentor used to trace requests made by the Lambda
functions on the AWS Lambda service.It also provides scripts used by AWS Lambda Layers to automatically initialize
the OpenTelemetry SDK. Learn more on the AWS Distro for OpenTelemetry (ADOT)documentation for the Python Lambda Layer.Installationpip install opentelemetry-instrumentation-aws-lambdaReferencesOpenTelemetry AWS Lambda TracingOpenTelemetry ProjectOpenTelemetry Python ExamplesADOT Python Lambda Layer Documentation
Package: opentelemetry-instrumentation-bedrock
OpenTelemetry Bedrock InstrumentationThis library allows tracing any of AWS Bedrock's models prompts and completions sent withBoto3to Bedrock.Installationpipinstallopentelemetry-instrumentation-bedrockPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-cohere
OpenTelemetry Cohere InstrumentationThis library allows tracing calls to any of Cohere's endpoints sent with the officialCohere library.Installationpipinstallopentelemetry-instrumentation-coherePrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-digma-django
opentelemetry-instrumenation-digmaThis package provides instrumentation for additional span attributes provided on top of theopentelmetery-instrumentation-djangopackage.In order to be able to effectively glean code-object based insights for continuous feedback and map them back in the IDE, Digma inserts additional attribute into the OTEL resource attributes.Installing the packagepipinstallopentelemetry-instrumentation-digma-djangoVia pip, or add to your requirements/toml file and update your environment.Building the package from sourcepython-mbuildInstrumenting your Django projectThe Digma instrumentation depends on the official opentelemetry instrumentation or some other middleware to create and manage span lifecycle for each request.It can be used alongside the genericDigma Instrumentation helpersto quickly set up your OTEL configurationdigma_opentelmetry_boostrap(service_name='django-ms',digma_backend='http://localhost:5050',configuration=DigmaConfiguration().trace_this_package())DjangoInstrumentor().instrument()DigmaIntrumentor.instrument()The Digma django instrumentation will simply add the view function and namespace using the Opentelemtrysemantic convention. We have requested to include this functionality as a part of the more generalopentelemetry-instrumenation-djangopackage. Help us by upvoting thisFR!
Package: opentelemetry-instrumentation-digma-fastapi
opentelemetry-instrumentation-digma-fastapiThis package extends the default FastAPI instrumentation for OTEL to provide additional attributes which can be used to facilitate Continuous Feedback back to the code.Installing the packagepipinstallopentelemetry-instrumentation-digma-fastapiOr add it to your requirements/poetry file.Instrumenting your FastAPI projectEnable OpenTelemetry in your projectFirst, configure OpenTelemetry in your project. See theDigma instrumentationrepo for quick instructions on getting that done, whether you're already using OTEL or not.Make sure you've instrumented your FastAPI application using the standard Pypi package.Install the package:pip install opentelemetry-instrumentation-fastapiInstrument the FastAPI app by adding the following to your app setup:FastAPIInstrumentor.instrument_app(app)More info can be found in theofficial package documentation.Enable the Digma OpenTelemetry instrumentationBefore or after the call toFastAPIInstrumentor.instrumentto enable OTEL, also add the following:DigmaFastAPIInstrumentor().instrument_app(app)Check out some sample projectsYou can review a simple example in theFastAPI Sample RepoOr a more complex real world example in theGringotts Vault API application(which includes both FastAPI, Postgres, RabbitMQ and other technologies)
Package: opentelemetry-instrumentation-digma-flask
opentelemetry-instrumentation-digma-flaskInstrumentation package for the Flask platform adding code linkage to tracesInstalling the packagepipinstallopentelemetry-instrumentation-digma-flaskOr add it to your requirements/poetry file.Instrumenting your Flask projectEnable OpenTelemetry in your projectFirst, configure OpenTelemetry in your project. See theDigma instrumentationrepo for quick instructions on getting that done, whether you're already using OTEL or not.Make sure you've instrumented your Flask application using the standard Pypi package.Install the package:pip install opentelemetry-instrumentation-flaskInstrument the Flask app by adding the following to your app setup:FlaskInstrumentor.instrument_app(app)More info can be found in theofficial package documentation.Enable the Digma OpenTelemetry instrumentationAfter the call toFlaskInstrumentor.instrumentto enable OTEL, also add the following:DigmaFlaskInstrumentor().instrument_app(app)Check out some sample projectsComing soon!
Package: opentelemetry-instrumentation-falcon
This library builds on the OpenTelemetry WSGI middleware to track web requests
in Falcon applications.Installationpip install opentelemetry-instrumentation-falconConfigurationExclude listsTo exclude certain URLs from being tracked, set the environment variableOTEL_PYTHON_FALCON_EXCLUDED_URLS(orOTEL_PYTHON_EXCLUDED_URLSas fallback) with comma delimited regexes representing which URLs to exclude.For example,export OTEL_PYTHON_FALCON_EXCLUDED_URLS="client/.*/info,healthcheck"will exclude requests such ashttps://site/client/123/infoandhttps://site/xyz/healthcheck.Request attributesTo extract certain attributes from Falcon’s request object and use them as span attributes, set the environment variableOTEL_PYTHON_FALCON_TRACED_REQUEST_ATTRSto a comma
delimited list of request attribute names.For example,export OTEL_PYTHON_FALCON_TRACED_REQUEST_ATTRS='query_string,uri_template'will extract path_info and content_type attributes from every traced request and add them as span attritbues.Falcon Request object reference:https://falcon.readthedocs.io/en/stable/api/request_and_response.html#id1Request/Response hooksThe instrumentation supports specifying request and response hooks. These are functions that get called back by the instrumentation right after a Span is created for a request
and right before the span is finished while processing a response. The hooks can be configured as follows:def request_hook(span, req):
    pass

def response_hook(span, req, resp):
    pass

FalconInstrumentation().instrument(request_hook=request_hook, response_hook=response_hook)ReferencesOpenTelemetry Falcon InstrumentationOpenTelemetry ProjectOpenTelemetry Python Examples
Package: opentelemetry-instrumentation-haystack
OpenTelemetry Haystack InstrumentationThis library allows tracing complete LLM applications built withHaystack.Installationpipinstallopentelemetry-instrumentation-haystackPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-kstreams
opentelemetry-instrumentation-kstreamsOTEL for kstreamsVersion:0.1.1Installationpipinstall-Uopentelemetry_instrumentation_kstreamsUsagefromopentelemetry_instrumentation_kstreamsimportKStreamsInstrumentorKStreamsInstrumentor().instrument()ContributingSeeCONTRIBUTING.mdReleaseThe release process is automated by the CI, if you have to do it manually then:./scripts/install
./scripts/bump
./scripts/releaseNote: this will not release the docs.
Package: opentelemetry-instrumentation-langchain
OpenTelemetry Langchain InstrumentationThis library allows tracing complete LLM applications built withLangchain.Installationpipinstallopentelemetry-instrumentation-langchainPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-llamaindex
OpenTelemetry LlamaIndex InstrumentationThis library allows tracing complete LLM applications built withLlamaIndex.Installationpipinstallopentelemetry-instrumentation-llamaindexPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-openai
OpenTelemetry OpenAI InstrumentationThis library allows tracing OpenAI prompts and completions sent with the officialOpenAI library.Installationpipinstallopentelemetry-instrumentation-openaiPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-pubsub
Open Telemetry GCP PubSub Instrumentation for PythonThis package provides automatic instrumentation for thegoogle-cloud-pubsubclient library.Installationpipinstallopentelemetry-instrumentation-pubsubUsageInitiate the instrumentor after configuring yourOpen Telemetrytrace provider.fromgoogle.cloudimportpubsub_v1frompubsub_opentelemetryimportPubSubInstrumentationProvider# Instrument PubSubPubSubInstrumentationProvider().instrument()# Publish creates a span with PubSub specific attributeswithpubsub_v1.PublisherClient()aspublisher:publisher.publish(topic_name,b'My first message!')# Subscribe propagates the context from the received messagewithpubsub_v1.SubscriberClient()assubscriber:subscriber.subscribe(subscription_name,callback)DevelopmentInstall dependencies:makeinstallRun lint checks:makelintRun unit tests:maketestRun tests against supported Python versions (using tox):maketoxLicense
Package: opentelemetry-instrumentation-replicate
OpenTelemetry Replicate InstrumentationThis library allows tracing Replicate prompts and image generation sent with the officialreplicate library.Installationpipinstallopentelemetry-instrumentation-replicatePrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-requests
This library allows tracing HTTP requests made by therequestslibrary.Installationpip install opentelemetry-instrumentation-requestsConfigurationExclude listsTo exclude certain URLs from being tracked, set the environment variableOTEL_PYTHON_REQUESTS_EXCLUDED_URLS(orOTEL_PYTHON_EXCLUDED_URLSas fallback) with comma delimited regexes representing which URLs to exclude.For example,export OTEL_PYTHON_REQUESTS_EXCLUDED_URLS="client/.*/info,healthcheck"will exclude requests such ashttps://site/client/123/infoandhttps://site/xyz/healthcheck.ReferencesOpenTelemetry requests InstrumentationOpenTelemetry ProjectOpenTelemetry Python Examples
Package: opentelemetry-instrumentation-transformers
OpenTelemetry HuggingFace Transformers InstrumentationThis library allows tracing texte generation calls sent with the officialHuggingFace Transformers library.Installationpipinstallopentelemetry-instrumentation-transformersPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false
Package: opentelemetry-instrumentation-urllib
This library allows tracing HTTP requests made by theurlliblibrary.Installationpip install opentelemetry-instrumentation-urllibConfigurationRequest/Response hooksThe urllib instrumentation supports extending tracing behavior with the help of
request and response hooks. These are functions that are called back by the instrumentation
right after a Span is created for a request and right before the span is finished processing a response respectively.
The hooks can be configured as follows:# `request_obj` is an instance of urllib.request.Requestdefrequest_hook(span,request_obj):pass# `request_obj` is an instance of urllib.request.Request# `response` is an instance of http.client.HTTPResponsedefresponse_hook(span,request_obj,response)passURLLibInstrumentor.instrument(request_hook=request_hook,response_hook=response_hook))Exclude listsTo exclude certain URLs from being tracked, set the environment variableOTEL_PYTHON_URLLIB_EXCLUDED_URLS(orOTEL_PYTHON_EXCLUDED_URLSas fallback) with comma delimited regexes representing which URLs to exclude.For example,export OTEL_PYTHON_URLLIB_EXCLUDED_URLS="client/.*/info,healthcheck"will exclude requests such ashttps://site/client/123/infoandhttps://site/xyz/healthcheck.ReferencesOpenTelemetry urllib InstrumentationOpenTelemetry ProjectOpenTelemetry Python Examples
Package: opentelemetry-instrumentation-urllib3
This library allows tracing HTTP requests made by theurllib3library.Installationpip install opentelemetry-instrumentation-urllib3ConfigurationRequest/Response hooksThe urllib3 instrumentation supports extending tracing behavior with the help of
request and response hooks. These are functions that are called back by the instrumentation
right after a Span is created for a request and right before the span is finished processing a response respectively.
The hooks can be configured as follows:# `request` is an instance of urllib3.connectionpool.HTTPConnectionPooldefrequest_hook(span,request):pass# `request` is an instance of urllib3.connectionpool.HTTPConnectionPool# `response` is an instance of urllib3.response.HTTPResponsedefresponse_hook(span,request,response):passURLLib3Instrumentor().instrument(request_hook=request_hook,response_hook=response_hook)Exclude listsTo exclude certain URLs from being tracked, set the environment variableOTEL_PYTHON_URLLIB3_EXCLUDED_URLS(orOTEL_PYTHON_EXCLUDED_URLSas fallback) with comma delimited regexes representing which URLs to exclude.For example,export OTEL_PYTHON_URLLIB3_EXCLUDED_URLS="client/.*/info,healthcheck"will exclude requests such ashttps://site/client/123/infoandhttps://site/xyz/healthcheck.ReferencesOpenTelemetry urllib3 InstrumentationOpenTelemetry ProjectOpenTelemetry Python Examples
Package: opentelemetry-instrumentation-vertexai
OpenTelemetry VertexAI InstrumentationThis library allows tracing VertexAI prompts and completions sent with the officialVertexAI library.Installationpipinstallopentelemetry-instrumentation-vertexaiPrivacyBy default, this instrumentation logs prompts, completions, and embeddings to span attributes. This gives you a clear visibility into how your LLM application is working, and can make it easy to debug and evaluate the quality of the outputs.However, you may want to disable this logging for privacy reasons, as they may contain highly sensitive data from your users. You may also simply want to reduce the size of your traces.To disable logging, set theTRACELOOP_TRACE_CONTENTenvironment variable tofalse.TRACELOOP_TRACE_CONTENT=false