diff --git a/instrumentation/Dockerfile b/instrumentation/Dockerfile index 9a8dca8e99..42f17fa504 100644 --- a/instrumentation/Dockerfile +++ b/instrumentation/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && \ WORKDIR /libsplunk COPY src /libsplunk/src -COPY testdata/instrumentation.conf /libsplunk/testdata/instrumentation.conf -COPY testdata/instrumentation-svcname.conf /libsplunk/testdata/instrumentation-svcname.conf +COPY testdata/instrumentation-default.conf /libsplunk/testdata/instrumentation-default.conf +COPY testdata/instrumentation-options.conf /libsplunk/testdata/instrumentation-options.conf COPY install/instrumentation.conf /libsplunk/install/instrumentation.conf COPY Makefile /libsplunk/Makefile diff --git a/instrumentation/README.md b/instrumentation/README.md index da16d818ae..395e686cba 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -58,6 +58,31 @@ Java instrumentation jar. Typically, it will be set to something like: to set the deployment environment for the Splunk backend. +### disable_telemetry (optional) + +Set this value to `true` to disable the preloader from sending the `splunk.linux-autoinstr.executions` metric to the +local collector. Default: `false`. + +### generate_service_name (optional) + +Set this value to `false` to prevent the preloader from setting the `OTEL_SERVICE_NAME` environment variable. +Default: `true`. + +### enable_profiler (optional) + +Set this value to `true` to pass `-Dsplunk.profiler.enabled=true` to the starting Java executable, which will enable +[AlwaysOn CPU Profiling](https://docs.splunk.com/Observability/apm/profiling/get-data-in-profiling.html). Default: `false`. + +### enable_profiler_memory (optional) + +Set this value to `true` to pass `-Dsplunk.profiler.memory.enabled=true` to the starting Java executable, which will enable +[AlwaysOn Memory Profiling](https://docs.splunk.com/Observability/apm/profiling/get-data-in-profiling.html). Default: `false`. + +### enable_metrics (optional) + +Set this value to `true` to pass `-Dsplunk.metrics.enabled=true` to the starting Java executable, which will enable +[exporting metrics](https://github.com/signalfx/splunk-otel-java/blob/main/docs/metrics.md). Default: `false`. + ### Syntax To add a comment or comment out a line, start it with a `#`. @@ -79,7 +104,8 @@ This environment variable contains a `-javaagent` flag set to the full path of t e.g. `JAVA_TOOL_OPTIONS='-javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar'` -This variable is populated by the .so by concatenating the `java_agent_jar` attribute the config to a `-javaagent:` prefix. +This variable is populated by the .so by concatenating the `java_agent_jar` attribute in the config to a `-javaagent:` +prefix, and then appending any additional system properties specified in the configuration file. #### OTEL_SERVICE_NAME diff --git a/instrumentation/install/instrumentation.conf b/instrumentation/install/instrumentation.conf index 5f125193c5..9c4631f816 100644 --- a/instrumentation/install/instrumentation.conf +++ b/instrumentation/install/instrumentation.conf @@ -1,2 +1,10 @@ -# service_name=default.service java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar +#resource_attributes=deployment.environment=my.environment +#service_name=hardcoded.service + +# note: any of the the following lines may be uncommented to override defaults +#disable_telemetry=true +#generate_service_name=false +#enable_profiler=true +#enable_profiler_memory=true +#enable_metrics=true diff --git a/instrumentation/src/config.c b/instrumentation/src/config.c index bd70423a9d..a665be002c 100644 --- a/instrumentation/src/config.c +++ b/instrumentation/src/config.c @@ -15,23 +15,28 @@ void read_lines(struct config *cfg, FILE *fp); void split_on_eq(char *string, struct kv *pair); +void log_config_field(logger log, const char *field, const char *value); + void load_config(logger log, struct config *cfg, char *file_name) { read_config_file(log, cfg, file_name); - if (cfg->service_name == NULL) { - log_debug(log, "service_name not specified in config"); - } - if (cfg->java_agent_jar == NULL) { - log_debug(log, "java_agent_jar not specified in config"); - } - if (cfg->resource_attributes == NULL) { - log_debug(log, "resource_attributes not specified in config"); - } - if (cfg->disable_telemetry == NULL) { - log_debug(log, "disable_telemetry not specified in config"); - } - if (cfg->generate_service_name == NULL) { - log_debug(log, "generate_service_name not specified in config"); + log_config_field(log, "service_name", cfg->service_name); + log_config_field(log, "java_agent_jar", cfg->java_agent_jar); + log_config_field(log, "resource_attributes", cfg->resource_attributes); + log_config_field(log, "disable_telemetry", cfg->disable_telemetry); + log_config_field(log, "generate_service_name", cfg->generate_service_name); + log_config_field(log, "enable_profiler", cfg->enable_profiler); + log_config_field(log, "enable_profiler_memory", cfg->enable_profiler_memory); + log_config_field(log, "enable_metrics", cfg->enable_metrics); +} + +void log_config_field(logger log, const char *field, const char *value) { + char msg[MAX_LOG_LINE_LEN] = ""; + if (value == NULL) { + snprintf(msg, MAX_LOG_LINE_LEN, "config: %s not specified", field); + } else { + snprintf(msg, MAX_LOG_LINE_LEN, "config: %s=%s", field, value); } + log_debug(log, msg); } void read_config_file(logger log, struct config *cfg, char *file_name) { @@ -68,6 +73,12 @@ void read_lines(struct config *cfg, FILE *fp) { cfg->disable_telemetry = strdup(pair.v); } else if (streq(pair.k, "generate_service_name")) { cfg->generate_service_name = strdup(pair.v); + } else if (streq(pair.k, "enable_profiler")) { + cfg->enable_profiler = strdup(pair.v); + } else if (streq(pair.k, "enable_profiler_memory")) { + cfg->enable_profiler_memory = strdup(pair.v); + } else if (streq(pair.k, "enable_metrics")) { + cfg->enable_metrics = strdup(pair.v); } } } @@ -77,12 +88,14 @@ void split_on_eq(char *string, struct kv *pair) { pair->v = string; } -bool str_eq_true(char *v) { - return v != NULL && !streq("false", v) && !streq("FALSE", v) && !streq("0", v); -} - -bool str_eq_false(char *v) { - return v != NULL && (streq("false", v) || streq("FALSE", v) || streq("0", v)); +bool str_to_bool(char *v, bool defaultVal) { + if (v == NULL) { + return defaultVal; + } + if (streq("false", v) || streq("FALSE", v) || streq("0", v)) { + return false; + } + return true; } void free_config(struct config *cfg) { @@ -101,4 +114,13 @@ void free_config(struct config *cfg) { if (cfg->generate_service_name != NULL) { free(cfg->generate_service_name); } + if (cfg->enable_profiler != NULL) { + free(cfg->enable_profiler); + } + if (cfg->enable_profiler_memory != NULL) { + free(cfg->enable_profiler_memory); + } + if (cfg->enable_metrics != NULL) { + free(cfg->enable_metrics); + } } diff --git a/instrumentation/src/config.h b/instrumentation/src/config.h index 235fd248a5..05cd39fe2e 100644 --- a/instrumentation/src/config.h +++ b/instrumentation/src/config.h @@ -11,13 +11,14 @@ struct config { char *resource_attributes; char *disable_telemetry; char *generate_service_name; + char *enable_profiler; + char *enable_profiler_memory; + char *enable_metrics; }; void load_config(logger log, struct config *cfg, char *file_name); -bool str_eq_true(char *v); - -bool str_eq_false(char *v); +bool str_to_bool(char *v, bool); void free_config(struct config *cfg); diff --git a/instrumentation/src/splunk.c b/instrumentation/src/splunk.c index b3965b83a9..391cf72c97 100644 --- a/instrumentation/src/splunk.c +++ b/instrumentation/src/splunk.c @@ -8,7 +8,7 @@ #include #include -#define ENV_VAR_LEN 512 +#define MAX_ENV_VAR_LEN 512 #define MAX_CONFIG_ATTR_LEN 256 #define MAX_CMDLINE_LEN 16000 #define MAX_ARGS 256 @@ -16,6 +16,9 @@ #define JAVA_TOOL_OPTIONS_PREFIX "-javaagent:"; static char *const conf_file = "/usr/lib/splunk-instrumentation/instrumentation.conf"; +static char *const prof_enabled_cmdline_switch = " -Dsplunk.profiler.enabled=true"; +static char *const prof_memory_enabled_cmdline_switch = " -Dsplunk.profiler.memory.enabled=true"; +static char *const metrics_enabled_cmdline_switch = " -Dsplunk.metrics.enabled=true"; extern char *program_invocation_short_name; @@ -73,7 +76,11 @@ void auto_instrument( .java_agent_jar = NULL, .resource_attributes = NULL, .service_name = NULL, - .disable_telemetry = NULL + .disable_telemetry = NULL, + .generate_service_name = NULL, + .enable_profiler = NULL, + .enable_profiler_memory = NULL, + .enable_metrics = NULL }; load_config_func(log, &cfg, conf_file); if (cfg.java_agent_jar == NULL) { @@ -87,22 +94,22 @@ void auto_instrument( } char service_name[MAX_CMDLINE_LEN] = ""; - if (str_eq_false(cfg.generate_service_name)) { - log_debug(log, "service name generation disabled"); - } else { + if (str_to_bool(cfg.generate_service_name, true)) { get_service_name(log, cr, &cfg, service_name); if (strlen(service_name) == 0) { log_info(log, "service name empty, quitting"); return; } set_env_var(log, otel_service_name_var, service_name); + } else { + log_debug(log, "service name generation explicitly disabled"); } set_java_tool_options(log, &cfg); set_env_var_from_attr(log, "resource_attributes", resource_attributes_var, cfg.resource_attributes); - if (str_eq_true(cfg.disable_telemetry)) { + if (str_to_bool(cfg.disable_telemetry, false)) { log_info(log, "disabling telemetry as per config"); } else { send_otlp_metric_func(log, service_name); @@ -148,7 +155,7 @@ void set_env_var(logger log, const char *var_name, const char *value) { } void set_java_tool_options(logger log, struct config *cfg) { - char java_tool_options[ENV_VAR_LEN] = JAVA_TOOL_OPTIONS_PREFIX; + char java_tool_options[MAX_ENV_VAR_LEN] = JAVA_TOOL_OPTIONS_PREFIX; char log_line[MAX_LOG_LINE_LEN] = ""; size_t jar_path_len = strlen(cfg->java_agent_jar); if (jar_path_len > MAX_CONFIG_ATTR_LEN) { @@ -156,7 +163,18 @@ void set_java_tool_options(logger log, struct config *cfg) { log_warning(log, log_line); return; } - strcat(java_tool_options, (*cfg).java_agent_jar); + strncat(java_tool_options, cfg->java_agent_jar, MAX_ENV_VAR_LEN - strlen(java_tool_options) - 1); + + if (str_to_bool(cfg->enable_profiler, false)) { + strncat(java_tool_options, prof_enabled_cmdline_switch, MAX_ENV_VAR_LEN - strlen(java_tool_options) - 1); + } + if (str_to_bool(cfg->enable_profiler_memory, false)) { + strncat(java_tool_options, prof_memory_enabled_cmdline_switch, MAX_ENV_VAR_LEN - strlen(java_tool_options) - 1); + } + if (str_to_bool(cfg->enable_metrics, false)) { + strncat(java_tool_options, metrics_enabled_cmdline_switch, MAX_ENV_VAR_LEN - strlen(java_tool_options) - 1); + } + sprintf(log_line, "setting JAVA_TOOL_OPTIONS='%s'", java_tool_options); log_debug(log, log_line); setenv(java_tool_options_var, java_tool_options, 0); diff --git a/instrumentation/src/test_main.c b/instrumentation/src/test_main.c index 3cc69e81bb..7a0e294ac6 100644 --- a/instrumentation/src/test_main.c +++ b/instrumentation/src/test_main.c @@ -7,8 +7,8 @@ #include #include -static char *const test_config_path = "testdata/instrumentation.conf"; -static char *const test_config_path_svcname = "testdata/instrumentation-svcname.conf"; +static char *const test_config_path = "testdata/instrumentation-default.conf"; +static char *const test_config_path_all_options = "testdata/instrumentation-options.conf"; int main(void) { run_tests(); @@ -28,8 +28,8 @@ void run_tests() { test_auto_instrument_splunk_env_var_false, test_auto_instrument_splunk_env_var_false_caps, test_auto_instrument_splunk_env_var_zero, - test_read_config, - test_read_config_svcname, + test_read_config_default, + test_read_config_all_options, test_read_config_missing_file, test_read_args_simple, test_read_args_max_args_limit, @@ -55,10 +55,12 @@ void run_tests() { test_is_legal_java_fq_main_class, test_is_legal_java_module_main_class, test_is_legal_module, - test_eq_true, - test_eq_false, + test_str_to_bool, test_disable_telemetry, - test_enable_telemetry + test_enable_telemetry, + test_enable_profiling, + test_enable_profiling_memory, + test_enable_metrics }; for (int i = 0; i < sizeof tests / sizeof tests[0]; ++i) { run_test(tests[i]); @@ -113,7 +115,7 @@ void test_auto_instrument_gen_svc_name_explicitly_disabled(logger l) { auto_instrument(l, access_check_true, "java", fake_config_generate_svcname_disabled, cr, fake_send_otlp_metric); char *logs[256]; int n = get_logs(l, logs); - require_equal_strings(funcname, "service name generation disabled", logs[0]); + require_equal_strings(funcname, "service name generation explicitly disabled", logs[0]); require_equal_strings(funcname, "setting JAVA_TOOL_OPTIONS='-javaagent:/foo/asdf.jar'", logs[1]); require_equal_strings(funcname, "sending metric", logs[2]); require_equal_ints(funcname, 3, n); @@ -195,36 +197,58 @@ void test_auto_instrument_splunk_env_var_zero(logger l) { cmdline_reader_close(cr); } -void test_read_config(logger l) { +void test_read_config_default(logger l) { struct config cfg = {.java_agent_jar = NULL, .service_name = NULL}; load_config(l, &cfg, test_config_path); char *logs[256]; int n = get_logs(l, logs); - char *funcname = "test_read_config"; - require_equal_ints(funcname, 2, n); - require_equal_strings(funcname, "reading config file: testdata/instrumentation.conf", logs[0]); - require_equal_strings(funcname, "generate_service_name not specified in config", logs[1]); - require_equal_strings(funcname, "default.service", cfg.service_name); + char *funcname = "test_read_config_default"; + require_equal_ints(funcname, 9, n); + require_equal_strings(funcname, "reading config file: testdata/instrumentation-default.conf", logs[0]); + require_equal_strings(funcname, "config: service_name not specified", logs[1]); + require_equal_strings(funcname, "config: java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar", logs[2]); + require_equal_strings(funcname, "config: resource_attributes=deployment.environment=test", logs[3]); + require_equal_strings(funcname, "config: disable_telemetry not specified", logs[4]); + require_equal_strings(funcname, "config: generate_service_name not specified", logs[5]); + require_equal_strings(funcname, "config: enable_profiler not specified", logs[6]); + require_equal_strings(funcname, "config: enable_profiler_memory not specified", logs[7]); + require_equal_strings(funcname, "config: enable_metrics not specified", logs[8]); require_equal_strings(funcname, "/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar", cfg.java_agent_jar); + require_equal_strings(funcname, NULL, cfg.service_name); require_equal_strings(funcname, "deployment.environment=test", cfg.resource_attributes); - require_equal_strings(funcname, "true", cfg.disable_telemetry); + require_equal_strings(funcname, NULL, cfg.disable_telemetry); require_equal_strings(funcname, NULL, cfg.generate_service_name); + require_equal_strings(funcname, NULL, cfg.enable_profiler); + require_equal_strings(funcname, NULL, cfg.enable_profiler_memory); + require_equal_strings(funcname, NULL, cfg.enable_metrics); free_config(&cfg); } -void test_read_config_svcname(logger l) { +void test_read_config_all_options(logger l) { struct config cfg = {.java_agent_jar = NULL, .service_name = NULL}; - load_config(l, &cfg, test_config_path_svcname); + load_config(l, &cfg, test_config_path_all_options); char *logs[256]; int n = get_logs(l, logs); - char *funcname = "test_read_config_svcname"; - require_equal_ints(funcname, 1, n); - require_equal_strings(funcname, "reading config file: testdata/instrumentation-svcname.conf", logs[0]); + char *funcname = "test_read_config_all_options"; + require_equal_ints(funcname, 9, n); + require_equal_strings(funcname, "reading config file: testdata/instrumentation-options.conf", logs[0]); + require_equal_strings(funcname, "config: service_name=default.service", logs[1]); + require_equal_strings(funcname, "config: java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar", logs[2]); + require_equal_strings(funcname, "config: resource_attributes=deployment.environment=test", logs[3]); + require_equal_strings(funcname, "config: disable_telemetry=true", logs[4]); + require_equal_strings(funcname, "config: generate_service_name=true", logs[5]); + require_equal_strings(funcname, "config: enable_profiler=true", logs[6]); + require_equal_strings(funcname, "config: enable_profiler_memory=true", logs[7]); + require_equal_strings(funcname, "config: enable_metrics=true", logs[8]); + require_equal_strings(funcname, "default.service", cfg.service_name); require_equal_strings(funcname, "/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar", cfg.java_agent_jar); require_equal_strings(funcname, "deployment.environment=test", cfg.resource_attributes); require_equal_strings(funcname, "true", cfg.disable_telemetry); require_equal_strings(funcname, "true", cfg.generate_service_name); + require_equal_strings(funcname, "true", cfg.enable_profiler); + require_equal_strings(funcname, "true", cfg.enable_profiler_memory); + require_equal_strings(funcname, "true", cfg.enable_metrics); free_config(&cfg); } @@ -234,13 +258,16 @@ void test_read_config_missing_file(logger l) { char *logs[256]; int n = get_logs(l, logs); char *funcname = "test_read_config_missing_file"; - require_equal_ints(funcname, 6, n); + require_equal_ints(funcname, 9, n); require_equal_strings(funcname, "file not found: foo.txt", logs[0]); - require_equal_strings(funcname, "service_name not specified in config", logs[1]); - require_equal_strings(funcname, "java_agent_jar not specified in config", logs[2]); - require_equal_strings(funcname, "resource_attributes not specified in config", logs[3]); - require_equal_strings(funcname, "disable_telemetry not specified in config", logs[4]); - require_equal_strings(funcname, "generate_service_name not specified in config", logs[5]); + require_equal_strings(funcname, "config: service_name not specified", logs[1]); + require_equal_strings(funcname, "config: java_agent_jar not specified", logs[2]); + require_equal_strings(funcname, "config: resource_attributes not specified", logs[3]); + require_equal_strings(funcname, "config: disable_telemetry not specified", logs[4]); + require_equal_strings(funcname, "config: generate_service_name not specified", logs[5]); + require_equal_strings(funcname, "config: enable_profiler not specified", logs[6]); + require_equal_strings(funcname, "config: enable_profiler_memory not specified", logs[7]); + require_equal_strings(funcname, "config: enable_metrics not specified", logs[8]); require_equal_strings(funcname, NULL, cfg.service_name); require_equal_strings(funcname, NULL, cfg.java_agent_jar); free_config(&cfg); @@ -499,22 +526,14 @@ void test_is_legal_module(logger l) { require_false(funcname, is_legal_module("foo bar")); } -void test_eq_true(logger l) { - require_true("test_eq_true", str_eq_true("true")); - require_true("test_eq_true", str_eq_true("1")); - require_true("test_eq_true", str_eq_true("TRUE")); - require_false("test_eq_true", str_eq_true("false")); - require_false("test_eq_true", str_eq_true("0")); - require_false("test_eq_true", str_eq_true(NULL)); -} - -void test_eq_false(logger l) { - require_true("str_eq_false", str_eq_false("false")); - require_true("str_eq_false", str_eq_false("FALSE")); - require_true("str_eq_false", str_eq_false("0")); - require_false("str_eq_false", str_eq_false("true")); - require_false("str_eq_false", str_eq_false("TRUE")); - require_false("str_eq_false", str_eq_false("1")); +void test_str_to_bool(logger l) { + require_false("test_str_bool", str_to_bool("false", false)); + require_false("test_str_bool", str_to_bool("FALSE", false)); + require_false("test_str_bool", str_to_bool("0", false)); + require_false("test_str_bool", str_to_bool(NULL, false)); + require_true("test_str_bool", str_to_bool("true", false)); + require_true("test_str_bool", str_to_bool("42", false)); + require_true("test_str_bool", str_to_bool(NULL, true)); } void test_enable_telemetry(logger l) { @@ -534,6 +553,24 @@ void test_disable_telemetry(logger l) { require_equal_strings("test_disable_telemetry", "disabling telemetry as per config", logs[2]); } +void test_enable_profiling(logger l) { + cmdline_reader cr = new_default_test_cmdline_reader(); + auto_instrument(l, access_check_true, "java", fake_config_enable_profiler, cr, fake_send_otlp_metric); + require_env("test_enable_profiling", "-javaagent:/foo/asdf.jar -Dsplunk.profiler.enabled=true", "JAVA_TOOL_OPTIONS"); +} + +void test_enable_profiling_memory(logger l) { + cmdline_reader cr = new_default_test_cmdline_reader(); + auto_instrument(l, access_check_true, "java", fake_config_enable_profiler_memory, cr, fake_send_otlp_metric); + require_env("test_enable_profiling_memory", "-javaagent:/foo/asdf.jar -Dsplunk.profiler.memory.enabled=true", "JAVA_TOOL_OPTIONS"); +} + +void test_enable_metrics(logger l) { + cmdline_reader cr = new_default_test_cmdline_reader(); + auto_instrument(l, access_check_true, "java", fake_config_enable_metrics, cr, fake_send_otlp_metric); + require_env("test_enable_metrics", "-javaagent:/foo/asdf.jar -Dsplunk.metrics.enabled=true", "JAVA_TOOL_OPTIONS"); +} + // fakes/testdata void fake_send_otlp_metric(logger log, char *service_name) { @@ -574,6 +611,21 @@ void fake_config_disable_telemetry_true(logger log, struct config *cfg, char *pa cfg->disable_telemetry = strdup("true"); } +void fake_config_enable_profiler(logger log, struct config *cfg, char *path) { + cfg->java_agent_jar = strdup("/foo/asdf.jar"); + cfg->enable_profiler = strdup("true"); +} + +void fake_config_enable_profiler_memory(logger log, struct config *cfg, char *path) { + cfg->java_agent_jar = strdup("/foo/asdf.jar"); + cfg->enable_profiler_memory = strdup("true"); +} + +void fake_config_enable_metrics(logger log, struct config *cfg, char *path) { + cfg->java_agent_jar = strdup("/foo/asdf.jar"); + cfg->enable_metrics = strdup("true"); +} + cmdline_reader new_default_test_cmdline_reader() { char cmdline[] = {'j', 'a', 'v', 'a', 0, '-', 'j', 'a', 'r', 0, 'f', 'o', 'o', '.', 'j', 'a', 'r', 0}; return new_test_cmdline_reader(cmdline, sizeof(cmdline)); diff --git a/instrumentation/src/test_main.h b/instrumentation/src/test_main.h index 6973369d62..97a5cd5bbe 100644 --- a/instrumentation/src/test_main.h +++ b/instrumentation/src/test_main.h @@ -32,9 +32,9 @@ void test_auto_instrument_splunk_env_var_false_caps(logger l); void test_auto_instrument_splunk_env_var_zero(logger l); -void test_read_config(logger l); +void test_read_config_default(logger l); -void test_read_config_svcname(logger l); +void test_read_config_all_options(logger l); void test_read_config_missing_file(logger l); @@ -86,14 +86,18 @@ void test_is_legal_java_package_element(logger l); void test_is_legal_module(logger l); -void test_eq_true(logger l); - -void test_eq_false(logger l); +void test_str_to_bool(logger l); void test_enable_telemetry(logger l); void test_disable_telemetry(logger l); +void test_enable_profiling(logger l); + +void test_enable_profiling_memory(logger l); + +void test_enable_metrics(logger l); + // fakes/testdata void fake_send_otlp_metric(logger log, char *service_name); @@ -110,6 +114,12 @@ void fake_config_disable_telemetry_not_specified(logger log, struct config *cfg, void fake_config_disable_telemetry_true(logger log, struct config *cfg, char *path); +void fake_config_enable_profiler(logger log, struct config *cfg, char *path); + +void fake_config_enable_profiler_memory(logger log, struct config *cfg, char *path); + +void fake_config_enable_metrics(logger log, struct config *cfg, char *path); + cmdline_reader new_default_test_cmdline_reader(); bool access_check_true(const char *s); diff --git a/instrumentation/testdata/instrumentation.conf b/instrumentation/testdata/instrumentation-default.conf similarity index 69% rename from instrumentation/testdata/instrumentation.conf rename to instrumentation/testdata/instrumentation-default.conf index f1ed49426e..a800bad4f4 100644 --- a/instrumentation/testdata/instrumentation.conf +++ b/instrumentation/testdata/instrumentation-default.conf @@ -1,4 +1,2 @@ -service_name=default.service -java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar resource_attributes=deployment.environment=test -disable_telemetry=true +java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar diff --git a/instrumentation/testdata/instrumentation-svcname.conf b/instrumentation/testdata/instrumentation-options.conf similarity index 74% rename from instrumentation/testdata/instrumentation-svcname.conf rename to instrumentation/testdata/instrumentation-options.conf index 551dfd2323..aa74a6262b 100644 --- a/instrumentation/testdata/instrumentation-svcname.conf +++ b/instrumentation/testdata/instrumentation-options.conf @@ -1,5 +1,8 @@ -service_name=default.service java_agent_jar=/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar +service_name=default.service resource_attributes=deployment.environment=test disable_telemetry=true generate_service_name=true +enable_profiler=true +enable_profiler_memory=true +enable_metrics=true