-
Notifications
You must be signed in to change notification settings - Fork 0
[PD1-465] Fixed Cvec class params #3
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
michal-chrobok-semantive
commented
Jul 2, 2025
- Removed email and publishable key from Cvec class constructor params
- Renamed password to api_key
- Added logic for fetching publishable key from /config endpoint
- Added logic for construction of user email for auth
- Modified example scripts
# Conflicts: # examples/add_metric_data_arrow_example.py # examples/add_metric_data_example.py # examples/get_metric_arrow_example.py # examples/get_metric_data_objects_example.py # examples/get_metrics_example.py # examples/get_spans_example.py # pyproject.toml
…all for config and construction of user email for auth.
PD1-465 SDK should use API Key rather than username & password
cvec-python/examples/get_spans_example.py Lines 7 to 9 in 336e17c
The SDK should be responsible for splitting the API Key into "username" and "password". The requirement to split the key is an implementation detail due to the limitation of our current auth provider. In the future, we will improve this (by moving to a more capable auth provider), but will strive to maintain compatibility. Therefore, the user should just manage the single API Key as an opaque secret value. Similarly, get the CVEC_PUBLISHABLE_KEY from the Also see this SDK setup: https://github.com/CVector-Energy/cvec-iot/pull/2/files#diff-c989b78806f11ebc41fcc62b339831ff9ef486a0643d9390d3b291ee31fed4f1R34-R37 |
joshuanapoli
left a comment
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.
I think that sandbox backend is setup for, but there is still some discrepancy with the SDK:
(.venv) joshuanapoli@mac cvec-python % CVEC_HOST=https://sandbox.cvector.dev CVEC_API_KEY=cva_hHs0CbkKALxMnxUdI9hanF0TBPvvvr1HjG6O python
Python 3.13.3 (main, Apr 8 2025, 13:54:08) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cvec
... from datetime import datetime
...
>>> cvec = cvec.CVec()
>>> for item in cvec.get_metrics(start_at=datetime(2025, 7, 14, 10, 0, 0), end_at=datetime(2025, 7, 14, 11, 0, 0)):
... print(item.name)
...
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
for item in cvec.get_metrics(start_at=datetime(2025, 7, 14, 10, 0, 0), end_at=datetime(2025, 7, 14, 11, 0, 0)):
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joshuanapoli/src/cvec-python/src/cvec/cvec.py", line 275, in get_metrics
response_data = self._make_request("GET", "/api/metrics/", params=params)
File "/Users/joshuanapoli/src/cvec-python/src/cvec/cvec.py", line 143, in _make_request
response.raise_for_status()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/joshuanapoli/src/cvec-python/.venv/lib/python3.13/site-packages/requests/models.py", line 1026, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://sandbox.cvector.dev/api/metrics/?start_at=2025-07-14T10%3A00%3A00&end_at=2025-07-14T11%3A00%3A00
baftinho
left a comment
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.
LGTM
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
4e09f36 to
1b3e6a9
Compare
joshuanapoli
left a comment
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.
Thank you @baftinho for the more comprehensive test. This worked for me, tested in the scope of https://github.com/CVector-Energy/cvec-backend/pull/53