Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service for dynamic config #61

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 64 additions & 0 deletions config_service.proto
Original file line number Diff line number Diff line change
@@ -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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using service_name here as a user will anyways define it in env var or system property and they have higher preference so it will be updated by agents. Do we have any other use case for sending service_name?

// 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<string, string> 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;
}