From c72728897e91e713958a8ca0c7211574784ae79e Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 15 Mar 2024 14:47:26 +0100 Subject: [PATCH] chore: add envbuilder subsystem if using inside Coder (#110) --- cmd/envbuilder/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/envbuilder/main.go b/cmd/envbuilder/main.go index fda965a..7e18be2 100644 --- a/cmd/envbuilder/main.go +++ b/cmd/envbuilder/main.go @@ -55,6 +55,17 @@ func main() { var flushAndClose func(ctx context.Context) error sendLogs, flushAndClose = agentsdk.LogsSender(agentsdk.ExternalLogSourceID, client.PatchLogs, slog.Logger{}) defer flushAndClose(cmd.Context()) + + // This adds the envbuilder subsystem. + // If telemetry is enabled in a Coder deployment, + // this will be reported and help us understand + // envbuilder usage. + subsystems := os.Getenv("CODER_AGENT_SUBSYSTEM") + if subsystems != "" { + subsystems += "," + } + subsystems += string(codersdk.AgentSubsystemEnvbuilder) + os.Setenv("CODER_AGENT_SUBSYSTEM", subsystems) } options.Logger = func(level codersdk.LogLevel, format string, args ...interface{}) {