示例#1
0
def getAllPoints():
    dict = {}
    i = 0
    s1 = 'latitude '
    s2 = 'longitude '
    points = CrashLocationPoint.query.all()
    for point in points:
        lat = point.latitude
        long = point.longitude
        #print(lat)
        t1 = s1 + str(i)
        t2 = s2 + str(i)
        dict[t1] = lat
        dict[t2] = long
        i = i + 1
        statsd.set('point_loop_i', i, tags=["environment:laptop"])

    print(dict)
    jdict = json.dumps(dict)

    return Response(jdict, status=200, mimetype = 'application/json')
 def set(self, metric, value, tags=[]):
     statsd.set(metric=metric, value=value, tags=tags)
     if self.debug:
         print "{0} = {1} :: type={3} :: tags={2}".format(metric, value, tags, 'set')
from datadog import initialize, statsd
import time
import random

options = {
    'statsd_host': '127.0.0.1',
    'statsd_port': 8125
}

initialize(**options)

statsd.increment('example_metric.increment', tags=["environment:dev"])
statsd.decrement('example_metric.decrement', tags=["environment:dev"])
statsd.gauge('example_metric.gauge', 40, tags=["environment:dev"])
statsd.set('example_metric.set', 40, tags=["environment:dev"])
statsd.histogram('example_metric.histogram', random.randint(0, 20), tags=["environment:dev"])

with statsd.timed('example_metric.timer', tags=["environment:dev"]):
    # do something to be measured
    time.sleep(random.randint(0, 10))

statsd.distribution('example_metric.distribution', random.randint(0, 20), tags=["environment:dev"])
示例#4
0
 def send_statsd_set(self, set_name, value):
     statsd.set(set_name, value)
示例#5
0
def set(key, value):
    statsd.set(key, value)
 def set(self, metric, value, tags=[]):
     statsd.set(metric=metric, value=value, tags=tags)
     if self.debug:
         print "{0} = {1} :: type={3} :: tags={2}".format(
             metric, value, tags, 'set')
示例#7
0
def set(key, value, tags=None):
    statsd.set(metric=key, value=value, tags=tags)