def gauge_statistic(): Gauge('statistic.shares.twitter').report( TweeterShareStatistic.objects.count()) Gauge('statistic.shares.facebook').report(FBShareStatistic.objects.count()) Gauge('statistic.shares.email').report(EmailShareStatistic.objects.count()) total_key = st_sub_fetch_handler.total_key.get() if total_key: total_key = int(total_key) else: total_key = 0 Gauge('statistic.views.subtitles').report(total_key)
def report_metrics(): from utils.metrics import Gauge sl_total, sl_unsynced, sl_broken, sl_outdated, sl_done, \ sv_total, sv_unsynced, sv_broken, sv_outdated, sv_done = get_counts() Gauge('data-model-refactor.subtitle-language.total').report(sl_total) Gauge('data-model-refactor.subtitle-language.unsynced').report(sl_unsynced) Gauge('data-model-refactor.subtitle-language.broken').report(sl_broken) Gauge('data-model-refactor.subtitle-language.outdated').report(sl_outdated) Gauge('data-model-refactor.subtitle-language.done').report(sl_done) Gauge('data-model-refactor.subtitle-version.total').report(sv_total) Gauge('data-model-refactor.subtitle-version.unsynced').report(sv_unsynced) Gauge('data-model-refactor.subtitle-version.broken').report(sv_broken) Gauge('data-model-refactor.subtitle-version.outdated').report(sv_outdated) Gauge('data-model-refactor.subtitle-version.done').report(sv_done)
def gauge_statistic_languages(): from apps.videos.models import SubtitleLanguage, ALL_LANGUAGES lang_names = dict(ALL_LANGUAGES) lang_names[u''] = 'Unknown' ls = SubtitleLanguage.objects.values('language').annotate( count=Count('language')) for l in ls: language_code = l['language'] language_name = lang_names.get(language_code, 'Unknown') count = l['count'] name = graphite_slugify(language_name) Gauge('statistic.languages.%s.count' % name).report(count)
def gauge_teams(): from teams.models import Task, Team, TeamMember Gauge('teams.Task').report(Task.objects.count()) Gauge('teams.Team').report(Team.objects.count()) Gauge('teams.TeamMember').report(TeamMember.objects.count())
def gauge_auth(): Gauge('auth.CustomUser').report(CustomUser.objects.count())
def gauge_tpas(): count = ThirdPartyAccount.objects.filter(type=VIDEO_TYPE_YOUTUBE).count() Gauge('youtube.accounts_linked').report(count)
def gague_billing_records(): from teams.models import BillingRecord Gauge('teams.BillingRecord').report(BillingRecord.objects.count())
def gauge_videos_long(): Gauge('videos.Subtitle').report(SubtitleVersion.objects.subtitle_count())
def gauge_videos(): Gauge('videos.Video').report(Video.objects.count()) Gauge('videos.Video-captioned').report( SubtitleLanguage.objects.video_count()) Gauge('videos.SubtitleVersion').report(SubtitleVersion.objects.count()) Gauge('videos.SubtitleLanguage').report(SubtitleLanguage.objects.count())
def gauge_comments(): Gauge('comments.Comment').report(Comment.objects.count())