MCPcopy Index your code
hub / github.com/statsd/statsd / format

Method format

examples/python_example.py:90–111  ·  view source on GitHub ↗

General format function. >>> StatsdClient.format("example.format", 2, "T") {'example.format': '2|T'} >>> formatted = StatsdClient.format(("example.format31", "example.format37"), "2", "T") >>> formatted['example.format31'] == '2|T' True >>> f

(keys, value, _type)

Source from the content-addressed store, hash-verified

88
89 @staticmethod
90 def format(keys, value, _type):
91 """
92 General format function.
93
94 >>> StatsdClient.format("example.format", 2, "T")
95 {'example.format': '2|T'}
96 >>> formatted = StatsdClient.format(("example.format31", "example.format37"), "2", "T")
97 >>> formatted['example.format31'] == '2|T'
98 True
99 >>> formatted['example.format37'] == '2|T'
100 True
101 >>> len(formatted)
102 2
103 """
104 data = {}
105 value = "{0}|{1}".format(value, _type)
106 # TODO: Allow any iterable except strings
107 if not isinstance(keys, (list, tuple)):
108 keys = [keys]
109 for key in keys:
110 data[key] = value
111 return data
112
113 @staticmethod
114 def sample(data, sample_rate):

Callers 8

update_statsMethod · 0.95
timingMethod · 0.80
incrementMethod · 0.80
gaugeMethod · 0.80
sendMethod · 0.80
doSendMethod · 0.80
flushMethod · 0.80
sampleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected