def show_morphology_analysis_in_time(self): if self.__is_zipkin: start_time = time.time() start_timestamp = my_time.to_unix_time_millis( self.__start_date_time_str) end_timestamp = my_time.to_unix_time_millis( self.__end_date_time_str) self.view.display_time( 'start_time:', my_time.from_timestamp_to_datetime(start_timestamp), start_timestamp) self.view.display_time( 'end_time:', my_time.from_timestamp_to_datetime(end_timestamp), end_timestamp) timestamps = my_time.timestamp_millis_split( start_timestamp, end_timestamp) timestamps = my_list.tuple_list(timestamps) for timestamp_1, timestamp_2 in timestamps: dependencies = zipkin.get_dependencies(end_ts=timestamp_2, lookback=timestamp_2 - timestamp_1) message = cl.service_morphology(dependencies, timestamp_1, timestamp_2) self.view.display_message(message[0], message[1]) self.view.display_message( 'Time processing', 'finish in {} seconds'.format(time.time() - start_time))
def show_most_popular_service_call_count(self): if self.__is_zipkin: start_time = time.time() start_timestamp = my_time.to_unix_time_millis( self.__start_date_time_str) end_timestamp = my_time.to_unix_time_millis( self.__end_date_time_str) self.view.display_time( 'start_time:', my_time.from_timestamp_to_datetime(start_timestamp), start_timestamp) self.view.display_time( 'end_time:', my_time.from_timestamp_to_datetime(end_timestamp), end_timestamp) dependencies = zipkin.get_dependencies(end_ts=end_timestamp, lookback=end_timestamp - start_timestamp) message = cl.service_call_count(dependencies, start_timestamp, end_timestamp) self.view.display_message(message[0], message[1]) self.view.display_message( 'Time processing', 'finish in {} seconds'.format(time.time() - start_time))
def process_all_metrics_in_time(service_names, timestamp_1, timestamp_2): global g_previous_graph message = list() dependencies = zipkin.get_dependencies(end_ts=timestamp_2, lookback=timestamp_2 - timestamp_1) if not dependencies: message.append([ 'No services from {} to {}'.format( my_time.from_timestamp_to_datetime(timestamp_1), my_time.from_timestamp_to_datetime(timestamp_2)), 'Can\'t perform calculation!' ]) else: message.append( service_neighbours(dependencies, timestamp_1, timestamp_2)) message.append(service_degree(dependencies, timestamp_1, timestamp_2)) message.append( service_call_count(dependencies, timestamp_1, timestamp_2)) message, g_previous_graph = service_morphology(dependencies, timestamp_1, timestamp_2, g_previous_graph) message.append(message) for service_name in service_names: traces = zipkin.get_traces(service_name=service_name, end_ts=timestamp_2, lookback=timestamp_2 - timestamp_1) if not traces: message.append([ 'No traces found from {} to {} for service {}'.format( my_time.from_timestamp_to_datetime(timestamp_1), my_time.from_timestamp_to_datetime(timestamp_2), service_name), '\nCan\'t calculate service status codes' ]) else: span_trees = my_trace.generate_span_trees(traces) trace_metrics_data = my_trace.extract_metrics(span_trees) message.append( service_status_codes(service_name, traces, timestamp_1, timestamp_2)) # trace_quality_analysis(service_name, trace_metrics_data) message.append( service_response_time_analysis(service_name, trace_metrics_data, timestamp_1, timestamp_2)) print(message)