@@ -56,12 +56,15 @@ def __init__(
5656 autocreate_database = False ,
5757 clock = None ,
5858 global_tags = None ,
59- reporting_precision = ReportingPrecision .SECONDS
59+ reporting_precision = ReportingPrecision .SECONDS ,
60+ retention_policy = "autogen"
6061 ):
6162 """
6263 :param reporting_precision: The precision in which the reporter reports to influx.
6364 The default is seconds. This is a tradeoff between precision and performance. More
6465 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".
6568 """
6669 super (InfluxReporter , self ).__init__ (registry , reporting_interval , clock )
6770 self .prefix = prefix
@@ -73,6 +76,7 @@ def __init__(
7376 self .server = server
7477 self .autocreate_database = autocreate_database
7578 self ._did_create_database = False
79+ self .retention_policy = retention_policy
7680
7781 if global_tags is None :
7882 self .global_tags = {}
@@ -185,7 +189,7 @@ def _stringify_tags(self, metric):
185189 return ""
186190
187191 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 )
189193 return "%s://%s:%s%s" % (self .protocol , self .server , self .port , path )
190194
191195 def _add_auth_data (self , request ):
0 commit comments