mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
enhance: [cherry-pick] fix otel config param type & leak (#30068)
cherry pick from master pr: #29810 #30055 `SampleFraction` shall be float and all `C.CString` shall be freed Signed-off-by: Yudong Cai <yudong.cai@zilliz.com> Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
3ec02826bf
commit
14aa20b7f7
@ -19,7 +19,7 @@ namespace milvus::tracer {
|
||||
|
||||
struct TraceConfig {
|
||||
std::string exporter;
|
||||
int sampleFraction;
|
||||
float sampleFraction;
|
||||
std::string jaegerURL;
|
||||
std::string otlpEndpoint;
|
||||
bool oltpSecure;
|
||||
|
||||
@ -92,7 +92,7 @@ typedef struct CStorageConfig {
|
||||
|
||||
typedef struct CTraceConfig {
|
||||
const char* exporter;
|
||||
int sampleFraction;
|
||||
float sampleFraction;
|
||||
const char* jaegerURL;
|
||||
const char* otlpEndpoint;
|
||||
bool oltpSecure;
|
||||
|
||||
@ -45,12 +45,21 @@ func InitLocalChunkManager(path string) {
|
||||
}
|
||||
|
||||
func InitTraceConfig(params *paramtable.ComponentParam) {
|
||||
sampleFraction := C.float(params.TraceCfg.SampleFraction.GetAsFloat())
|
||||
nodeID := C.int(paramtable.GetNodeID())
|
||||
exporter := C.CString(params.TraceCfg.Exporter.GetValue())
|
||||
jaegerURL := C.CString(params.TraceCfg.JaegerURL.GetValue())
|
||||
endpoint := C.CString(params.TraceCfg.OtlpEndpoint.GetValue())
|
||||
defer C.free(unsafe.Pointer(exporter))
|
||||
defer C.free(unsafe.Pointer(jaegerURL))
|
||||
defer C.free(unsafe.Pointer(endpoint))
|
||||
|
||||
config := C.CTraceConfig{
|
||||
exporter: C.CString(params.TraceCfg.Exporter.GetValue()),
|
||||
sampleFraction: C.int(params.TraceCfg.SampleFraction.GetAsInt()),
|
||||
jaegerURL: C.CString(params.TraceCfg.JaegerURL.GetValue()),
|
||||
otlpEndpoint: C.CString(params.TraceCfg.OtlpEndpoint.GetValue()),
|
||||
nodeID: C.int(paramtable.GetNodeID()),
|
||||
exporter: exporter,
|
||||
sampleFraction: sampleFraction,
|
||||
jaegerURL: jaegerURL,
|
||||
otlpEndpoint: endpoint,
|
||||
nodeID: nodeID,
|
||||
}
|
||||
C.InitTrace(&config)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user