zhebrak / django-statsy Goto Github PK
View Code? Open in Web Editor NEWStatistics for your Django project
License: MIT License
Statistics for your Django project
License: MIT License
Template inclusion via {% template tag %} or directly with {% static path/to/api.js %}.
Records limit setting
Cleanup tasks
Hello! I would like to use uWSGI
spooler
for async tasks.
It can be almost the same as tasks.py
:
from django_uwsgi.decorators import spool
from statsy.models import StatsyObject
@spool
def send(**kwargs):
obj = StatsyObject.create(**kwargs)
return obj.serialize()
@spool
def send_callback(result, callback_path):
module, callback = callback_path.rsplit('.', 1)
module = importlib.import_module(module)
callback = getattr(module, callback)
return callback(result)
but file name can be smth like spooler.py or smth like that.
and then in uwsgi.ini
:
spooler = spooler
spooler-import = statsy.spooler
just needed some workaround to switch between celery
and spooler
(or even rq
can be added) in core.py
:
send_task.spool(kwargs=self._clean_kwargs_async(kwargs), link=callback)
personally I prefer not to use celery
when there's not so lots of tasks, and since I deploy ьн project via uwsgi
, I can use uwsgi
's spooler
and don't need to install and setup huge celery
.
Not showing time for 00 minutes for some reason.
Check whether self.created_at is string and modify it from ISO 8601 to current formatting.
ISO 8601 — YYYY-MM-DDTHH:MM:SS.mmmmmm
: name —> id
We can store everything with float only.
For
query = StatsyObject.objects.by_time(start=start, end=end, include_end=False)
the filter is not formed correctly
python 3.5
To reproduce:
statsy.send(
group="x", event="y", value=0
)
Make it happen.
Visual blocks or sql-like.
group='group_name' and event='event_name'
or
group_1
group_2 (x)
event_1 (x)
event_2
label_1
label_2
label_3
Hi, I'm interested in using django-statsy
in my Django project and I would like to try it. After adding it
to my requirements, I've problems to resolve my dependencies, because the version of python-dateutil
is fixed here:
django-statsy/requirements.txt
Line 4 in d74845e
Is this still necessary? And since the project has not been updated for some time: Are
there any objections using it with Django 2.2?
/stats/today/
/stats/2016.07.13/
/stats/group:event:label/
etc
statsy.objects.for_object(obj)
moar!
For example to monitor cpu usage, memory usage and lots of other things. In our case point created every minute.
statsy.objects.fetch('blogs:page_view:entry')
statsy.objects.fetch('blogs:page_view')
statsy.objects.fetch('blogs::entry')
or something
Stats objects count per group/event.
Group and event list.
Added @statsy
in my views.py
import statsy # By the way you did not mention about importing it in views in README
@statsy.watch
def filetree(request)
...
In urls.py got
url(r'^$', main.views.filetree, name=")
And have an error
Request Method: | GET |
---|---|
http://localhost:8000/ | |
1.11.1 | |
AttributeError | |
'function' object has no attribute 'status_code' | |
/home/user/Env/dj_test/lib/python3.5/site-packages/django/middleware/common.py in process_response, line 115 | |
/home/user/Env/dj_test3/bin/python | |
3.5.2 |
django 1.9
Steal some.
Warning in 1.9
"Value" is a descriptor.
I am hesitant to report this as a bug, because I'm not doing anything out of the ordinary with my project, and I would have expected someone else to see this, but it does appear to be a bug.
In the stats.py file, the stats_numbers
classmethod has a prototype of:
def stats_numbers(cls, data):
I am seeing an error as follows:
TypeError: stats_numbers() takes exactly 2 arguments (3 given)
from the getattr
function call in the classmethod _stats
(same file - line 37 in my version).
It also prevents the graph on the stats page from rendering (which makes sense since the server code threw an exception).
Looking at the rest of the stats_*
classmethods in the class, they all have an additional input parameter (either period
or key
) that the stats_numbers
method is missing, and the _stats
function is definitely calling it with 2 explicit arguments (and 1 implied argument).
I believe the solution is to change the prototype of stats_numbers
to as follows:
def stats_numbers(cls, data, period):
and to not use the data provided in the period
argument. (Could also name it ignore
or something else descriptive).
Anyway, doing this in my environment solved the problem, and the graph renders correctly.
On save e.x.
per category and total
— demo account
— stats population
— docs
aggregation label in model (?)
manage.py command with options
aggregation task
aggregate like default month period display: 6 hours (4 * 30 entries)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.