Skip to content

chore: track terraform modules in telemetry #15450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Nov 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0f713ed
add the workspace_modules table, add the module column to workspace_r…
hugodutka Nov 6, 2024
82c8a3c
insert workspace modules on provisioner job completion
hugodutka Nov 6, 2024
307a57e
add foreign key to job on workspace_modules
hugodutka Nov 6, 2024
2ae16fc
don't return the root module
hugodutka Nov 7, 2024
7f2f155
add and populate the module_path column to workspace_resources
hugodutka Nov 7, 2024
863235d
TestCompleteJob - Modules WIP
hugodutka Nov 7, 2024
993f0ab
TemplateImport CompleteJob Modules test
hugodutka Nov 8, 2024
e8fbd40
TestCompleteJob Modules WorkspaceBuild
hugodutka Nov 8, 2024
5c542e5
add a test for returning modules in provision_test.go, fix test in re…
hugodutka Nov 8, 2024
9ec5ee1
make gen
hugodutka Nov 8, 2024
119a686
fix dbauthz tests
hugodutka Nov 8, 2024
3a5a025
add workspace modules and workspace resources's ModulePath to telemetry
hugodutka Nov 8, 2024
3377d22
add a workspace_modules fixture
hugodutka Nov 8, 2024
422b112
add a workspace resource's modulePath default to the e2e helper
hugodutka Nov 8, 2024
46b9b36
add modules default on PlanComplete for e2e tests
hugodutka Nov 8, 2024
f3f4d5c
lint
hugodutka Nov 8, 2024
93ed136
set module path to sentinel value when parsing failed and log an error
hugodutka Nov 13, 2024
301a153
change error string
hugodutka Nov 13, 2024
212e7d5
obfuscate workspace module source and version
hugodutka Nov 13, 2024
e9b7c46
fixes after rebase
hugodutka Nov 14, 2024
25cba6d
change migration number
hugodutka Nov 15, 2024
780730f
change fixture number
hugodutka Nov 15, 2024
b47a018
add index on created_at
hugodutka Nov 15, 2024
03be52e
add a comment about using modules from plan instead of apply
hugodutka Nov 15, 2024
00b8131
convert sentinel string to an error
hugodutka Nov 15, 2024
4187fbf
remove unnecessary comment
hugodutka Nov 15, 2024
7e82c3d
don't fail if we can't get modules from disk
hugodutka Nov 15, 2024
42e57ca
add a test for a malformed module
hugodutka Nov 16, 2024
368fc25
add a comment
hugodutka Nov 16, 2024
73b22cf
combine assignment and conditional
hugodutka Nov 16, 2024
7b9d70a
make isCoderModule into a top level function
hugodutka Nov 16, 2024
ea82313
use dbtestutil.NewDB instead of dbmem
hugodutka Nov 16, 2024
8564e9a
make gen
hugodutka Nov 16, 2024
d11fc82
combine 2 more assignments and conditionals
hugodutka Nov 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make isCoderModule into a top level function
  • Loading branch information
hugodutka committed Nov 16, 2024
commit 7b9d70aa3e37754a75d585da99508827a84dc21c
7 changes: 5 additions & 2 deletions coderd/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,14 @@ func ConvertWorkspaceResourceMetadata(metadata database.WorkspaceResourceMetadat
}
}

func shouldSendRawModuleSource(source string) bool {
return strings.Contains(source, "registry.coder.com")
}

func ConvertWorkspaceModule(module database.WorkspaceModule) WorkspaceModule {
isCoderModule := strings.Contains(module.Source, "registry.coder.com")
source := module.Source
version := module.Version
if !isCoderModule {
if !shouldSendRawModuleSource(source) {
source = fmt.Sprintf("%x", sha256.Sum256([]byte(source)))
version = fmt.Sprintf("%x", sha256.Sum256([]byte(version)))
}
Expand Down