def create_metrics(apps, schema_editor):
    """Create one metric"""
    metric = Metric()
    metric.name = 'confidence'
    metric.description = 'Tracks model confidence'
    metric.save()

    metric = Metric()
    metric.name = 'Image size'
    metric.description = 'Records input image size'
    metric.save()

    metric = Metric()
    metric.name = 'Pixel intensity'
    metric.description = 'Records pixel average intensity of your images'
    metric.save()
Пример #2
0
def metrics(request):
    key = get_agent_key(request)
    host = Host.objects.get(agent_key=key)
    host.save()  # update last_updated
    if not host.enabled:
        return HttpResponse(status=403)
    metrics = json.loads(request.body)
    for metric in metrics:
        # add counters
        for counter in metric.get('counters'):
            m = Metric()
            m.metric_type = metric.get('type')
            m.source = metric.get('container_id')
            m.counter = counter.get('name')
            m.value = counter.get('value')
            m.unit = counter.get('unit')
            m.save()
    return HttpResponse()