in model/topology/heron/queueing_models.py [0:0]
def __init__(self, graph_client: GremlinClient, metrics_client: MetricsClient, paths, topology_id: str,
cluster: str, environ: str, start: dt.datetime, end: dt.datetime, other_kwargs: dict):
"""
This function initializes relevant variables to calculate queue related metrics
given an M/M/c model.
"""
super().__init__(metrics_client, paths, topology_id, cluster, environ, start, end, other_kwargs)
# ensure that paths are populated
if len(self.paths) == 0:
raise Exception("Topology paths are unavailable")
# Get the service time for all elements
service_times: pd.DataFrame = self.metrics_client.get_service_times(
topology_id, cluster, environ, start, end, **other_kwargs)
# Drop the system streams
self.service_times = (service_times[~service_times["stream"].str.contains("__")])
# Get arrival rates per ms for all instances
# We should not be using this any more.
arrival_rate: pd.DataFrame = self.metrics_client.get_tuple_arrivals_at_stmgr(
topology_id, cluster, environ, start, end, **other_kwargs)
# Finding mean waiting time and validating queue size
self.service_rate = convert_service_times_to_rates(service_times)
self.arrival_rate = convert_arr_rate_to_mean_arr_rate(arrival_rate)