Skip to content
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

auth keeps defaulting to non-existent project #209

Open
inimaz opened this issue May 23, 2024 · 2 comments
Open

auth keeps defaulting to non-existent project #209

inimaz opened this issue May 23, 2024 · 2 comments
Labels
Bug Bug related to the Logfire Python SDK

Comments

@inimaz
Copy link

inimaz commented May 23, 2024

Description

Hello team!

I had a project called codecarbon that I have deleted.

And a file that contains just metric_gauges so it is using the default logfire instance.
Content of the file:

from logfire import metric_gauge
duration_gauge = metric_gauge(
    "codecarbon_duration", unit="(s)", description="Duration from last measure"
)

duration.set(data.duration)
...

The problem is, when I run this file, it keeps connecting to the old project that I have already deleted


inimaz:~/$  python logfire_metrics.py

Logfire project URL: https://logfire.pydantic.dev/inimaz/codecarbon              <==================
...

And I cannot see the metrics in any existing project.

I have tried removing the token in .logfire/default.toml and rerunning logfire auth, but I still see that it points to the deleted project. Is this normal?

Thanks a lot!

Python, Logfire & OS Versions, related packages (not required)

logfire="0.32.0"
platform="Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.31"
python="3.11.8 (main, Feb 26 2024, 21:39:34) [GCC 11.2.0]"
[related_packages]
requests="2.31.0"
protobuf="4.25.3"
rich="13.7.1"
opentelemetry-api="1.24.0"
opentelemetry-exporter-otlp-proto-common="1.24.0"
opentelemetry-exporter-otlp-proto-http="1.24.0"
opentelemetry-instrumentation="0.45b0"
opentelemetry-proto="1.24.0"
opentelemetry-sdk="1.24.0"
opentelemetry-semantic-conventions="0.45b0"
@inimaz inimaz added the Bug Bug related to the Logfire Python SDK label May 23, 2024
@alexmojaki
Copy link
Contributor

~/.logfire/default.toml contains credentials associated with your user (produced by logfire auth), not associated with a specific project.

The project credentials are stored in .logfire/logfire_credentials.json where this .logfire is now a local folder stored in the current working directory of the Python process using logfire, rather than the home folder. Delete that.

We're considering changing this so that all the data (for potentially multiple projects) is stored in the global folder (cc @samuelcolvin @Kludex) which might have helped make this a bit less confusing depending on the implementation.

@inimaz
Copy link
Author

inimaz commented May 24, 2024

Ah perfect thanks! It works now.
Maybe it is enough to mention it in the logs. When I do logfire auth I get the following log:

Your Logfire credentials are stored in ~/.logfire/default.toml

Something similar could be done when a new project is chosen?

The Logfire project credentials are stored in ~/YOUR_LOCAL_PROJECT/.logfire/logfire_credentials.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug related to the Logfire Python SDK
Projects
None yet
Development

No branches or pull requests

2 participants