canonical / tempo-k8s-operator

This charmed operator automates the operational procedures of running Grafana Tempo, an open-source tracing backend.
https://charmhub.io/tempo-k8s
Apache License 2.0
3 stars 3 forks source link

Support pydantic version <2 in the tempo-k8s tracing charm lib #109

Closed shayancanonical closed 1 month ago

shayancanonical commented 1 month ago

Bug Description

We, in the data platform team, would like to relate to tempo-k8s to trace our charms. However, we already have various other charm libs (some from the observability team) that results in conflict with pydantic. For example, in mysql, some of these libs include:

However, the tempo_k8s/v1/tracing.py charm lib has a requirement of pydantic>=2. This is causing expected conflicts when installing requirements

To Reproduce

  1. Clone mysql-operator repo
  2. charmcraft fetch-lib charms.tempo_k8s.v1.tracing
  3. update pyproject.toml to use pydantic>=2 on line 29
  4. poetry lock --no-update
  5. tox -e build-production

Errors in build

Environment

charmcraft version: 2.6.0 tox --version: 4.15.0 poetry --version: 1.8.3

Relevant log output

2024-05-23 19:17:23.076 :: 2024-05-23 19:17:18.953 ::    ::   Installing build dependencies: finished with status 'done'                                                                                           
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:18.954 ::    ::   Getting requirements to build wheel: started                                                                                                         
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.260 ::    ::   Getting requirements to build wheel: finished with status 'done'                                                                                     
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.263 ::    ::   Preparing metadata (pyproject.toml): started                                                                                                         
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.562 ::    ::   Preparing metadata (pyproject.toml): finished with status 'done'                                                                                     
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.564 ::    :: Requirement already satisfied: opentelemetry-exporter-otlp-proto-http==1.21.0 in ./staging-venv/lib/python3.10/site-packages (1.21.0)                  
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.601 ::    :: Requirement already satisfied: ops>=2.0.0 in ./staging-venv/lib/python3.10/site-packages (2.9.0)                                                       
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.657 ::    :: Collecting ops>=2.0.0                                                                                                                                  
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.658 ::    ::   Using cached ops-2.13.0.tar.gz (443 kB)                                                                                                              
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:19.704 ::    ::   Installing build dependencies: started                                                                                                               
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:21.243 ::    ::   Installing build dependencies: finished with status 'done'                                                                                           
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:21.244 ::    ::   Getting requirements to build wheel: started                                                                                                         
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:21.479 ::    ::   Getting requirements to build wheel: finished with status 'done'                                                                                     
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:21.482 ::    ::   Installing backend dependencies: started                                                                                                             
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.401 ::    ::   Installing backend dependencies: finished with status 'done'                                                                                         
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.402 ::    ::   Preparing metadata (pyproject.toml): started                                                                                                         
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.668 ::    ::   Preparing metadata (pyproject.toml): finished with status 'done'                                                                                     
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.676 ::    :: ERROR: Cannot install pydantic<2 and >=1.10 and pydantic>=2 because these package versions have conflicting dependencies.                              
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    ::                                                                                                                                                        
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    :: The conflict is caused by:                                                                                                                             
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    ::     The user requested pydantic<2 and >=1.10                                                                                                           
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    ::     The user requested pydantic>=2                                                                                                                     
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    ::                                                                                                                                                        
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    :: To fix this you could try to:                                                                                                                          
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    :: 1. loosen the range of package versions you've specified                                                                                               
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    :: 2. remove package versions to allow pip attempt to solve the dependency conflict                                                                       
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    ::                                                                                                                                                        
2024-05-23 19:17:23.076 :: 2024-05-23 19:17:22.677 ::    :: ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts              

Additional context

One suggested way to resolve this would be to add support for pydantic<2 in the tempo-k8s tracing charm lib

mmkay commented 1 month ago

Hi @shayancanonical! We already have tracing v2 library that allows you to use it with both pydantic v1 and v2.

As we'll be dropping v1.tracing soon you can bump to v2 and that should resolve your problem with tempo. See for instance this PR to see the changes that you need to do in charm code between v1 and v2.

In case you encounter any issues please let us know and feel free to reach out / open up an issue :)