Comments (7)
from drf-api-logger.
Hi Ashif, DRF API Logger should work the same as in your development server. Maybe you forget to migrate after adding DRF API Logger in production. Does the production server use different settings? (example: production_settings.py, development_settings.py, in some projects I've seen completely different settings.) Please share DEF API Logger settings you used. Regards, Vishal Anand, Technical Lead, LinkedIn https://www.linkedin.com/in/vishal-anand-530ba0b5/ | M: +91-8009417767
…
On Sat, Mar 27, 2021 at 4:48 PM Asif Khan @.***> wrote: Everything is perfectly working in development environment. All my APIs that I am using POSTMAN desktop application is logging in drf_api_logger model. In nutshell all is working perfect as what I am looking. But once I transfer my code to production environment drf_api_logger is not logging any API calls from POSTMAN from both version desktop and web base POSTMAN. I tried by looking options in drf_api_logger documentation, nothing works. One thing I noticed the difference in development and production is of "http" vs "https". Can you please advice how I can make drf_api_logger to work for my production environment. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#12>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7SDTGBFFLJL5YFLZD6LTDTFW5HZANCNFSM4Z42A6ZQ .
Hi Vishal,
Thanks for your response. I have redeploy my code again on production with one of changes that I have done in your code to customize drf_api_logger for my specific purpose. My project structure is SAAS based so I have add one orgcode in the model of drf_api_logger to control all APIs at organisation level and same I have to done in admin.py to shows api of logged in user of that organisation only.
So I correct it and it is working now. Thanks again for your response and it is great support for my project.
from drf-api-logger.
I don't think this has to do with HTTPS. I have 3 environments: development, staging and production. Only production has HTTPS and yet it fails both in staging and production. Development works fine.
The database has the correct tables, but when I check there are no entries.
My environments are very similar to each other. The only main difference I can think of is Nginx, which is a common feature between staging and production. Which application gateway did you use for your tests, @asifkhan69?
from drf-api-logger.
Try setting headers in Nginx.
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass .....
.....
from drf-api-logger.
That is not the problem. I did some debugging and found out the following:
Since you create an instance of Queue for each thread, filling each queue will take longer. The chances of having the same user filling up the same queue is ~1/t.
I had the default DRF_LOGGER_QUEUE_MAX_SIZE
, having a total o 4 threads for the process. This means that in theory, it can take up to 200 entries to bulk insert some 50 entries.
I suggest adding to the documentation that the real Queue size is multiplied by the amount of threads that you configure for the gateway.
Additionally, the reason why we could not see that in development is because the Django development HTTP server has only one thread.
Another thing: I am not sure if DRF_LOGGER_INTERVAL
is working as intended. I made several tests where the queue length was < DRF_LOGGER_QUEUE_MAX_SIZE
and it did not work. I have not debugged this thoroughly though.
from drf-api-logger.
If you are using gunicorn with workers in production, each worker (process) is going to have its own DRF API Logger thread.
Based on the server load, gunicorn will assign the request to any worker. Each worker is going to have a unique request always.
So there is no chance that the same request will go to DRF API Logger thread.
I'm already having millions of records in the logs, never faced any problem related to threads or queues.
I'll check the rest of the other queries.
from drf-api-logger.
I didn't express myself correctly. I meant to say the chances of having the same user filling up one queue is the probability I mentioned, since two requests might not be necessarily be added to the same queue.
There aren't that many API requests in my system, so that's probably why I caught this problem. If you have millions of requests, the queue may get filled up before the countdown from DRF_LOGGER_INTERVAL
ends. I did a test and this is exactly what happened.
To reproduce this problem, try to insert only a couple of requests to the queue and wait. It is never inserted to the database.
I am using uwsgi, by the way.
from drf-api-logger.
Related Issues (20)
- how to collectstatic in an offline environment HOT 1
- Don't write response with method get HOT 4
- Follow README but log nothing HOT 5
- Body not logged HOT 2
- 500 not logged HOT 2
- User Details to Logs HOT 4
- Maximum request and response body size HOT 2
- DRF-API-Logger empty log HOT 1
- The "Number of API calls" table does not work with LANGUAGE_CODE='ru'
- Remove old logs HOT 5
- Guidance on how to test this HOT 1
- Cant open the website after installing this package HOT 2
- It doesn't work properly. HOT 1
- Admin page is broken after installation HOT 3
- Function mask_sensitive_data doesn't cover list of dicts HOT 2
- Will this work with GraphQL? HOT 2
- Logger did not log any data for some endpoint on database
- Storing Tracing ID in Database
- storing user, view, view method, HOT 1
- Add History Table to increase performance of the view HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drf-api-logger.