def apdex_metrics(self, stats): """Return a generator yielding the apdex metrics for this node. """ if not self.name: return if self.suppress_apdex: return # The apdex metrics are only relevant to web transactions. if self.type != 'WebTransaction': return # The magic calculations based on apdex_t. The apdex_t # is based on what was in place at the start of the # transaction. This could have changed between that # point in the request and now. satisfying = 0 tolerating = 0 frustrating = 0 if self.errors: frustrating = 1 else: if self.duration <= self.apdex_t: satisfying = 1 elif self.duration <= 4 * self.apdex_t: tolerating = 1 else: frustrating = 1 # Generate the full apdex metric. if (self.group in ('Uri', 'NormalizedUri') and self.name.startswith('/')): name = 'Apdex/%s%s' % (self.group, self.name) else: name = 'Apdex/%s/%s' % (self.group, self.name) yield ApdexMetric(name=name, satisfying=satisfying, tolerating=tolerating, frustrating=frustrating, apdex_t=self.apdex_t) # Generate the rollup metric. yield ApdexMetric(name='Apdex', satisfying=satisfying, tolerating=tolerating, frustrating=frustrating, apdex_t=self.apdex_t)
def apdex_metrics(self, stats): """Return a generator yielding the apdex metrics for this node. """ if not self.base_name: return if self.suppress_apdex: return # The apdex metrics are only relevant to web transactions. if self.type != 'WebTransaction': return # The magic calculations based on apdex_t. The apdex_t # is based on what was in place at the start of the # transaction. This could have changed between that # point in the request and now. satisfying = 0 tolerating = 0 frustrating = 0 if self.errors and False in (error.expected for error in self.errors): frustrating = 1 else: if self.duration <= self.apdex_t: satisfying = 1 elif self.duration <= 4 * self.apdex_t: tolerating = 1 else: frustrating = 1 # Generate the full apdex metric. yield ApdexMetric( name='Apdex/%s' % self.name_for_metric, satisfying=satisfying, tolerating=tolerating, frustrating=frustrating, apdex_t=self.apdex_t) # Generate the rollup metric. yield ApdexMetric( name='Apdex', satisfying=satisfying, tolerating=tolerating, frustrating=frustrating, apdex_t=self.apdex_t)