Skip to content

Commit

Permalink
telemetry: Insight into gitpod adoption (redwoodjs#9365)
Browse files Browse the repository at this point in the history
**Changes**
1. Checks for environment variables that starts with `GITPOD_` and
records whether any are found. This should allow us to gain an insight
into gitpod usage. I guess there could be false positive if non-gitpod
machines have env vars with `GITPOD_` but we can likely assume this to
be highly unlikely?
  • Loading branch information
Josh-Walker-GM authored Nov 4, 2023
1 parent c80df9b commit 328bec6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/cli/src/telemetry/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export async function getResources() {
const cpu = await system.cpu()
const mem = await system.mem()

// Record any specific development environment
let developmentEnvironment = undefined
// Gitpod
if (Object.keys(process.env).some((key) => key.startsWith('GITPOD_'))) {
developmentEnvironment = 'gitpod'
}

// Must only call getConfig() once the project is setup - so not within telemetry for CRWA
// Default to 'webpack' for new projects
const webBundler = getConfig().web.bundler
Expand Down Expand Up @@ -104,6 +111,7 @@ export async function getResources() {
'env.node_env': process.env.NODE_ENV || null,
'ci.redwood': !!process.env.REDWOOD_CI,
'ci.isci': ci.isCI,
'dev.environment': developmentEnvironment,
complexity,
sides,
experiments: JSON.stringify(experiments),
Expand Down
8 changes: 8 additions & 0 deletions packages/create-redwood-app/src/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export async function startTelemetry() {
const cpu = await system.cpu()
const mem = await system.mem()

// Record any specific development environment
let developmentEnvironment = undefined
// Gitpod
if (Object.keys(process.env).some((key) => key.startsWith('GITPOD_'))) {
developmentEnvironment = 'gitpod'
}

const resource = Resource.default().merge(
new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: packageName,
Expand All @@ -73,6 +80,7 @@ export async function startTelemetry() {
'env.node_env': process.env.NODE_ENV || null,
'ci.redwood': !!process.env.REDWOOD_CI,
'ci.isci': ci.isCI,
'dev.environment': developmentEnvironment,
uid: UID,
})
)
Expand Down

0 comments on commit 328bec6

Please sign in to comment.