-
Notifications
You must be signed in to change notification settings - Fork 481
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
Django environment classification defaulting to dev
#3069
Comments
Hi @mitchdawson1982, thank you for reporting this problem. Could you provide us a link to one of the error events where the environment was set to |
Hey @szokeasaurusrex -> Shared the link directly with you |
Hi @szokeasaurusrex Sure here is one of the links I have noticed that the trace details are populated with much more information for a working example. |
@mitchdawson1982 Could you try using the As far as I can tell the SDK will never set the environment to Since the faulty events also have a different release though, is it at all possible the |
Thanks for the suggestion I will try this out when I get time. In terms of where the events are originating from, I cant envisage them coming from anywhere else. We have tests but these are manually invoked, the scenario I have described is where the app is being run normally. |
Hi @sentrivana I have performed further testing this morning with and without the I have been thinking about the rationale provided for this behaviour and would like to clarify some of the points. Where correct alerts are seen the release hash matches the correct commit hash i.e. this alert has the latest commit hash in main. However for incorrect alerts we see ResultsI have tested several with the |
In summary, when the wrong And this other one that runs the project does not run it from a Git repository. How the Sentry Python SDK sets the Do you have the project running in Google App Engine, Azure, AWS, Heroku, Codebuild, Circle CI, GitLab CI/CD, or Travis CI? |
I'm not as yet convinced that the environment is being set wrong. On the tests where we have populated the ENV variable and sentry_sdk.init(environment=ENV or "local"), I have in nearly all cases printed out the value of ENV to the terminal after sentry_sdk.init(environment=ENV or "local") in settings.py to validate the correct value is passed as expected. Where I have done so this has always been consistent for both correct and incorrect alerts and therefore gives me a high level of confidence that the right value has always been passed to the sdk environment argument. Once this value has been passed to the sdk init, how could our code manipulate this value? I see this behaviour on local development laptops and three separate k8 pods. |
Is it possible |
Thanks, I am currently investigating this. |
@mitchdawson1982 I see the linked MoJ issue is closed -- have you been able to resolve this or do you need any additional support from our end? |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
Closing. Please reopen if not solved. |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
^2.0.1
Steps to Reproduce
We have a Django application running across three environments (test, dev and preprod), each environment has an
ENV
variable configured with the respective value. This variable is used as the environment argument in the sdk init.We noticed that events were being received in Sentry with an environment of
dev
only, i.e.test
orpreprod
were never used despite being configured correctly. When validating this behaviour locally I have also found that periodically alerts will come in with the environment asdev
despite an entirely different value being provided. I have further noticed that when this occurs, the release value is also different from a working example.Expected Result
When
ENV=new-env1
received alerts should show the environment asnew-env1
Actual Result
When
ENV=new-env1
received alerts periodically show the environment asdev
The text was updated successfully, but these errors were encountered: