Skip to content

Commit

Permalink
Merge pull request #32 from Traceableai/metrics-exporter-cfg
Browse files Browse the repository at this point in the history
ENG-53205: adding metrics exporter cfg
  • Loading branch information
varkey98 authored Dec 2, 2024
2 parents 02cf043 + 183be45 commit d6f5aaa
Show file tree
Hide file tree
Showing 7 changed files with 689 additions and 512 deletions.
5 changes: 4 additions & 1 deletion ENV_VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ Agents can be configured using environment variables:
| TA_METRICS_CONFIG_ENDPOINT_CONFIG_LOGGING_FREQUENCY | Set the frequency at which metrics should be printed. Examples are '1s', '2m', '3h'. Default value is 30m |
| TA_METRICS_CONFIG_LOGGING_ENABLED | Set this flag to print metrics in logs |
| TA_METRICS_CONFIG_LOGGING_FREQUENCY | Set the frequency at which metrics should be printed. Examples are '1s', '2m', '3h'. Default value is 30m |
| TA_METRICS_CONFIG_EXPORTER_ENABLED | When `true` metrics will be exported as spans from libtraceable |
| TA_METRICS_CONFIG_EXPORTER_EXPORT_INTERVAL_MS | Max interval for calls to TPA |
| TA_METRICS_CONFIG_EXPORTER_EXPORT_TIMEOUT_MS | Max timeout for calls to TPA |
| TA_METRICS_CONFIG_MAX_QUEUE_SIZE | Max length for metrics queue |
| TA_ENVIRONMENT | Represents the environment name of agent |
| TA_SERVICE_NAME | From HT config |
| TA_REPORTING_ENDPOINT | Represents the endpoint for reporting the traces For ZIPKIN reporter type use http://api.traceable.ai:9411/api/v2/spans For OTLP reporter type use http://api.traceable.ai:4317 |
Expand All @@ -65,7 +69,6 @@ Agents can be configured using environment variables:
| TA_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`. |
| TA_REPORTING_METRIC_ENDPOINT | Represents the endpoint for reporting the metrics. For OTLP metric reporter type use http://api.traceable.ai:4317 |
| TA_REPORTING_ENABLE_GRPC_LOADBALANCING | When `true`, modifies grpc resolver to use dns instead of passthrough and configure round robin client side loadbalancing |
| TA_REPORTING_AGENT_TOKEN | Represents the agent token to be used by the agent |
| TA_DATA_CAPTURE_HTTP_HEADERS_REQUEST | When `false` it disables the capture for the request in a client/request operation |
| TA_DATA_CAPTURE_HTTP_HEADERS_RESPONSE | When `false` it disables the capture for the response in a client/request operation |
| TA_DATA_CAPTURE_HTTP_BODY_REQUEST | When `false` it disables the capture for the request in a client/request operation |
Expand Down
2 changes: 1 addition & 1 deletion gen/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22

require (
github.com/ghodss/yaml v1.0.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
google.golang.org/protobuf v1.35.2
)

Expand Down
4 changes: 2 additions & 2 deletions gen/go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ 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/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.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
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.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
Expand Down
28 changes: 19 additions & 9 deletions gen/go/proto/v1/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ 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;

// represents the agent token to be used by the agent
google.protobuf.StringValue agent_token = 11;
}

// Opa covers the options related to the mechanics for getting Open Policy Agent configuration file.
Expand Down Expand Up @@ -218,12 +215,16 @@ message EndpointMetricsConfig {
}

message MetricsConfig {
// set this flag to enable metrics
google.protobuf.BoolValue enabled = 1;
// endpoint level configuration
EndpointMetricsConfig endpoint_config = 2;
// config for printing metrics in logs
MetricsLogConfig logging = 3;
// set this flag to enable metrics
google.protobuf.BoolValue enabled = 1;
// endpoint level configuration
EndpointMetricsConfig endpoint_config = 2;
// config for printing metrics in logs
MetricsLogConfig logging = 3;
// config for exporting metrics to Traceable Platform
MetricsExporterConfig exporter = 4;
// max length for metrics queue
google.protobuf.Int32Value max_queue_size = 5;
}

enum SpanType {
Expand Down Expand Up @@ -377,3 +378,12 @@ message Telemetry {
// See https://github.com/open-telemetry/opentelemetry-go/tree/main/metric
google.protobuf.BoolValue metrics_enabled = 2;
}

message MetricsExporterConfig {
// when `true` metrics will be exported as spans from libtraceable
google.protobuf.BoolValue enabled = 1;
// max interval for calls to TPA
google.protobuf.Int32Value export_interval_ms = 2;
// max timeout for calls to TPA
google.protobuf.Int32Value export_timeout_ms = 3;
}
Loading

0 comments on commit d6f5aaa

Please sign in to comment.