-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(azure-search): add Azure AI Search instrumentation and semantic conventions #4392
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
Open
sanyamk23
wants to merge
1
commit into
traceloop:main
Choose a base branch
from
sanyamk23:feat/azure-ai-search-instrumentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/opentelemetry-instrumentation-azure-search/.python-version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.10 |
80 changes: 80 additions & 0 deletions
80
packages/opentelemetry-instrumentation-azure-search/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # OpenTelemetry Azure AI Search Instrumentation | ||
|
|
||
| [](https://opensource.org/licenses/Apache-2.0) | ||
|
|
||
| This library allows tracing client-side calls to Azure AI Search using OpenTelemetry. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install opentelemetry-instrumentation-azure-search | ||
| ``` | ||
|
|
||
| ## Supported Operations | ||
|
|
||
| ### SearchClient | ||
|
|
||
| | Method | Span Name | Attributes Captured | | ||
| |--------|-----------|-------------------| | ||
| | `search()` | `azure_search.search` | search_text, top, filter, index_name | | ||
| | `get_document()` | `azure_search.get_document` | index_name | | ||
| | `autocomplete()` | `azure_search.autocomplete` | autocomplete_text, index_name | | ||
| | `suggest()` | `azure_search.suggest` | suggest_text, index_name | | ||
| | `index_documents()` | `azure_search.index_documents` | documents_count, succeeded_count | | ||
| | `upload_documents()` | `azure_search.upload_documents` | documents_count, succeeded_count | | ||
| | `merge_documents()` | `azure_search.merge_documents` | documents_count, succeeded_count | | ||
| | `merge_or_upload_documents()` | `azure_search.merge_or_upload_documents` | documents_count, succeeded_count | | ||
| | `delete_documents()` | `azure_search.delete_documents` | documents_count, succeeded_count | | ||
| | `get_document_count()` | `azure_search.get_document_count` | documents_count | | ||
|
|
||
| ### SearchIndexClient | ||
|
|
||
| | Method | Span Name | Attributes Captured | | ||
| |--------|-----------|-------------------| | ||
| | `create_index()` | `azure_search.create_index` | index_name | | ||
| | `create_or_update_index()` | `azure_search.create_or_update_index` | index_name | | ||
| | `delete_index()` | `azure_search.delete_index` | index_name | | ||
| | `get_index()` | `azure_search.get_index` | index_name | | ||
| | `list_indexes()` | `azure_search.list_indexes` | — | | ||
| | `get_index_statistics()` | `azure_search.get_index_statistics` | index_doc_count, index_size_bytes | | ||
| | `analyze_text()` | `azure_search.analyze_text` | index_name | | ||
| | `get_service_statistics()` | `azure_search.get_service_statistics` | service_usage, service_limit | | ||
|
|
||
| ### SearchIndexerClient | ||
|
|
||
| | Method | Span Name | Attributes Captured | | ||
| |--------|-----------|-------------------| | ||
| | `create_indexer()` | `azure_search.create_indexer` | indexer_name | | ||
| | `create_or_update_indexer()` | `azure_search.create_or_update_indexer` | indexer_name | | ||
| | `delete_indexer()` | `azure_search.delete_indexer` | indexer_name | | ||
| | `get_indexer()` | `azure_search.get_indexer` | indexer_name | | ||
| | `get_indexers()` | `azure_search.get_indexers` | — | | ||
| | `get_indexer_status()` | `azure_search.get_indexer_status` | indexer_status | | ||
| | `run_indexer()` | `azure_search.run_indexer` | indexer_name | | ||
| | `reset_indexer()` | `azure_search.reset_indexer` | indexer_name | | ||
| | `create_data_source_connection()` | `azure_search.create_data_source_connection` | — | | ||
| | `create_skillset()` | `azure_search.create_skillset` | — | | ||
| | `get_skillset()` | `azure_search.get_skillset` | — | | ||
| | `delete_skillset()` | `azure_search.delete_skillset` | — | | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Auto-instrumentation via Traceloop SDK | ||
|
|
||
| ```python | ||
| from traceloop.sdk import Traceloop | ||
|
|
||
| Traceloop.init(app_name="my-rag-app") | ||
| ``` | ||
|
|
||
| ### Manual instrumentation | ||
|
|
||
| ```python | ||
| from opentelemetry.instrumentation.azure_search import AzureSearchInstrumentor | ||
|
|
||
| AzureSearchInstrumentor().instrument() | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| This project is licensed under the Apache License 2.0 — see the [LICENSE](LICENSE) file for details. | ||
Empty file.
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
README attribute tables don't match implementation.
Line 40 documents
analyze_text()as capturingindex_name, but the input-attribute extraction in__init__.pyonly setsAZURE_SEARCH_INDEX_NAMEfor("get_index", "delete_index", "create_index", "create_or_update_index")—analyze_textis not in that list, andSearchIndexClientinstances don't carry the_index_namefallback used forSearchClient.Lines 56-58 document
create_skillset(),get_skillset(), anddelete_skillset()as capturing no attributes ("—"), but the implementation does setAZURE_SEARCH_INDEXER_NAMEfrom the skillset name for these methods (see the__init__.pyreview comment on this).Update the table once the corresponding implementation is fixed, so the documented attributes match actual span data.
Also applies to: 56-58
🤖 Prompt for AI Agents