Skip to content

Commit

Permalink
Set CONTRAST_INSTALL_SOURCE so agent's can pick it up
Browse files Browse the repository at this point in the history
  • Loading branch information
gamingrobot committed Aug 6, 2024
1 parent 498678a commit 00f2e6d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
yield return new V1EnvVar("CORECLR_ENABLE_PROFILING", "1");
}

yield return new V1EnvVar("CONTRAST_SOURCE", "kubernetes-operator");
yield return new V1EnvVar("CONTRAST_SOURCE", "kubernetes-operator"); //TODO: remove later after dotnet agent has migrated to CONTRAST_INSTALL_SOURCE
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
yield return new V1EnvVar("CONTRAST_CORECLR_INSTALL_DIRECTORY", context.AgentMountPath);
yield return new V1EnvVar("CONTRAST_CORECLR_DATA_DIRECTORY", context.WritableMountPath);
yield return new V1EnvVar("CONTRAST_CORECLR_LOGS_DIRECTORY", $"{context.WritableMountPath}/logs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
yield return new V1EnvVar("JAVA_TOOL_OPTIONS", GetContrastAgentArgument(context));
yield return new V1EnvVar("CONTRAST__AGENT__CONTRAST_WORKING_DIR", context.WritableMountPath);
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log");
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
}

public void PatchContainer(V1Container container, PatchingContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
yield return new V1EnvVar("NODE_OPTIONS", $"--require {context.AgentMountPath}/node_modules/@contrast/agent");
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log");
yield return new V1EnvVar("CONTRAST__AGENT__SECURITY_LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent_cef.log");
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
yield return new V1EnvVar("NODE_OPTIONS", $"--import {context.AgentMountPath}/node_modules/@contrast/agent/lib/esm-loader.mjs");
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log");
yield return new V1EnvVar("CONTRAST__AGENT__SECURITY_LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent_cef.log");
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
{
yield return new V1EnvVar("PHP_INI_SCAN_DIR", $":{context.AgentMountPath}/ini/");
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log");
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
}

public string GetOverrideAgentMountPath() => "/usr/local/lib/contrast/php";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
}
yield return new V1EnvVar("__CONTRAST_USING_RUNNER", "true");
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log");
yield return new V1EnvVar("CONTRAST_INSTALL_SOURCE", "kubernetes-operator");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void GenerateEnvVars_should_return_profiling_vars()
"CORECLR_PROFILER_PATH",
"CORECLR_ENABLE_PROFILING",
"CONTRAST_SOURCE",
"CONTRAST_INSTALL_SOURCE",
"CONTRAST_CORECLR_INSTALL_DIRECTORY",
"CONTRAST_CORECLR_DATA_DIRECTORY",
"CONTRAST_CORECLR_LOGS_DIRECTORY",
Expand All @@ -52,6 +53,7 @@ public void GenerateEnvVars_should_return_ldpreload_if_early_chaining()
{
"LD_PRELOAD",
"CONTRAST_SOURCE",
"CONTRAST_INSTALL_SOURCE",
"CONTRAST_CORECLR_INSTALL_DIRECTORY",
"CONTRAST_CORECLR_DATA_DIRECTORY",
"CONTRAST_CORECLR_LOGS_DIRECTORY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void GenerateEnvVars_should_return_correct_env_vars()
new("JAVA_TOOL_OPTIONS", $"-javaagent:{contextFake.AgentMountPath}/contrast-agent.jar"),
new("CONTRAST__AGENT__CONTRAST_WORKING_DIR", contextFake.WritableMountPath),
new("CONTRAST__AGENT__LOGGER__PATH", $"{contextFake.WritableMountPath}/logs/contrast_agent.log"),
new("CONTRAST_INSTALL_SOURCE", "kubernetes-operator"),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public void GenerateEnvVars_should_not_return_rewrite_if_not_rewriting()
{
"PYTHONPATH",
"__CONTRAST_USING_RUNNER",
"CONTRAST__AGENT__LOGGER__PATH"
"CONTRAST__AGENT__LOGGER__PATH",
"CONTRAST_INSTALL_SOURCE",
};

// Act
Expand All @@ -46,7 +47,8 @@ public void GenerateEnvVars_should_return_rewrite_if_rewriting()
"PYTHONPATH",
"CONTRAST__AGENT__PYTHON__REWRITE",
"__CONTRAST_USING_RUNNER",
"CONTRAST__AGENT__LOGGER__PATH"
"CONTRAST__AGENT__LOGGER__PATH",
"CONTRAST_INSTALL_SOURCE",
};

// Act
Expand Down

0 comments on commit 00f2e6d

Please sign in to comment.