Skip to content

Commit

Permalink
chore: add envbuilder subsystem if using inside Coder (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecarbs authored Mar 15, 2024
1 parent d20129d commit c727288
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/envbuilder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}) {
Expand Down

0 comments on commit c727288

Please sign in to comment.