Skip to main content

Respan Dify instrumentation

Trace the dify-client Python package with Respan.

This package patches Dify's Service API client methods and emits canonical Respan spans for chat, completion, workflow, file, feedback, application, and conversation requests. Streaming responses are traced when the returned stream is consumed.

Install

pip install respan-ai respan-instrumentation-dify dify-client

Usage

import os

from dify_client import ChatClient
from respan import Respan
from respan_instrumentation_dify import DifyInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[DifyInstrumentor()],
)

client = ChatClient(os.environ["DIFY_CHAT_API_KEY"])
response = client.create_chat_message(
    inputs={},
    query="Reply with one concise sentence about tracing.",
    user="respan-example-user",
    response_mode="blocking",
)
response.raise_for_status()
print(response.json()["answer"])

respan.flush()
respan.shutdown()

Use Respan.propagate_attributes(...) to attach customer, thread, trace group, metadata, or prompt context to Dify spans.

Metadata

Release files for respan-instrumentation-dify 0.1.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 respan-instrumentation-dify 0.1.1
File Size Uploaded
respan_instrumentation_dify-0.1.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-dify 0.1.1
File Interpreter ABI Platform
respan_instrumentation_dify-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.6 kB

Release files / respan_instrumentation_dify-0.1.1.tar.gz

Download URL respan_instrumentation_dify-0.1.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7ac77367fb3a93dd0245a1c3d412d3476df0d194de9a476ebe9a90d1a45f177c
BLAKE2b-256 checksum
How to use checksums
717a05fa3ac8ce8cecc8b66e568bb84c8cd44b1487bb43362ab00e59796ac1af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_dify-0.1.1-py3-none-any.whl

Download URL respan_instrumentation_dify-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91dccdc4dae1554e1f7ce9b33e90cae9da98c784bad879d4f4b0f8cedd0cd773
BLAKE2b-256 checksum
How to use checksums
5cc1e20c63018d3c2ac3b5628929f47e7bc585b5a7fd18e1cd76fdf6bd6f9aa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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