add docker or baremetal existence

This commit is contained in:
Joel Falknau 2024-12-28 12:39:34 +10:00
parent 7033406ba6
commit f92d339a5d
No known key found for this signature in database
3 changed files with 21 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from django.apps import apps
from celery import shared_task
from .models import AnalyticsTokens, AnalyticsIdentifier
from .utils import (
existence_baremetal_or_docker,
install_stat_addons,
install_stat_tokens,
install_stat_users)
@ -77,6 +78,7 @@ def analytics_daily_stats():
users = install_stat_users()
tokens = install_stat_tokens()
addons = install_stat_addons()
existence_type = existence_baremetal_or_docker()
logger.debug("Running Daily Analytics Upload")
analytics_event(namespace='allianceauth.analytics',
@ -84,6 +86,11 @@ def analytics_daily_stats():
label='existence',
value=1,
event_type='Stats')
analytics_event(namespace='allianceauth.analytics',
task='send_install_stats',
label=existence_type,
value=1,
event_type='Stats')
analytics_event(namespace='allianceauth.analytics',
task='send_install_stats',
label='users',

View File

@ -34,3 +34,16 @@ def install_stat_addons() -> int:
The Number of Installed Apps"""
addons = len(list(apps.get_app_configs()))
return addons
def existence_baremetal_or_docker() -> str:
"""Checks the Installation Type of an install
Returns
-------
str
existence_baremetal or existence_docker"""
docker_tag = os.getenv('AA_DOCKER_TAG')
if docker_tag:
return "existence_docker"
return "existence_baremetal"

View File

@ -27,6 +27,7 @@ Analytics comes preloaded with our Google Analytics token, and the three types o
Our Daily Stats contain the following:
- A phone-in task to identify a server's existence
- A phone-in task to identify if a server is Bare-Metal or Dockerized
- A task to send the Number of User models
- A task to send the Number of Token Models
- A task to send the Number of Installed Apps