idou老师教你学istio 31:Istio-proxy的report流程
Istio-proxy的report主要是将envoy采集到的连接attributes的信息上报给控制面的mixer,它的入口在request_handler_impl.cc文件中,这里需要打开enable_mixer_report开关,提取出report_data中的attribute信息,调用SendReport发送出去。 SendReport的实现在client_context_base.cc中,跳转到client_impl中。 client_impl.cc跳转到report_batch中。 report_batch.cc中会在batch_compresser中添加attributes作为向mixer发起的请求report,这里的Add是一个bool,判断是否所有的上次请求所用的attributes都在本次的report的请求中。 attribute_compressor.cc中定义了Add的方法,利用CompressByDict更新压缩过的attributes &pb,如果在这一步压缩的变量全部都在,那么compressbydict的返回值是true,会更新pb。如果有的attributes的变量不存在,那么返回值为false,不更新pb,回到上一张图。 Compress是否成功在下图的函数中判断,这里用到的是delta_update,在delta_update.cc中