Skip to content

Conversation

@tito
Copy link
Contributor

@tito tito commented Jan 23, 2025

This PR include the initialization of many new metadata variables that are available in the API:

  • environment: env or sdk init
  • project_id: env, sdk init or tracer init
  • application_id: env, sdk init or tracer init
  • client_id: env, sdk init or tracer init
  • session_id: tracer init

Some more fields are set now:

  • utc_datetime is set
  • request_id is set with one uuid every time the ImpactRow is sent
  • trace_id is set with the highest root tracer
  • session_id is set at tracer init if the user provide it

One trick in this PR is how the fields are set in the ImpactRow. If we set a field to None, it will be included in the json sent as we use model_dump with exclude_unset=True.
If we sent metadata with None (let's say application_id: None), the mock server will fail, and the test suite too.

So the function today set the first possible value of the values passed.

tito added 4 commits January 22, 2025 18:40
…level

- `environment`: env or sdk init
- `project_id`: env, sdk init or tracer init
- `application_id`: env, sdk init or tracer init
- `client_id`: env, sdk init or tracer init
- `session_id`: tracer init

Some more fields are set now:
- `utc_datetime` is set
- `request_id` is set with one uuid every time the ImpactRow is sent
- `trace_id` is set with the highest root tracer
- `session_id` is set at tracer init if the user provide it
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 12920205472

Details

  • 49 of 50 (98.0%) changed or added relevant lines in 4 files are covered.
  • 53 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+15.4%) to 95.993%

Changes Missing Coverage Covered Lines Changed/Added Lines %
scope3ai/lib.py 41 42 97.62%
Files with Coverage Reduction New Missed Lines %
scope3ai/tracers/huggingface/chat.py 1 98.84%
scope3ai/tracers/huggingface/speech_to_text.py 1 98.18%
scope3ai/tracers/huggingface/translation.py 2 96.61%
scope3ai/api/tracer.py 3 93.75%
scope3ai/tracers/openai/chat.py 3 95.74%
scope3ai/tracers/anthropic/chat.py 4 97.08%
scope3ai/worker.py 5 89.58%
scope3ai/api/client.py 10 81.71%
scope3ai/tracers/litellm/chat.py 10 88.76%
scope3ai/lib.py 14 93.18%
Totals Coverage Status
Change from base Build 12553763769: 15.4%
Covered Lines: 2204
Relevant Lines: 2296

💛 - Coveralls

@tito tito merged commit cafc008 into main Jan 23, 2025
19 checks passed
@tito tito deleted the mathieu/add-metadata-global-and-tracer branch January 23, 2025 16:27
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.

3 participants