Skip to content

dburik/promptflow-otel-instrumentation

Repository files navigation

Auto-instrumenting Prompt Flow Application usign OpenTelemetry

Note: this sample is based on the source code exploration and is not officially documented as a way to setup OpenTelemetry for Prompt Flow applications.

How to run the sample

  1. Install dependencies:
pip install -r requirements.txt
  1. Create an Azure OpenAI connection:
pf connection create --file ./connections/azure_openai.yaml --set api_key=<your API key> api_base=<API base URL>
  1. Create an .env file based on the .env.example file and fill with correct values for your environment

  2. Run the flow:

pf flow test --flow .\chat-with-wikipedia\

Instrumentation

Instrumentation is setup in the instrumentation.py file and is based on Azure Monitor Opentelemetry Distro client library for Python.

By importing the instrumentation module in PF nodes, we make it execute the configure_tracing_and_logging() top level function.

This function configures the OpenTelemetry SDK with the Azure Monitor exporter and sets up the tracing and logging that is subsequently used by the Prompt Flow for instrumentation of nodes.

One transaction example in Azure Application Insights

prompt flow execution in app insights

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published