diff --git a/ENV_VARS.md b/ENV_VARS.md index 63f12c9..6bdcb48 100644 --- a/ENV_VARS.md +++ b/ENV_VARS.md @@ -30,4 +30,6 @@ Agents can be configured using environment variables: | HT_JAVAAGENT_FILTER_JAR_PATHS | Is the list of path to filter jars, separated by `,`. The values should be separated by `,`. | | HT_TELEMETRY_STARTUP_SPAN_ENABLED | When `true`, an internal span is created and exported when the agent is initialized and started. It's useful to denote when the application the agent is in started. | | HT_TELEMETRY_METRICS_ENABLED | Whether to capture metrics or not. The metrics will be otel go metrics. See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric | +| HT_TELEMETRY_METRICS_ENABLED | Whether to capture metrics or not. The metrics will be otel go metrics. See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric | +| HT_TELEMETRY_METRICS_SYSTEM_METRICS_ENABLED | Whether to capture system metrics or not. The system metrics is setup in goagent. | | HT_GOAGENT_USE_CUSTOM_BSP | Use the custom batch_span_processor adapted from the one in opentelemetry go and supports some additional metrics | diff --git a/gen/go/go.mod b/gen/go/go.mod index 6e5f50e..445d837 100644 --- a/gen/go/go.mod +++ b/gen/go/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/ghodss/yaml v1.0.0 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.34.2 ) require ( diff --git a/gen/go/go.sum b/gen/go/go.sum index d0706ab..540d8ec 100644 --- a/gen/go/go.sum +++ b/gen/go/go.sum @@ -8,8 +8,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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/v1/config.pb.go b/gen/go/v1/config.pb.go index 65b3a85..54336c6 100644 --- a/gen/go/v1/config.pb.go +++ b/gen/go/v1/config.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.33.0 +// protoc-gen-go v1.34.2 // protoc (unknown) // source: hypertrace/agent/config/v1/config.proto @@ -726,7 +726,11 @@ type Telemetry struct { StartupSpanEnabled *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=startup_span_enabled,json=startupSpanEnabled,proto3" json:"startup_span_enabled,omitempty"` // Whether to capture metrics or not. The metrics will be otel go metrics. // See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric + // + // Deprecated: Marked as deprecated in hypertrace/agent/config/v1/config.proto. MetricsEnabled *wrapperspb.BoolValue `protobuf:"bytes,2,opt,name=metrics_enabled,json=metricsEnabled,proto3" json:"metrics_enabled,omitempty"` + // Metrics config + Metrics *Metrics `protobuf:"bytes,3,opt,name=metrics,proto3" json:"metrics,omitempty"` } func (x *Telemetry) Reset() { @@ -768,6 +772,7 @@ func (x *Telemetry) GetStartupSpanEnabled() *wrapperspb.BoolValue { return nil } +// Deprecated: Marked as deprecated in hypertrace/agent/config/v1/config.proto. func (x *Telemetry) GetMetricsEnabled() *wrapperspb.BoolValue { if x != nil { return x.MetricsEnabled @@ -775,6 +780,121 @@ func (x *Telemetry) GetMetricsEnabled() *wrapperspb.BoolValue { return nil } +func (x *Telemetry) GetMetrics() *Metrics { + if x != nil { + return x.Metrics + } + return nil +} + +// Metrics has the config to enable OTEl and System metrics +type Metrics struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether to capture metrics or not. The metrics will be otel go metrics. + // See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric + Enabled *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + // System metrics configuration. + SystemMetrics *SystemMetrics `protobuf:"bytes,2,opt,name=system_metrics,json=systemMetrics,proto3" json:"system_metrics,omitempty"` +} + +func (x *Metrics) Reset() { + *x = Metrics{} + if protoimpl.UnsafeEnabled { + mi := &file_hypertrace_agent_config_v1_config_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Metrics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Metrics) ProtoMessage() {} + +func (x *Metrics) ProtoReflect() protoreflect.Message { + mi := &file_hypertrace_agent_config_v1_config_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Metrics.ProtoReflect.Descriptor instead. +func (*Metrics) Descriptor() ([]byte, []int) { + return file_hypertrace_agent_config_v1_config_proto_rawDescGZIP(), []int{7} +} + +func (x *Metrics) GetEnabled() *wrapperspb.BoolValue { + if x != nil { + return x.Enabled + } + return nil +} + +func (x *Metrics) GetSystemMetrics() *SystemMetrics { + if x != nil { + return x.SystemMetrics + } + return nil +} + +// SystemMetrics has the config for capturing system metrics. +type SystemMetrics struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether to capture system metrics or not. The system metrics is setup in goagent. + Enabled *wrapperspb.BoolValue `protobuf:"bytes,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +} + +func (x *SystemMetrics) Reset() { + *x = SystemMetrics{} + if protoimpl.UnsafeEnabled { + mi := &file_hypertrace_agent_config_v1_config_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemMetrics) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemMetrics) ProtoMessage() {} + +func (x *SystemMetrics) ProtoReflect() protoreflect.Message { + mi := &file_hypertrace_agent_config_v1_config_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemMetrics.ProtoReflect.Descriptor instead. +func (*SystemMetrics) Descriptor() ([]byte, []int) { + return file_hypertrace_agent_config_v1_config_proto_rawDescGZIP(), []int{8} +} + +func (x *SystemMetrics) GetEnabled() *wrapperspb.BoolValue { + if x != nil { + return x.Enabled + } + return nil +} + var File_hypertrace_agent_config_v1_config_proto protoreflect.FileDescriptor var file_hypertrace_agent_config_v1_config_proto_rawDesc = []byte{ @@ -920,45 +1040,63 @@ var file_hypertrace_agent_config_v1_config_proto_rawDesc = []byte{ 0x6f, 0x6d, 0x5f, 0x62, 0x73, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x42, 0x73, 0x70, 0x22, 0x9e, 0x01, 0x0a, 0x09, 0x54, 0x65, 0x6c, 0x65, 0x6d, + 0x74, 0x6f, 0x6d, 0x42, 0x73, 0x70, 0x22, 0xe1, 0x01, 0x0a, 0x09, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x12, 0x4c, 0x0a, 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x12, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x53, 0x70, 0x61, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x12, 0x43, 0x0a, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x65, 0x6e, + 0x65, 0x64, 0x12, 0x47, 0x0a, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, - 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2a, 0x2d, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x70, 0x61, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x06, 0x0a, 0x02, - 0x42, 0x33, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x52, 0x41, 0x43, 0x45, 0x43, 0x4f, 0x4e, - 0x54, 0x45, 0x58, 0x54, 0x10, 0x01, 0x2a, 0x60, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, - 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, - 0x5a, 0x49, 0x50, 0x4b, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x54, 0x4c, 0x50, - 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x47, 0x47, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, - 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x54, 0x4c, - 0x50, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x10, 0x05, 0x2a, 0xbf, 0x01, 0x0a, 0x12, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x24, 0x0a, 0x20, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, - 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, - 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x54, - 0x4c, 0x50, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, - 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, 0x4f, - 0x4d, 0x45, 0x54, 0x48, 0x45, 0x55, 0x53, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x45, 0x54, + 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0e, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x07, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x68, + 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x07, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x50, 0x0a, 0x0e, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, + 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, + 0x0d, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x45, + 0x0a, 0x0d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, + 0x34, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2a, 0x2d, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x70, 0x61, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x42, 0x33, + 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x52, 0x41, 0x43, 0x45, 0x43, 0x4f, 0x4e, 0x54, 0x45, + 0x58, 0x54, 0x10, 0x01, 0x2a, 0x60, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x5a, 0x49, + 0x50, 0x4b, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x4f, 0x54, 0x4c, 0x50, 0x10, 0x02, + 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x47, 0x47, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x08, 0x0a, + 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x54, 0x4c, 0x50, 0x5f, + 0x48, 0x54, 0x54, 0x50, 0x10, 0x05, 0x2a, 0xbf, 0x01, 0x0a, 0x12, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, + 0x20, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, + 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f, 0x54, 0x4c, 0x50, + 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, 0x50, + 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x4d, 0x45, + 0x54, 0x48, 0x45, 0x55, 0x53, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x4d, 0x45, 0x54, 0x52, 0x49, + 0x43, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x4c, 0x4f, 0x47, 0x47, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x5f, 0x4c, 0x4f, 0x47, 0x47, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4d, - 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x52, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x6b, 0x0a, 0x1e, 0x6f, 0x72, - 0x67, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x61, 0x67, 0x65, - 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x5a, 0x2c, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1a, 0x48, 0x79, 0x70, - 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x45, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x04, 0x42, 0x6b, 0x0a, 0x1e, 0x6f, 0x72, 0x67, 0x2e, + 0x68, 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, + 0x65, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1a, 0x48, 0x79, 0x70, 0x65, 0x72, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -974,8 +1112,8 @@ func file_hypertrace_agent_config_v1_config_proto_rawDescGZIP() []byte { } var file_hypertrace_agent_config_v1_config_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_hypertrace_agent_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_hypertrace_agent_config_v1_config_proto_goTypes = []interface{}{ +var file_hypertrace_agent_config_v1_config_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +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 @@ -986,47 +1124,53 @@ var file_hypertrace_agent_config_v1_config_proto_goTypes = []interface{}{ (*JavaAgent)(nil), // 7: hypertrace.agent.config.v1.JavaAgent (*GoAgent)(nil), // 8: hypertrace.agent.config.v1.GoAgent (*Telemetry)(nil), // 9: hypertrace.agent.config.v1.Telemetry - nil, // 10: hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry - (*wrapperspb.StringValue)(nil), // 11: google.protobuf.StringValue - (*wrapperspb.BoolValue)(nil), // 12: google.protobuf.BoolValue - (*wrapperspb.Int32Value)(nil), // 13: google.protobuf.Int32Value + (*Metrics)(nil), // 10: hypertrace.agent.config.v1.Metrics + (*SystemMetrics)(nil), // 11: hypertrace.agent.config.v1.SystemMetrics + 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 } var file_hypertrace_agent_config_v1_config_proto_depIdxs = []int32{ - 11, // 0: hypertrace.agent.config.v1.AgentConfig.service_name:type_name -> google.protobuf.StringValue + 13, // 0: hypertrace.agent.config.v1.AgentConfig.service_name:type_name -> google.protobuf.StringValue 4, // 1: hypertrace.agent.config.v1.AgentConfig.reporting:type_name -> hypertrace.agent.config.v1.Reporting 6, // 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 - 12, // 4: hypertrace.agent.config.v1.AgentConfig.enabled:type_name -> google.protobuf.BoolValue + 14, // 4: hypertrace.agent.config.v1.AgentConfig.enabled:type_name -> google.protobuf.BoolValue 7, // 5: hypertrace.agent.config.v1.AgentConfig.javaagent:type_name -> hypertrace.agent.config.v1.JavaAgent - 10, // 6: hypertrace.agent.config.v1.AgentConfig.resource_attributes:type_name -> hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry + 12, // 6: hypertrace.agent.config.v1.AgentConfig.resource_attributes:type_name -> hypertrace.agent.config.v1.AgentConfig.ResourceAttributesEntry 9, // 7: hypertrace.agent.config.v1.AgentConfig.telemetry:type_name -> hypertrace.agent.config.v1.Telemetry 8, // 8: hypertrace.agent.config.v1.AgentConfig.goagent:type_name -> hypertrace.agent.config.v1.GoAgent - 11, // 9: hypertrace.agent.config.v1.Reporting.endpoint:type_name -> google.protobuf.StringValue - 12, // 10: hypertrace.agent.config.v1.Reporting.secure:type_name -> google.protobuf.BoolValue - 11, // 11: hypertrace.agent.config.v1.Reporting.token:type_name -> google.protobuf.StringValue + 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 1, // 12: hypertrace.agent.config.v1.Reporting.trace_reporter_type:type_name -> hypertrace.agent.config.v1.TraceReporterType - 11, // 13: hypertrace.agent.config.v1.Reporting.cert_file:type_name -> google.protobuf.StringValue - 11, // 14: hypertrace.agent.config.v1.Reporting.metric_endpoint:type_name -> google.protobuf.StringValue + 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 2, // 15: hypertrace.agent.config.v1.Reporting.metric_reporter_type:type_name -> hypertrace.agent.config.v1.MetricReporterType - 12, // 16: hypertrace.agent.config.v1.Reporting.enable_grpc_loadbalancing:type_name -> google.protobuf.BoolValue - 12, // 17: hypertrace.agent.config.v1.Message.request:type_name -> google.protobuf.BoolValue - 12, // 18: hypertrace.agent.config.v1.Message.response:type_name -> google.protobuf.BoolValue + 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 5, // 19: hypertrace.agent.config.v1.DataCapture.http_headers:type_name -> hypertrace.agent.config.v1.Message 5, // 20: hypertrace.agent.config.v1.DataCapture.http_body:type_name -> hypertrace.agent.config.v1.Message 5, // 21: hypertrace.agent.config.v1.DataCapture.rpc_metadata:type_name -> hypertrace.agent.config.v1.Message 5, // 22: hypertrace.agent.config.v1.DataCapture.rpc_body:type_name -> hypertrace.agent.config.v1.Message - 13, // 23: hypertrace.agent.config.v1.DataCapture.body_max_size_bytes:type_name -> google.protobuf.Int32Value - 13, // 24: hypertrace.agent.config.v1.DataCapture.body_max_processing_size_bytes:type_name -> google.protobuf.Int32Value - 11, // 25: hypertrace.agent.config.v1.DataCapture.allowed_content_types:type_name -> google.protobuf.StringValue - 11, // 26: hypertrace.agent.config.v1.JavaAgent.filter_jar_paths:type_name -> google.protobuf.StringValue - 12, // 27: hypertrace.agent.config.v1.GoAgent.use_custom_bsp:type_name -> google.protobuf.BoolValue - 12, // 28: hypertrace.agent.config.v1.Telemetry.startup_span_enabled:type_name -> google.protobuf.BoolValue - 12, // 29: hypertrace.agent.config.v1.Telemetry.metrics_enabled:type_name -> google.protobuf.BoolValue - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name + 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 + 10, // 30: hypertrace.agent.config.v1.Telemetry.metrics:type_name -> hypertrace.agent.config.v1.Metrics + 14, // 31: hypertrace.agent.config.v1.Metrics.enabled:type_name -> google.protobuf.BoolValue + 11, // 32: hypertrace.agent.config.v1.Metrics.system_metrics:type_name -> hypertrace.agent.config.v1.SystemMetrics + 14, // 33: hypertrace.agent.config.v1.SystemMetrics.enabled:type_name -> google.protobuf.BoolValue + 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() } @@ -1035,7 +1179,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_hypertrace_agent_config_v1_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*AgentConfig); i { case 0: return &v.state @@ -1047,7 +1191,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*Reporting); i { case 0: return &v.state @@ -1059,7 +1203,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*Message); i { case 0: return &v.state @@ -1071,7 +1215,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*DataCapture); i { case 0: return &v.state @@ -1083,7 +1227,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*JavaAgent); i { case 0: return &v.state @@ -1095,7 +1239,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*GoAgent); i { case 0: return &v.state @@ -1107,7 +1251,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } - file_hypertrace_agent_config_v1_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_hypertrace_agent_config_v1_config_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*Telemetry); i { case 0: return &v.state @@ -1119,6 +1263,30 @@ func file_hypertrace_agent_config_v1_config_proto_init() { return nil } } + file_hypertrace_agent_config_v1_config_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*Metrics); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypertrace_agent_config_v1_config_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*SystemMetrics); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1126,7 +1294,7 @@ func file_hypertrace_agent_config_v1_config_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hypertrace_agent_config_v1_config_proto_rawDesc, NumEnums: 3, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/gen/go/v1/config.pbloader.go b/gen/go/v1/config.pbloader.go index a7ce030..caaee80 100644 --- a/gen/go/v1/config.pbloader.go +++ b/gen/go/v1/config.pbloader.go @@ -303,4 +303,50 @@ func (x *Telemetry) loadFromEnv(prefix string, defaultValues *Telemetry) { x.MetricsEnabled = &wrappers.BoolValue{Value: defaultValues.MetricsEnabled.Value} } } + if x.Metrics == nil { + x.Metrics = new(Metrics) + } + if defaultValues == nil { + x.Metrics.loadFromEnv(prefix+"METRICS_", nil) + } else { + x.Metrics.loadFromEnv(prefix+"METRICS_", defaultValues.Metrics) + } + +} + +// loadFromEnv loads the data from env vars, defaults and makes sure all values are initialized. +func (x *Metrics) loadFromEnv(prefix string, defaultValues *Metrics) { + if val, ok := getBoolEnv(prefix + "ENABLED"); ok { + x.Enabled = &wrappers.BoolValue{Value: val} + } else if x.Enabled == nil { + // when there is no value to set we still prefer to initialize the variable to avoid + // `nil` checks in the consumers. + x.Enabled = new(wrappers.BoolValue) + if defaultValues != nil && defaultValues.Enabled != nil { + x.Enabled = &wrappers.BoolValue{Value: defaultValues.Enabled.Value} + } + } + if x.SystemMetrics == nil { + x.SystemMetrics = new(SystemMetrics) + } + if defaultValues == nil { + x.SystemMetrics.loadFromEnv(prefix+"SYSTEM_METRICS_", nil) + } else { + x.SystemMetrics.loadFromEnv(prefix+"SYSTEM_METRICS_", defaultValues.SystemMetrics) + } + +} + +// loadFromEnv loads the data from env vars, defaults and makes sure all values are initialized. +func (x *SystemMetrics) loadFromEnv(prefix string, defaultValues *SystemMetrics) { + if val, ok := getBoolEnv(prefix + "ENABLED"); ok { + x.Enabled = &wrappers.BoolValue{Value: val} + } else if x.Enabled == nil { + // when there is no value to set we still prefer to initialize the variable to avoid + // `nil` checks in the consumers. + x.Enabled = new(wrappers.BoolValue) + if defaultValues != nil && defaultValues.Enabled != nil { + x.Enabled = &wrappers.BoolValue{Value: defaultValues.Enabled.Value} + } + } } diff --git a/proto/hypertrace/agent/config/v1/config.proto b/proto/hypertrace/agent/config/v1/config.proto index 95f3ab9..e6e7a9d 100644 --- a/proto/hypertrace/agent/config/v1/config.proto +++ b/proto/hypertrace/agent/config/v1/config.proto @@ -195,5 +195,24 @@ message Telemetry { // Whether to capture metrics or not. The metrics will be otel go metrics. // See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric - google.protobuf.BoolValue metrics_enabled = 2; + google.protobuf.BoolValue metrics_enabled = 2 [deprecated = true]; + + // Metrics config + Metrics metrics = 3; } + +// Metrics has the config to enable OTEl and System metrics +message Metrics { + // Whether to capture metrics or not. The metrics will be otel go metrics. + // See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric + google.protobuf.BoolValue enabled = 1; + + // System metrics configuration. + SystemMetrics system_metrics = 2; +} + +// SystemMetrics has the config for capturing system metrics. +message SystemMetrics { + // Whether to capture system metrics or not. The system metrics is setup in goagent. + google.protobuf.BoolValue enabled = 1; +} \ No newline at end of file