From 7881b7da05f3ce98fd940866adeacd68fd2c64af Mon Sep 17 00:00:00 2001 From: Shashank Patidar Date: Wed, 7 Apr 2021 21:23:59 +0530 Subject: [PATCH] adding config_service.proto for dynamic config --- Makefile | 1 + config_service.proto | 64 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 config_service.proto diff --git a/Makefile b/Makefile index 4d6c4ee..6bc5412 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ help: ## Prints this help. lint: ## Lints the proto files. protolint config.proto + protolint config_service.proto generate-env-vars: init-git-submodule ## Generates the ENV_VARS.md with all environment variables. docker build -t hypertrace/agent-config/env-vars-generator tools/env-vars-generator diff --git a/config_service.proto b/config_service.proto new file mode 100644 index 0000000..6aa5112 --- /dev/null +++ b/config_service.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +package org.hypertrace.agent.config; + +import "google/protobuf/wrappers.proto"; + +option go_package = "github.com/hypertrace/goagent/config"; +option java_package = "org.hypertrace.agent.config"; + +import "config.proto"; + +service ConfigurationService { + // InitialConfiguration returns the initial configuration for an agent. + // It should be called by agents only if config file is not specified by user. + rpc InitialConfiguration(InitialConfigurationRequest) returns (InitialConfigurationResponse) {} + + // UpdateConfiguration returns the configs that can be dynamically updated in agents + rpc UpdateConfiguration(UpdateConfigurationRequest) returns (UpdateConfigurationResponse) {} +} + +// InitialConfigurationRequest has information about the agent +message InitialConfigurationRequest { + // hostname on which the agent is running + string hostname = 1; + // if running in a containerized environment the container id in which the agent is running + string container_id = 2; + // a map of identifiers the configuration service can use to apply a specific configuration to an agent + map identifiers = 3; +} + +// InitialConfigurationResponse has the initial config that will be used by agent at startup +message InitialConfigurationResponse { + // the timestamp associated with the configuration. This is the time + // the configuration was persisted, not when it was sent. The timestamp + // should only change when the persisted configuration has changed. + google.protobuf.Int32Value timestamp = 1; + // configuration to be applied to the agent at initialization + AgentConfig agent_config = 2; +} + +message UpdateConfigurationRequest { + // the timestamp of the current configuration + google.protobuf.Int32Value timestamp = 1; +} + +// not all configuration can be changed after the agent has started +// these are the properties which can be dynamically configured +// without restarting the agent +message UpdateConfigurationResponse { + // the timestamp associated with the configuration + // if there are no configuration change, this value will + // equal UpdateConfigurationRequest.timestamp + google.protobuf.Int32Value timestamp = 1; + // enable or disable the agent. This will not remove + // any instrumentation when set to false, but the agent + // will turn stop reporting spans, metrics etc + google.protobuf.BoolValue enabled = 2; + // data capture configuration which applies to all agents + DataCapture data_capture = 3; + // java agent specific configuration + JavaAgent java_agent = 4; + // custom_data_capture_endpoints are the custom endpoints with respective data capture rules + repeated CustomDataCaptureEndpoint custom_data_capture_endpoints = 5; +}