返回DROPME状态时统计application metrics
This commit is contained in:
@@ -112,7 +112,8 @@ struct session_runtime_action_context
|
||||
char udp_data_dropme;
|
||||
char set_latency_flag;
|
||||
char direction;
|
||||
char padding[5];
|
||||
char state;
|
||||
char padding[4];
|
||||
enum TSG_METHOD_TYPE method_type;
|
||||
enum TSG_PROTOCOL protocol;
|
||||
char *l4_protocol;
|
||||
|
||||
@@ -938,7 +938,7 @@ int session_increase_traffic_statis_update(struct traffic_packet_info *current,
|
||||
int session_application_metrics_update(const struct streaminfo *a_stream, struct session_runtime_action_context *srt_action_context, int thread_seq)
|
||||
{
|
||||
if((tsg_get_current_time_ms() - srt_action_context->last_update_metric_time < g_tsg_para.app_metric_update_interval_ms)
|
||||
&& a_stream->opstate!=OP_STATE_CLOSE && a_stream->pktstate!=OP_STATE_CLOSE)
|
||||
&& a_stream->opstate!=OP_STATE_CLOSE && a_stream->pktstate!=OP_STATE_CLOSE && !(srt_action_context->state&APP_STATE_DROPME))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -2335,8 +2335,6 @@ extern "C" unsigned char TSG_MASTER_UDP_ENTRY(const struct streaminfo *a_udp, vo
|
||||
udp_srt_context->srt_action_context->direction=get_direction(a_udp);
|
||||
}
|
||||
|
||||
session_application_metrics_update(a_udp, udp_srt_context->srt_action_context, thread_seq);
|
||||
|
||||
if(udp_srt_context->srt_action_context->udp_data_dropme==0)
|
||||
{
|
||||
state2=tsg_master_data_entry(a_udp, (void **)&(udp_srt_context->srt_process_context), thread_seq, a_packet);
|
||||
@@ -2355,12 +2353,17 @@ extern "C" unsigned char TSG_MASTER_UDP_ENTRY(const struct streaminfo *a_udp, vo
|
||||
|
||||
if(state1&APP_STATE_DROPME || state2&APP_STATE_DROPME || a_udp->opstate==OP_STATE_CLOSE)
|
||||
{
|
||||
//session_application_metrics_update(a_udp, udp_srt_context->srt_action_context, thread_seq);
|
||||
udp_srt_context->srt_action_context->state=(state1|state2);
|
||||
session_application_metrics_update(a_udp, udp_srt_context->srt_action_context, thread_seq);
|
||||
dictator_free(thread_seq, *pme);
|
||||
*pme=NULL;
|
||||
|
||||
session_state_sync_in_opening_and_closing(a_udp, a_udp->opstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
session_application_metrics_update(a_udp, udp_srt_context->srt_action_context, thread_seq);
|
||||
}
|
||||
|
||||
return (state1|state2);
|
||||
}
|
||||
@@ -2389,8 +2392,6 @@ extern "C" unsigned char TSG_MASTER_TCPALL_ENTRY(const struct streaminfo *a_tcp,
|
||||
srt_action_context->last_update_metric_time = tsg_get_current_time_ms();
|
||||
}
|
||||
|
||||
session_application_metrics_update(a_tcp, srt_action_context, thread_seq);
|
||||
|
||||
if(srt_action_context->set_latency_flag==0)
|
||||
{
|
||||
srt_action_context->set_latency_flag=session_tcp_establish_latency_ms_set(a_tcp, thread_seq, a_packet);
|
||||
@@ -2405,9 +2406,14 @@ extern "C" unsigned char TSG_MASTER_TCPALL_ENTRY(const struct streaminfo *a_tcp,
|
||||
|
||||
if(state&APP_STATE_DROPME || a_tcp->pktstate==OP_STATE_CLOSE)
|
||||
{
|
||||
//session_application_metrics_update(a_tcp, srt_action_context, thread_seq);
|
||||
srt_action_context->state=state;
|
||||
session_application_metrics_update(a_tcp, srt_action_context, thread_seq);
|
||||
session_state_sync_in_opening_and_closing(a_tcp, a_tcp->pktstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
session_application_metrics_update(a_tcp, srt_action_context, thread_seq);
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1179,6 +1179,7 @@ struct TLD_handle_t *TLD_create(int thread_id)
|
||||
_handle->valueAllocator =new MemoryPoolAllocator<>(g_tsg_log_instance->rapidjson_chunk_capacity);
|
||||
_handle->document = new Document(_handle->valueAllocator);
|
||||
_handle->document->SetObject();
|
||||
tsg_stat_log_handle_update(LOG_HANDLE_CREATE_CNT, 1);
|
||||
|
||||
return _handle;
|
||||
}
|
||||
@@ -1341,19 +1342,18 @@ int set_session_flags(struct tsg_log_instance_t *_instance, struct TLD_handle_t
|
||||
|
||||
int set_l4_protocol(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, const struct streaminfo *a_stream)
|
||||
{
|
||||
const struct session_runtime_action_context *srt_action_context=session_runtime_action_context_get(a_stream);
|
||||
struct session_runtime_action_context *srt_action_context=(struct session_runtime_action_context *)session_runtime_action_context_get(a_stream);
|
||||
if(srt_action_context==NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *l4_protocol=srt_action_context_get_l4_protocol(srt_action_context);
|
||||
if(l4_protocol==NULL)
|
||||
|
||||
if(srt_action_context->l4_protocol==NULL)
|
||||
{
|
||||
l4_protocol=session_l4_protocol_label_update(a_stream);
|
||||
srt_action_context->l4_protocol=session_l4_protocol_label_update(a_stream);
|
||||
}
|
||||
|
||||
TLD_append(_handle, _instance->id2field[LOG_COMMON_L4_PROTOCOL_LABEL].name, (void *) l4_protocol, TLD_TYPE_STRING);
|
||||
TLD_append(_handle, _instance->id2field[LOG_COMMON_L4_PROTOCOL_LABEL].name, (void *)srt_action_context->l4_protocol, TLD_TYPE_STRING);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ enum LOG_STATUS
|
||||
|
||||
enum LOG_HANDLE
|
||||
{
|
||||
LOG_HANDLE_CREATE_CNT,
|
||||
LOG_HANDLE_CREATE_CNT=0,
|
||||
LOG_HANDLE_DUP_CNT,
|
||||
LOG_HANDLE_APPEND_CNT,
|
||||
LOG_HANDLE_FREE_CNT,
|
||||
|
||||
Reference in New Issue
Block a user