Example #1
0
	def __init__(self,configData,timeManager):
		#时间管理器,用于储存更新时间数据
		self.timeManager = timeManager
		#配置信息
		self.configData = configData
		#配置logger
		logging.config.fileConfig(self.configData.loggerConfPath)
		self.logger = logging.getLogger(self.configData.loggerName)
		#最近一段时间的数据窗口长度
		self.windowLength = int(configData.windowLength)
		#所有的统计状态
		self.totalStatusKey = "total"
		self.allInOneDic = {}
		self.allInOneDic[self.totalStatusKey] = statsItem(self.windowLength)
		#用于标记新的key值
		self.newKeyFlag = False
		#标准标记符
		self.stdIndex = ":"
		#不同数据类型key尾缀
		self.keySuffixList = [":avgReqCost",":reqSuccessRatio",":reqNum"]
		#前缀
		self.keyPrefix = "eros:server:"
		#日志类型
		self.logTypeList = ["ERROR","INFO","WARNING"]
		self.ccProducer = chartConfProducer(self.configData.keyTablePath,self.keyPrefix,self.keySuffixList)
Example #2
0
	def addNewStatsItem(self,key):
		if key not in self.allInOneDic:
			self.allInOneDic[key] = statsItem(self.windowLength)
			self.newKeyFlag = True
Example #3
0
	def addNewStatsItem(self,stdKey,parseKey):
		if parseKey not in self.parseKeysDic:
			self.allInOneDic[stdKey] = statsItem(self.windowLength)
			self.parseKeysDic[parseKey] = stdKey
			self.newKeyFlag = True