From 39ac1dede97e55d4a0e363552f7f2baaf162bc4d Mon Sep 17 00:00:00 2001 From: luqiuwen Date: Tue, 29 Jan 2019 14:46:46 +0600 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0HTTP=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=97=A5=E5=BF=97=E7=9A=84=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97=EF=BC=8C=E7=BB=9F=E4=B8=80HTTP=E5=A4=B4?= =?UTF-8?q?=E9=83=A8=E6=A0=87=E5=BF=97=E7=9A=84=E5=BD=A2=E5=BC=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/business/pangu-http/src/pangu_http.cpp | 3 ++- plugin/business/pangu-http/src/pangu_logger.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 7470e3d..58c0c40 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -1225,7 +1225,8 @@ static void cache_read_on_succ(future_result_t * result, void * user) tfe_http_std_field_write(ctx->cached_response, TFE_HTTP_CONT_TYPE, meta->content_type); tfe_http_std_field_write(ctx->cached_response, TFE_HTTP_LAST_MODIFIED, meta->last_modified); tfe_http_std_field_write(ctx->cached_response, TFE_HTTP_ETAG, meta->etag); - tfe_http_nonstd_field_write(ctx->cached_response, "X-Cache-Lookup", "Hit From TFE"); + + tfe_http_nonstd_field_write(ctx->cached_response, "X-TG-Cache-Lookup", "HIT"); snprintf(temp, sizeof(temp), "%lu", meta->content_length); tfe_http_std_field_write(ctx->cached_response, TFE_HTTP_CONT_LENGTH, temp); diff --git a/plugin/business/pangu-http/src/pangu_logger.cpp b/plugin/business/pangu-http/src/pangu_logger.cpp index f79e1e6..2416495 100644 --- a/plugin/business/pangu-http/src/pangu_logger.cpp +++ b/plugin/business/pangu-http/src/pangu_logger.cpp @@ -294,12 +294,14 @@ int pangu_send_log(struct pangu_logger* handle, const struct pangu_log* log_msg) { continue; } + per_hit_obj=cJSON_Duplicate(common_obj, 1); cJSON_AddNumberToObject(per_hit_obj, "cfg_id", log_msg->result[i].config_id); cJSON_AddNumberToObject(per_hit_obj, "service", log_msg->result[i].service_id); log_payload = cJSON_Print(per_hit_obj); - fprintf(stderr, "%s\n", log_payload); + TFE_LOG_DEBUG(handle->local_logger, "%s", log_payload); + kafka_status = rd_kafka_produce(handle->kafka_topic, RD_KAFKA_PARTITION_UA, RD_KAFKA_MSG_F_COPY, log_payload, strlen(log_payload), NULL, 0, NULL); free(log_payload);