Skip to content

Commit

Permalink
Support K8S_ATTACH environment variable for activation (#2482)
Browse files Browse the repository at this point in the history
Adds support for reading K8S_ATTACH to identify activation method
  • Loading branch information
stevejgordon authored Nov 12, 2024
1 parent 1339ad1 commit 83d360b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Elastic.Apm/Api/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ static bool CheckForLoadedAssembly(string name)
// Legacy mechanism: if the profiler is loaded add a `p` suffix to Agent.Version
service.Agent.Version += "-p";
// Check if profiler was injected via K8S hook.
if (new EnvironmentVariables(logger).SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S"))
var envvars =new EnvironmentVariables(logger);
if (envvars.SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S")
|| envvars.SafeCheckValue("ELASTIC_APM_ACTIVATION_METHOD", "K8S_ATTACH"))
activationMethod = Consts.ActivationK8SAttach;
else
activationMethod = Consts.ActivationMethodProfiler;
Expand Down

0 comments on commit 83d360b

Please sign in to comment.