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

OpenAI instrumentation docs fixes #2988

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

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Nov 9, 2024

*************************

When using the instrumentor, all clients will automatically trace OpenAI chat completion operations
and capture prompts and completions as events.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only happens when OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is set as true, right? Can we highlight the parameter here as well?

Copy link

@dasiths dasiths Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worthwhile putting the example (json) format of the content shape that is emitted.

Also might be worth stating that if doing this you may have to configure your pipeline to redact any sensitive info contained in the content.

Copy link
Contributor Author

@lmolkova lmolkova Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All examples can be found in semantic conventions - https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-events.md and it'd be hard to keep them in sync if we duplicate.

I don't think we should have a redaction example specific to OpenAI instrumentation.

@lzchen lzchen added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Nov 12, 2024
@@ -1,4 +1,4 @@
OpenTelemetry OpenAI Instrumentation Example
OpenTelemetry OpenAI Zero-Code Instrumentation Example
============================================
Copy link
Contributor

@lzchen lzchen Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nit about the zero-code example. opentelemetry-instrument will use otlp and grpc by default, which differs slightly from the coded example that uses otlp/http.

If you want to modify the zero-code example to use EXACTLY the same components, you will also have to set metrics to None explicitly:

dotenv run -- opentelemetry-instrument --traces_exporter otlp_proto_http --metrics_exporter None --logs_exporter otlp_proto_http python main.py

@@ -1,4 +1,4 @@
OpenTelemetry OpenAI Instrumentation Example
OpenTelemetry OpenAI Zero-Code Instrumentation Example
============================================

This is an example of how to instrument OpenAI calls with zero code changes,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users will also need to set env var OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED to true to enable autoinstrumentation of logging.

Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some additional comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants