From 9a6ae60530c1239e7fef952c9ed04b0fa8a7d6a8 Mon Sep 17 00:00:00 2001 From: Tim Mwangi Date: Thu, 2 Oct 2025 12:27:34 -0700 Subject: [PATCH 1/2] ENGTAI-69966: Add compression config --- ENV_VARS.md | 1 + gen/go/go.mod | 2 +- gen/go/go.sum | 10 ++- gen/go/proto/v1/config.proto | 3 + gen/go/v1/config.pb.go | 62 +++++++++++-------- gen/go/v1/config.pbloader.go | 10 +++ proto/hypertrace/agent/config/v1/config.proto | 3 + 7 files changed, 59 insertions(+), 32 deletions(-) diff --git a/ENV_VARS.md b/ENV_VARS.md index 915787d..38594ae 100644 --- a/ENV_VARS.md +++ b/ENV_VARS.md @@ -14,6 +14,7 @@ Agents can be configured using environment variables: | HT_REPORTING_CERT_FILE | Certificate file containing the CA to verify the server's certificate. This is for private certificates. If this is set then `secure` above should also be set to `true`. | | HT_REPORTING_METRIC_ENDPOINT | Represents the endpoint for reporting the metrics. For OTLP metric reporter type use http://api.traceable.ai:4317 | | HT_REPORTING_ENABLE_GRPC_LOADBALANCING | When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing | +| HT_REPORTING_COMPRESSION_ENABLED | Enable compression | | HT_DATA_CAPTURE_HTTP_HEADERS_REQUEST | When `false` it disables the capture for the request in a client/request operation | | HT_DATA_CAPTURE_HTTP_HEADERS_RESPONSE | When `false` it disables the capture for the response in a client/request operation | | HT_DATA_CAPTURE_HTTP_BODY_REQUEST | When `false` it disables the capture for the request in a client/request operation | diff --git a/gen/go/go.mod b/gen/go/go.mod index c4a1d90..24e032f 100644 --- a/gen/go/go.mod +++ b/gen/go/go.mod @@ -5,7 +5,7 @@ go 1.24 require ( github.com/ghodss/yaml v1.0.0 github.com/stretchr/testify v1.11.1 - google.golang.org/protobuf v1.36.8 + google.golang.org/protobuf v1.36.10 ) require ( diff --git a/gen/go/go.sum b/gen/go/go.sum index 48f177f..ab3a2f5 100644 --- a/gen/go/go.sum +++ b/gen/go/go.sum @@ -2,16 +2,14 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/gen/go/proto/v1/config.proto b/gen/go/proto/v1/config.proto index cebc39f..a792dca 100644 --- a/gen/go/proto/v1/config.proto +++ b/gen/go/proto/v1/config.proto @@ -73,6 +73,9 @@ message Reporting { // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing google.protobuf.BoolValue enable_grpc_loadbalancing = 9; + + // Enable compression + google.protobuf.BoolValue compression_enabled = 10; } // Message describes what message should be considered for certain DataCapture option diff --git a/gen/go/v1/config.pb.go b/gen/go/v1/config.pb.go index c0e3c9d..39cc475 100644 --- a/gen/go/v1/config.pb.go +++ b/gen/go/v1/config.pb.go @@ -408,8 +408,10 @@ type Reporting struct { MetricReporterType MetricReporterType `protobuf:"varint,8,opt,name=metric_reporter_type,json=metricReporterType,proto3,enum=hypertrace.agent.config.v1.MetricReporterType" json:"metric_reporter_type,omitempty"` // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing EnableGrpcLoadbalancing *wrapperspb.BoolValue `protobuf:"bytes,9,opt,name=enable_grpc_loadbalancing,json=enableGrpcLoadbalancing,proto3" json:"enable_grpc_loadbalancing,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Enable compression + CompressionEnabled *wrapperspb.BoolValue `protobuf:"bytes,10,opt,name=compression_enabled,json=compressionEnabled,proto3" json:"compression_enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Reporting) Reset() { @@ -498,6 +500,13 @@ func (x *Reporting) GetEnableGrpcLoadbalancing() *wrapperspb.BoolValue { return nil } +func (x *Reporting) GetCompressionEnabled() *wrapperspb.BoolValue { + if x != nil { + return x.CompressionEnabled + } + return nil +} + // Message describes what message should be considered for certain DataCapture option type Message struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -893,7 +902,7 @@ const file_hypertrace_agent_config_v1_config_proto_rawDesc = "" + "\agoagent\x18\t \x01(\v2#.hypertrace.agent.config.v1.GoAgentR\agoagent\x1aE\n" + "\x17ResourceAttributesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc8\x04\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x95\x05\n" + "\tReporting\x128\n" + "\bendpoint\x18\x01 \x01(\v2\x1c.google.protobuf.StringValueR\bendpoint\x122\n" + "\x06secure\x18\x02 \x01(\v2\x1a.google.protobuf.BoolValueR\x06secure\x122\n" + @@ -902,7 +911,9 @@ const file_hypertrace_agent_config_v1_config_proto_rawDesc = "" + "\tcert_file\x18\x06 \x01(\v2\x1c.google.protobuf.StringValueR\bcertFile\x12E\n" + "\x0fmetric_endpoint\x18\a \x01(\v2\x1c.google.protobuf.StringValueR\x0emetricEndpoint\x12`\n" + "\x14metric_reporter_type\x18\b \x01(\x0e2..hypertrace.agent.config.v1.MetricReporterTypeR\x12metricReporterType\x12V\n" + - "\x19enable_grpc_loadbalancing\x18\t \x01(\v2\x1a.google.protobuf.BoolValueR\x17enableGrpcLoadbalancing\"w\n" + + "\x19enable_grpc_loadbalancing\x18\t \x01(\v2\x1a.google.protobuf.BoolValueR\x17enableGrpcLoadbalancing\x12K\n" + + "\x13compression_enabled\x18\n" + + " \x01(\v2\x1a.google.protobuf.BoolValueR\x12compressionEnabled\"w\n" + "\aMessage\x124\n" + "\arequest\x18\x01 \x01(\v2\x1a.google.protobuf.BoolValueR\arequest\x126\n" + "\bresponse\x18\x02 \x01(\v2\x1a.google.protobuf.BoolValueR\bresponse\"\x9e\x04\n" + @@ -1003,27 +1014,28 @@ var file_hypertrace_agent_config_v1_config_proto_depIdxs = []int32{ 13, // 14: hypertrace.agent.config.v1.Reporting.metric_endpoint:type_name -> google.protobuf.StringValue 2, // 15: hypertrace.agent.config.v1.Reporting.metric_reporter_type:type_name -> hypertrace.agent.config.v1.MetricReporterType 14, // 16: hypertrace.agent.config.v1.Reporting.enable_grpc_loadbalancing:type_name -> google.protobuf.BoolValue - 14, // 17: hypertrace.agent.config.v1.Message.request:type_name -> google.protobuf.BoolValue - 14, // 18: hypertrace.agent.config.v1.Message.response:type_name -> google.protobuf.BoolValue - 6, // 19: hypertrace.agent.config.v1.DataCapture.http_headers:type_name -> hypertrace.agent.config.v1.Message - 6, // 20: hypertrace.agent.config.v1.DataCapture.http_body:type_name -> hypertrace.agent.config.v1.Message - 6, // 21: hypertrace.agent.config.v1.DataCapture.rpc_metadata:type_name -> hypertrace.agent.config.v1.Message - 6, // 22: hypertrace.agent.config.v1.DataCapture.rpc_body:type_name -> hypertrace.agent.config.v1.Message - 15, // 23: hypertrace.agent.config.v1.DataCapture.body_max_size_bytes:type_name -> google.protobuf.Int32Value - 15, // 24: hypertrace.agent.config.v1.DataCapture.body_max_processing_size_bytes:type_name -> google.protobuf.Int32Value - 13, // 25: hypertrace.agent.config.v1.DataCapture.allowed_content_types:type_name -> google.protobuf.StringValue - 13, // 26: hypertrace.agent.config.v1.JavaAgent.filter_jar_paths:type_name -> google.protobuf.StringValue - 14, // 27: hypertrace.agent.config.v1.GoAgent.use_custom_bsp:type_name -> google.protobuf.BoolValue - 14, // 28: hypertrace.agent.config.v1.Telemetry.startup_span_enabled:type_name -> google.protobuf.BoolValue - 14, // 29: hypertrace.agent.config.v1.Telemetry.metrics_enabled:type_name -> google.protobuf.BoolValue - 11, // 30: hypertrace.agent.config.v1.Telemetry.logs:type_name -> hypertrace.agent.config.v1.LogsExport - 14, // 31: hypertrace.agent.config.v1.LogsExport.enabled:type_name -> google.protobuf.BoolValue - 3, // 32: hypertrace.agent.config.v1.LogsExport.level:type_name -> hypertrace.agent.config.v1.LogLevel - 33, // [33:33] is the sub-list for method output_type - 33, // [33:33] is the sub-list for method input_type - 33, // [33:33] is the sub-list for extension type_name - 33, // [33:33] is the sub-list for extension extendee - 0, // [0:33] is the sub-list for field type_name + 14, // 17: hypertrace.agent.config.v1.Reporting.compression_enabled:type_name -> google.protobuf.BoolValue + 14, // 18: hypertrace.agent.config.v1.Message.request:type_name -> google.protobuf.BoolValue + 14, // 19: hypertrace.agent.config.v1.Message.response:type_name -> google.protobuf.BoolValue + 6, // 20: hypertrace.agent.config.v1.DataCapture.http_headers:type_name -> hypertrace.agent.config.v1.Message + 6, // 21: hypertrace.agent.config.v1.DataCapture.http_body:type_name -> hypertrace.agent.config.v1.Message + 6, // 22: hypertrace.agent.config.v1.DataCapture.rpc_metadata:type_name -> hypertrace.agent.config.v1.Message + 6, // 23: hypertrace.agent.config.v1.DataCapture.rpc_body:type_name -> hypertrace.agent.config.v1.Message + 15, // 24: hypertrace.agent.config.v1.DataCapture.body_max_size_bytes:type_name -> google.protobuf.Int32Value + 15, // 25: hypertrace.agent.config.v1.DataCapture.body_max_processing_size_bytes:type_name -> google.protobuf.Int32Value + 13, // 26: hypertrace.agent.config.v1.DataCapture.allowed_content_types:type_name -> google.protobuf.StringValue + 13, // 27: hypertrace.agent.config.v1.JavaAgent.filter_jar_paths:type_name -> google.protobuf.StringValue + 14, // 28: hypertrace.agent.config.v1.GoAgent.use_custom_bsp:type_name -> google.protobuf.BoolValue + 14, // 29: hypertrace.agent.config.v1.Telemetry.startup_span_enabled:type_name -> google.protobuf.BoolValue + 14, // 30: hypertrace.agent.config.v1.Telemetry.metrics_enabled:type_name -> google.protobuf.BoolValue + 11, // 31: hypertrace.agent.config.v1.Telemetry.logs:type_name -> hypertrace.agent.config.v1.LogsExport + 14, // 32: hypertrace.agent.config.v1.LogsExport.enabled:type_name -> google.protobuf.BoolValue + 3, // 33: hypertrace.agent.config.v1.LogsExport.level:type_name -> hypertrace.agent.config.v1.LogLevel + 34, // [34:34] is the sub-list for method output_type + 34, // [34:34] is the sub-list for method input_type + 34, // [34:34] is the sub-list for extension type_name + 34, // [34:34] is the sub-list for extension extendee + 0, // [0:34] is the sub-list for field type_name } func init() { file_hypertrace_agent_config_v1_config_proto_init() } diff --git a/gen/go/v1/config.pbloader.go b/gen/go/v1/config.pbloader.go index 20fd150..a2ea0af 100644 --- a/gen/go/v1/config.pbloader.go +++ b/gen/go/v1/config.pbloader.go @@ -173,6 +173,16 @@ func (x *Reporting) loadFromEnv(prefix string, defaultValues *Reporting) { x.EnableGrpcLoadbalancing = &wrappers.BoolValue{Value: defaultValues.EnableGrpcLoadbalancing.Value} } } + if val, ok := getBoolEnv(prefix + "COMPRESSION_ENABLED"); ok { + x.CompressionEnabled = &wrappers.BoolValue{Value: val} + } else if x.CompressionEnabled == nil { + // when there is no value to set we still prefer to initialize the variable to avoid + // `nil` checks in the consumers. + x.CompressionEnabled = new(wrappers.BoolValue) + if defaultValues != nil && defaultValues.CompressionEnabled != nil { + x.CompressionEnabled = &wrappers.BoolValue{Value: defaultValues.CompressionEnabled.Value} + } + } } // loadFromEnv loads the data from env vars, defaults and makes sure all values are initialized. diff --git a/proto/hypertrace/agent/config/v1/config.proto b/proto/hypertrace/agent/config/v1/config.proto index cebc39f..a792dca 100644 --- a/proto/hypertrace/agent/config/v1/config.proto +++ b/proto/hypertrace/agent/config/v1/config.proto @@ -73,6 +73,9 @@ message Reporting { // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing google.protobuf.BoolValue enable_grpc_loadbalancing = 9; + + // Enable compression + google.protobuf.BoolValue compression_enabled = 10; } // Message describes what message should be considered for certain DataCapture option From b974c9a75ae6ae83f5c5b9b48c2f9704ac300707 Mon Sep 17 00:00:00 2001 From: Tim Mwangi Date: Thu, 9 Oct 2025 12:31:01 -0700 Subject: [PATCH 2/2] use compression type enum --- ENV_VARS.md | 1 - gen/go/proto/v1/config.proto | 9 +- gen/go/v1/config.pb.go | 162 ++++++++++++------ gen/go/v1/config.pbloader.go | 14 +- proto/hypertrace/agent/config/v1/config.proto | 9 +- 5 files changed, 125 insertions(+), 70 deletions(-) diff --git a/ENV_VARS.md b/ENV_VARS.md index 38594ae..915787d 100644 --- a/ENV_VARS.md +++ b/ENV_VARS.md @@ -14,7 +14,6 @@ Agents can be configured using environment variables: | HT_REPORTING_CERT_FILE | Certificate file containing the CA to verify the server's certificate. This is for private certificates. If this is set then `secure` above should also be set to `true`. | | HT_REPORTING_METRIC_ENDPOINT | Represents the endpoint for reporting the metrics. For OTLP metric reporter type use http://api.traceable.ai:4317 | | HT_REPORTING_ENABLE_GRPC_LOADBALANCING | When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing | -| HT_REPORTING_COMPRESSION_ENABLED | Enable compression | | HT_DATA_CAPTURE_HTTP_HEADERS_REQUEST | When `false` it disables the capture for the request in a client/request operation | | HT_DATA_CAPTURE_HTTP_HEADERS_RESPONSE | When `false` it disables the capture for the response in a client/request operation | | HT_DATA_CAPTURE_HTTP_BODY_REQUEST | When `false` it disables the capture for the request in a client/request operation | diff --git a/gen/go/proto/v1/config.proto b/gen/go/proto/v1/config.proto index a792dca..a2fd9fe 100644 --- a/gen/go/proto/v1/config.proto +++ b/gen/go/proto/v1/config.proto @@ -74,8 +74,8 @@ message Reporting { // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing google.protobuf.BoolValue enable_grpc_loadbalancing = 9; - // Enable compression - google.protobuf.BoolValue compression_enabled = 10; + // Compression type + CompressionType compression_type = 10; } // Message describes what message should be considered for certain DataCapture option @@ -222,4 +222,9 @@ message LogsExport { // it'll only be available in the local log file. LogLevel level = 2; +} + +enum CompressionType { + COMPRESSION_TYPE_UNSPECIFIED = 0; + COMPRESSION_TYPE_GZIP = 1; } \ No newline at end of file diff --git a/gen/go/v1/config.pb.go b/gen/go/v1/config.pb.go index 39cc475..03118e5 100644 --- a/gen/go/v1/config.pb.go +++ b/gen/go/v1/config.pb.go @@ -261,6 +261,52 @@ func (LogLevel) EnumDescriptor() ([]byte, []int) { return file_hypertrace_agent_config_v1_config_proto_rawDescGZIP(), []int{3} } +type CompressionType int32 + +const ( + CompressionType_COMPRESSION_TYPE_UNSPECIFIED CompressionType = 0 + CompressionType_COMPRESSION_TYPE_GZIP CompressionType = 1 +) + +// Enum value maps for CompressionType. +var ( + CompressionType_name = map[int32]string{ + 0: "COMPRESSION_TYPE_UNSPECIFIED", + 1: "COMPRESSION_TYPE_GZIP", + } + CompressionType_value = map[string]int32{ + "COMPRESSION_TYPE_UNSPECIFIED": 0, + "COMPRESSION_TYPE_GZIP": 1, + } +) + +func (x CompressionType) Enum() *CompressionType { + p := new(CompressionType) + *p = x + return p +} + +func (x CompressionType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CompressionType) Descriptor() protoreflect.EnumDescriptor { + return file_hypertrace_agent_config_v1_config_proto_enumTypes[4].Descriptor() +} + +func (CompressionType) Type() protoreflect.EnumType { + return &file_hypertrace_agent_config_v1_config_proto_enumTypes[4] +} + +func (x CompressionType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CompressionType.Descriptor instead. +func (CompressionType) EnumDescriptor() ([]byte, []int) { + return file_hypertrace_agent_config_v1_config_proto_rawDescGZIP(), []int{4} +} + // AgentConfig covers the config for agents. // The config uses wrappers for primitive types to allow nullable values. // The nullable values are used for instance to explicitly disable data capture or secure connection. @@ -408,10 +454,10 @@ type Reporting struct { MetricReporterType MetricReporterType `protobuf:"varint,8,opt,name=metric_reporter_type,json=metricReporterType,proto3,enum=hypertrace.agent.config.v1.MetricReporterType" json:"metric_reporter_type,omitempty"` // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing EnableGrpcLoadbalancing *wrapperspb.BoolValue `protobuf:"bytes,9,opt,name=enable_grpc_loadbalancing,json=enableGrpcLoadbalancing,proto3" json:"enable_grpc_loadbalancing,omitempty"` - // Enable compression - CompressionEnabled *wrapperspb.BoolValue `protobuf:"bytes,10,opt,name=compression_enabled,json=compressionEnabled,proto3" json:"compression_enabled,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Compression type + CompressionType CompressionType `protobuf:"varint,10,opt,name=compression_type,json=compressionType,proto3,enum=hypertrace.agent.config.v1.CompressionType" json:"compression_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Reporting) Reset() { @@ -500,11 +546,11 @@ func (x *Reporting) GetEnableGrpcLoadbalancing() *wrapperspb.BoolValue { return nil } -func (x *Reporting) GetCompressionEnabled() *wrapperspb.BoolValue { +func (x *Reporting) GetCompressionType() CompressionType { if x != nil { - return x.CompressionEnabled + return x.CompressionType } - return nil + return CompressionType_COMPRESSION_TYPE_UNSPECIFIED } // Message describes what message should be considered for certain DataCapture option @@ -902,7 +948,7 @@ const file_hypertrace_agent_config_v1_config_proto_rawDesc = "" + "\agoagent\x18\t \x01(\v2#.hypertrace.agent.config.v1.GoAgentR\agoagent\x1aE\n" + "\x17ResourceAttributesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x95\x05\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xa0\x05\n" + "\tReporting\x128\n" + "\bendpoint\x18\x01 \x01(\v2\x1c.google.protobuf.StringValueR\bendpoint\x122\n" + "\x06secure\x18\x02 \x01(\v2\x1a.google.protobuf.BoolValueR\x06secure\x122\n" + @@ -911,9 +957,9 @@ const file_hypertrace_agent_config_v1_config_proto_rawDesc = "" + "\tcert_file\x18\x06 \x01(\v2\x1c.google.protobuf.StringValueR\bcertFile\x12E\n" + "\x0fmetric_endpoint\x18\a \x01(\v2\x1c.google.protobuf.StringValueR\x0emetricEndpoint\x12`\n" + "\x14metric_reporter_type\x18\b \x01(\x0e2..hypertrace.agent.config.v1.MetricReporterTypeR\x12metricReporterType\x12V\n" + - "\x19enable_grpc_loadbalancing\x18\t \x01(\v2\x1a.google.protobuf.BoolValueR\x17enableGrpcLoadbalancing\x12K\n" + - "\x13compression_enabled\x18\n" + - " \x01(\v2\x1a.google.protobuf.BoolValueR\x12compressionEnabled\"w\n" + + "\x19enable_grpc_loadbalancing\x18\t \x01(\v2\x1a.google.protobuf.BoolValueR\x17enableGrpcLoadbalancing\x12V\n" + + "\x10compression_type\x18\n" + + " \x01(\x0e2+.hypertrace.agent.config.v1.CompressionTypeR\x0fcompressionType\"w\n" + "\aMessage\x124\n" + "\arequest\x18\x01 \x01(\v2\x1a.google.protobuf.BoolValueR\arequest\x126\n" + "\bresponse\x18\x02 \x01(\v2\x1a.google.protobuf.BoolValueR\bresponse\"\x9e\x04\n" + @@ -961,7 +1007,10 @@ const file_hypertrace_agent_config_v1_config_proto_rawDesc = "" + "\x0fLOG_LEVEL_DEBUG\x10\x02\x12\x12\n" + "\x0eLOG_LEVEL_INFO\x10\x03\x12\x12\n" + "\x0eLOG_LEVEL_WARN\x10\x04\x12\x13\n" + - "\x0fLOG_LEVEL_ERROR\x10\x05Bk\n" + + "\x0fLOG_LEVEL_ERROR\x10\x05*N\n" + + "\x0fCompressionType\x12 \n" + + "\x1cCOMPRESSION_TYPE_UNSPECIFIED\x10\x00\x12\x19\n" + + "\x15COMPRESSION_TYPE_GZIP\x10\x01Bk\n" + "\x1eorg.hypertrace.agent.config.v1Z,github.com/hypertrace/agent-config/gen/go/v1\xaa\x02\x1aHypertrace.Agent.Config.V1b\x06proto3" var ( @@ -976,60 +1025,61 @@ func file_hypertrace_agent_config_v1_config_proto_rawDescGZIP() []byte { return file_hypertrace_agent_config_v1_config_proto_rawDescData } -var file_hypertrace_agent_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_hypertrace_agent_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 5) var file_hypertrace_agent_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_hypertrace_agent_config_v1_config_proto_goTypes = []any{ (PropagationFormat)(0), // 0: hypertrace.agent.config.v1.PropagationFormat (TraceReporterType)(0), // 1: hypertrace.agent.config.v1.TraceReporterType (MetricReporterType)(0), // 2: hypertrace.agent.config.v1.MetricReporterType (LogLevel)(0), // 3: hypertrace.agent.config.v1.LogLevel - (*AgentConfig)(nil), // 4: hypertrace.agent.config.v1.AgentConfig - (*Reporting)(nil), // 5: hypertrace.agent.config.v1.Reporting - (*Message)(nil), // 6: hypertrace.agent.config.v1.Message - (*DataCapture)(nil), // 7: hypertrace.agent.config.v1.DataCapture - (*JavaAgent)(nil), // 8: hypertrace.agent.config.v1.JavaAgent - (*GoAgent)(nil), // 9: hypertrace.agent.config.v1.GoAgent - (*Telemetry)(nil), // 10: hypertrace.agent.config.v1.Telemetry - (*LogsExport)(nil), // 11: hypertrace.agent.config.v1.LogsExport - nil, // 12: hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry - (*wrapperspb.StringValue)(nil), // 13: google.protobuf.StringValue - (*wrapperspb.BoolValue)(nil), // 14: google.protobuf.BoolValue - (*wrapperspb.Int32Value)(nil), // 15: google.protobuf.Int32Value + (CompressionType)(0), // 4: hypertrace.agent.config.v1.CompressionType + (*AgentConfig)(nil), // 5: hypertrace.agent.config.v1.AgentConfig + (*Reporting)(nil), // 6: hypertrace.agent.config.v1.Reporting + (*Message)(nil), // 7: hypertrace.agent.config.v1.Message + (*DataCapture)(nil), // 8: hypertrace.agent.config.v1.DataCapture + (*JavaAgent)(nil), // 9: hypertrace.agent.config.v1.JavaAgent + (*GoAgent)(nil), // 10: hypertrace.agent.config.v1.GoAgent + (*Telemetry)(nil), // 11: hypertrace.agent.config.v1.Telemetry + (*LogsExport)(nil), // 12: hypertrace.agent.config.v1.LogsExport + nil, // 13: hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry + (*wrapperspb.StringValue)(nil), // 14: google.protobuf.StringValue + (*wrapperspb.BoolValue)(nil), // 15: google.protobuf.BoolValue + (*wrapperspb.Int32Value)(nil), // 16: google.protobuf.Int32Value } var file_hypertrace_agent_config_v1_config_proto_depIdxs = []int32{ - 13, // 0: hypertrace.agent.config.v1.AgentConfig.service_name:type_name -> google.protobuf.StringValue - 5, // 1: hypertrace.agent.config.v1.AgentConfig.reporting:type_name -> hypertrace.agent.config.v1.Reporting - 7, // 2: hypertrace.agent.config.v1.AgentConfig.data_capture:type_name -> hypertrace.agent.config.v1.DataCapture + 14, // 0: hypertrace.agent.config.v1.AgentConfig.service_name:type_name -> google.protobuf.StringValue + 6, // 1: hypertrace.agent.config.v1.AgentConfig.reporting:type_name -> hypertrace.agent.config.v1.Reporting + 8, // 2: hypertrace.agent.config.v1.AgentConfig.data_capture:type_name -> hypertrace.agent.config.v1.DataCapture 0, // 3: hypertrace.agent.config.v1.AgentConfig.propagation_formats:type_name -> hypertrace.agent.config.v1.PropagationFormat - 14, // 4: hypertrace.agent.config.v1.AgentConfig.enabled:type_name -> google.protobuf.BoolValue - 8, // 5: hypertrace.agent.config.v1.AgentConfig.javaagent:type_name -> hypertrace.agent.config.v1.JavaAgent - 12, // 6: hypertrace.agent.config.v1.AgentConfig.resource_attributes:type_name -> hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry - 10, // 7: hypertrace.agent.config.v1.AgentConfig.telemetry:type_name -> hypertrace.agent.config.v1.Telemetry - 9, // 8: hypertrace.agent.config.v1.AgentConfig.goagent:type_name -> hypertrace.agent.config.v1.GoAgent - 13, // 9: hypertrace.agent.config.v1.Reporting.endpoint:type_name -> google.protobuf.StringValue - 14, // 10: hypertrace.agent.config.v1.Reporting.secure:type_name -> google.protobuf.BoolValue - 13, // 11: hypertrace.agent.config.v1.Reporting.token:type_name -> google.protobuf.StringValue + 15, // 4: hypertrace.agent.config.v1.AgentConfig.enabled:type_name -> google.protobuf.BoolValue + 9, // 5: hypertrace.agent.config.v1.AgentConfig.javaagent:type_name -> hypertrace.agent.config.v1.JavaAgent + 13, // 6: hypertrace.agent.config.v1.AgentConfig.resource_attributes:type_name -> hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry + 11, // 7: hypertrace.agent.config.v1.AgentConfig.telemetry:type_name -> hypertrace.agent.config.v1.Telemetry + 10, // 8: hypertrace.agent.config.v1.AgentConfig.goagent:type_name -> hypertrace.agent.config.v1.GoAgent + 14, // 9: hypertrace.agent.config.v1.Reporting.endpoint:type_name -> google.protobuf.StringValue + 15, // 10: hypertrace.agent.config.v1.Reporting.secure:type_name -> google.protobuf.BoolValue + 14, // 11: hypertrace.agent.config.v1.Reporting.token:type_name -> google.protobuf.StringValue 1, // 12: hypertrace.agent.config.v1.Reporting.trace_reporter_type:type_name -> hypertrace.agent.config.v1.TraceReporterType - 13, // 13: hypertrace.agent.config.v1.Reporting.cert_file:type_name -> google.protobuf.StringValue - 13, // 14: hypertrace.agent.config.v1.Reporting.metric_endpoint:type_name -> google.protobuf.StringValue + 14, // 13: hypertrace.agent.config.v1.Reporting.cert_file:type_name -> google.protobuf.StringValue + 14, // 14: hypertrace.agent.config.v1.Reporting.metric_endpoint:type_name -> google.protobuf.StringValue 2, // 15: hypertrace.agent.config.v1.Reporting.metric_reporter_type:type_name -> hypertrace.agent.config.v1.MetricReporterType - 14, // 16: hypertrace.agent.config.v1.Reporting.enable_grpc_loadbalancing:type_name -> google.protobuf.BoolValue - 14, // 17: hypertrace.agent.config.v1.Reporting.compression_enabled:type_name -> google.protobuf.BoolValue - 14, // 18: hypertrace.agent.config.v1.Message.request:type_name -> google.protobuf.BoolValue - 14, // 19: hypertrace.agent.config.v1.Message.response:type_name -> google.protobuf.BoolValue - 6, // 20: hypertrace.agent.config.v1.DataCapture.http_headers:type_name -> hypertrace.agent.config.v1.Message - 6, // 21: hypertrace.agent.config.v1.DataCapture.http_body:type_name -> hypertrace.agent.config.v1.Message - 6, // 22: hypertrace.agent.config.v1.DataCapture.rpc_metadata:type_name -> hypertrace.agent.config.v1.Message - 6, // 23: hypertrace.agent.config.v1.DataCapture.rpc_body:type_name -> hypertrace.agent.config.v1.Message - 15, // 24: hypertrace.agent.config.v1.DataCapture.body_max_size_bytes:type_name -> google.protobuf.Int32Value - 15, // 25: hypertrace.agent.config.v1.DataCapture.body_max_processing_size_bytes:type_name -> google.protobuf.Int32Value - 13, // 26: hypertrace.agent.config.v1.DataCapture.allowed_content_types:type_name -> google.protobuf.StringValue - 13, // 27: hypertrace.agent.config.v1.JavaAgent.filter_jar_paths:type_name -> google.protobuf.StringValue - 14, // 28: hypertrace.agent.config.v1.GoAgent.use_custom_bsp:type_name -> google.protobuf.BoolValue - 14, // 29: hypertrace.agent.config.v1.Telemetry.startup_span_enabled:type_name -> google.protobuf.BoolValue - 14, // 30: hypertrace.agent.config.v1.Telemetry.metrics_enabled:type_name -> google.protobuf.BoolValue - 11, // 31: hypertrace.agent.config.v1.Telemetry.logs:type_name -> hypertrace.agent.config.v1.LogsExport - 14, // 32: hypertrace.agent.config.v1.LogsExport.enabled:type_name -> google.protobuf.BoolValue + 15, // 16: hypertrace.agent.config.v1.Reporting.enable_grpc_loadbalancing:type_name -> google.protobuf.BoolValue + 4, // 17: hypertrace.agent.config.v1.Reporting.compression_type:type_name -> hypertrace.agent.config.v1.CompressionType + 15, // 18: hypertrace.agent.config.v1.Message.request:type_name -> google.protobuf.BoolValue + 15, // 19: hypertrace.agent.config.v1.Message.response:type_name -> google.protobuf.BoolValue + 7, // 20: hypertrace.agent.config.v1.DataCapture.http_headers:type_name -> hypertrace.agent.config.v1.Message + 7, // 21: hypertrace.agent.config.v1.DataCapture.http_body:type_name -> hypertrace.agent.config.v1.Message + 7, // 22: hypertrace.agent.config.v1.DataCapture.rpc_metadata:type_name -> hypertrace.agent.config.v1.Message + 7, // 23: hypertrace.agent.config.v1.DataCapture.rpc_body:type_name -> hypertrace.agent.config.v1.Message + 16, // 24: hypertrace.agent.config.v1.DataCapture.body_max_size_bytes:type_name -> google.protobuf.Int32Value + 16, // 25: hypertrace.agent.config.v1.DataCapture.body_max_processing_size_bytes:type_name -> google.protobuf.Int32Value + 14, // 26: hypertrace.agent.config.v1.DataCapture.allowed_content_types:type_name -> google.protobuf.StringValue + 14, // 27: hypertrace.agent.config.v1.JavaAgent.filter_jar_paths:type_name -> google.protobuf.StringValue + 15, // 28: hypertrace.agent.config.v1.GoAgent.use_custom_bsp:type_name -> google.protobuf.BoolValue + 15, // 29: hypertrace.agent.config.v1.Telemetry.startup_span_enabled:type_name -> google.protobuf.BoolValue + 15, // 30: hypertrace.agent.config.v1.Telemetry.metrics_enabled:type_name -> google.protobuf.BoolValue + 12, // 31: hypertrace.agent.config.v1.Telemetry.logs:type_name -> hypertrace.agent.config.v1.LogsExport + 15, // 32: hypertrace.agent.config.v1.LogsExport.enabled:type_name -> google.protobuf.BoolValue 3, // 33: hypertrace.agent.config.v1.LogsExport.level:type_name -> hypertrace.agent.config.v1.LogLevel 34, // [34:34] is the sub-list for method output_type 34, // [34:34] is the sub-list for method input_type @@ -1048,7 +1098,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_hypertrace_agent_config_v1_config_proto_rawDesc), len(file_hypertrace_agent_config_v1_config_proto_rawDesc)), - NumEnums: 4, + NumEnums: 5, NumMessages: 9, NumExtensions: 0, NumServices: 0, diff --git a/gen/go/v1/config.pbloader.go b/gen/go/v1/config.pbloader.go index a2ea0af..3ec7d23 100644 --- a/gen/go/v1/config.pbloader.go +++ b/gen/go/v1/config.pbloader.go @@ -173,16 +173,12 @@ func (x *Reporting) loadFromEnv(prefix string, defaultValues *Reporting) { x.EnableGrpcLoadbalancing = &wrappers.BoolValue{Value: defaultValues.EnableGrpcLoadbalancing.Value} } } - if val, ok := getBoolEnv(prefix + "COMPRESSION_ENABLED"); ok { - x.CompressionEnabled = &wrappers.BoolValue{Value: val} - } else if x.CompressionEnabled == nil { - // when there is no value to set we still prefer to initialize the variable to avoid - // `nil` checks in the consumers. - x.CompressionEnabled = new(wrappers.BoolValue) - if defaultValues != nil && defaultValues.CompressionEnabled != nil { - x.CompressionEnabled = &wrappers.BoolValue{Value: defaultValues.CompressionEnabled.Value} - } + if rawVal, ok := getStringEnv(prefix + "COMPRESSION_TYPE"); ok { + x.CompressionType = CompressionType(CompressionType_value[rawVal]) + } else if x.CompressionType == CompressionType(0) && defaultValues != nil && defaultValues.CompressionType != CompressionType(0) { + x.CompressionType = defaultValues.CompressionType } + } // loadFromEnv loads the data from env vars, defaults and makes sure all values are initialized. diff --git a/proto/hypertrace/agent/config/v1/config.proto b/proto/hypertrace/agent/config/v1/config.proto index a792dca..a2fd9fe 100644 --- a/proto/hypertrace/agent/config/v1/config.proto +++ b/proto/hypertrace/agent/config/v1/config.proto @@ -74,8 +74,8 @@ message Reporting { // When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing google.protobuf.BoolValue enable_grpc_loadbalancing = 9; - // Enable compression - google.protobuf.BoolValue compression_enabled = 10; + // Compression type + CompressionType compression_type = 10; } // Message describes what message should be considered for certain DataCapture option @@ -222,4 +222,9 @@ message LogsExport { // it'll only be available in the local log file. LogLevel level = 2; +} + +enum CompressionType { + COMPRESSION_TYPE_UNSPECIFIED = 0; + COMPRESSION_TYPE_GZIP = 1; } \ No newline at end of file