@@ -56,12 +56,15 @@ def __init__(
56
56
autocreate_database = False ,
57
57
clock = None ,
58
58
global_tags = None ,
59
- reporting_precision = ReportingPrecision .SECONDS
59
+ reporting_precision = ReportingPrecision .SECONDS ,
60
+ retention_policy = "autogen"
60
61
):
61
62
"""
62
63
:param reporting_precision: The precision in which the reporter reports to influx.
63
64
The default is seconds. This is a tradeoff between precision and performance. More
64
65
coarse precision may result in significant improvements in compression and vice versa.
66
+ :param retention_policy: The name of the retention policy of your database,
67
+ InluxDB retention policy default value is "autogen".
65
68
"""
66
69
super (InfluxReporter , self ).__init__ (registry , reporting_interval , clock )
67
70
self .prefix = prefix
@@ -73,6 +76,7 @@ def __init__(
73
76
self .server = server
74
77
self .autocreate_database = autocreate_database
75
78
self ._did_create_database = False
79
+ self .retention_policy = retention_policy
76
80
77
81
if global_tags is None :
78
82
self .global_tags = {}
@@ -185,7 +189,7 @@ def _stringify_tags(self, metric):
185
189
return ""
186
190
187
191
def _get_url (self ):
188
- path = "/write?db=%s&precision=%s" % (self .database , self .reporting_precision .value )
192
+ path = "/write?db=%s&precision=%s&rp=%s " % (self .database , self .reporting_precision .value , self . retention_policy )
189
193
return "%s://%s:%s%s" % (self .protocol , self .server , self .port , path )
190
194
191
195
def _add_auth_data (self , request ):
0 commit comments