Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openinference Instrumentation Proof-Of-Concept #60

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CalebCourier
Copy link
Contributor

This PR adds OpenInference's GuardrailsInstrumentation on top of the exist FlaskInstrumentation for OTEL. The spans captured by this new instrumentation can be fed to any OTEL-compliant collector including Arize's Phoenix.

.env file with the OTEL settings I was using

OTEL_PYTHON_TRACER_PROVIDER=sdk_tracer_provider
OTEL_SERVICE_NAME=my-service
OTEL_TRACES_EXPORTER=otlp
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST="Accept-Encoding,User-Agent,Referer"
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE="Last-Modified,Content-Type"
OTEL_METRICS_EXPORTER=none
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

Notes on Productionization

  1. Since this requires another third party package, we probably want to make this instrumentation optional. That means switching the dependency to a pip extra, performing an optional import in guardrails_api/otel/traces.py, and then only instrumenting when the package is installed. This pip extra would also need to be reflected in the core guardrails-ai package for users utilizing guardrails start.
  2. We still need to collaborate with Arize to see how we can/should attach the span attributes that they collect in other instrumentations. See the notion task for more info: https://www.notion.so/guardrailsai/Arize-integration-4fd0096121094cc2896a6200786fb7b0?pvs=4

@CalebCourier CalebCourier requested review from zsimjee and a team July 18, 2024 14:25
@CalebCourier CalebCourier marked this pull request as ready for review July 18, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant