mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 00:07:40 -02:30
add a minimal framework for generating analytics/metrics
annotate queries & add license analytics
This commit is contained in:
committed by
Christian Adams
parent
7b4c63037a
commit
c586fa9821
30
awx/main/management/commands/gather_analytics.py
Normal file
30
awx/main/management/commands/gather_analytics.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import logging
|
||||
from awx.main.analytics import gather, ship
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
'''
|
||||
Gather AWX analytics data
|
||||
'''
|
||||
|
||||
help = 'Gather AWX analytics data'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--ship', dest='ship', action='store_true',
|
||||
help='Enable to ship metrics via insights-client')
|
||||
|
||||
def init_logging(self):
|
||||
self.logger = logging.getLogger('awx.main.analytics')
|
||||
handler = logging.StreamHandler()
|
||||
handler.setLevel(logging.DEBUG)
|
||||
handler.setFormatter(logging.Formatter('%(message)s'))
|
||||
self.logger.addHandler(handler)
|
||||
self.logger.propagate = False
|
||||
|
||||
def handle(self, *args, **options):
|
||||
tgz = gather()
|
||||
self.init_logging()
|
||||
self.logger.debug(tgz)
|
||||
if options.get('ship'):
|
||||
ship(tgz)
|
||||
Reference in New Issue
Block a user