-
Notifications
You must be signed in to change notification settings - Fork 726
fix(ollama): Implemented meter in the instrumentation #2741
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
Conversation
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.
❌ Changes requested. Reviewed everything up to 1276b31 in 3 minutes and 7 seconds
More details
- Looked at
279
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py:446
- Draft comment:
Tuple assignment mistake: When metrics are disabled, the tuple is set to three values (None, None, None), while only two (token_histogram, duration_histogram) are expected. - Reason this comment was not posted:
Marked as duplicate.
2. packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py:237
- Draft comment:
Potential bug: Using 'res' outside the loop in _accumulate_streaming_response may be undefined if the response is empty. - Reason this comment was not posted:
Comment was on unchanged code.
3. packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py:237
- Draft comment:
Verify the use of the dictionary union operator (res | accumulated_response) in streaming responses. Ensure that the merging behavior is as intended. - Reason this comment was not posted:
Confidence changes required:50%
<= threshold50%
None
4. packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py:241
- Draft comment:
The function name '_aaccumulate_streaming_response' contains an extra 'a' at the beginning. Consider renaming it (for example, to '_accumulate_streaming_response_async') to improve readability and follow naming conventions. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_ysXShdjstHS5VGQs
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Outdated
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Outdated
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Outdated
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Outdated
Show resolved
Hide resolved
packages/opentelemetry-instrumentation-ollama/opentelemetry/instrumentation/ollama/__init__.py
Outdated
Show resolved
Hide resolved
…strumentation/ollama/__init__.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…strumentation/ollama/__init__.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
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.
Thanks @adharshctr! Do you mind adding tests for this?
Added |
eefa7ba
to
a9b6422
Compare
feat(instrumentation): ...
orfix(instrumentation): ...
.Important
Added metrics collection to Ollama instrumentation using histograms for token usage and operation duration.
token_histogram
andduration_histogram
to track token usage and operation duration in__init__.py
._create_metrics()
to initialize histograms for metrics.is_metrics_enabled()
to check if metrics collection is enabled._wrap()
and_awrap()
to record metrics using histograms._set_response_attributes()
to record token usage intoken_histogram
._accumulate_streaming_response()
and_aaccumulate_streaming_response()
to passtoken_histogram
.OllamaInstrumentor._instrument()
to initialize and pass histograms to wrapped methods.This description was created by
for 1276b31. It will automatically update as commits are pushed.