-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://github.com/terramate-io/terramate/blob/main/CONTRIBUTING.md 2. If the PR is unfinished, mark it as draft: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request 3. Please update the PR title using the Conventional Commits convention: https://www.conventionalcommits.org/en/v1.0.0/ Example: feat: add support for XYZ. --> ## What this PR does / why we need it: This PR adds telemetry to collect metrics about which commands are used most actively. We already have some general insights from the checkpoint API, but this gives more detailed data. Documentation will be updated accordingly. ## Special notes for your reviewer: ## Does this PR introduce a user-facing change? <!-- If no, just write "no" in the block below. If yes, please explain the change and update documentation and the CHANGELOG.md file accordingly. --> ``` - telemetry options have been added ```
- Loading branch information
Showing
19 changed files
with
1,014 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT | ||
|
||
resource "local_file" "telemetry" { | ||
content = <<-EOT | ||
package telemetry // import "github.com/terramate-io/terramate/cmd/terramate/cli/telemetry" | ||
var DefaultRecord = NewRecord() | ||
func Endpoint() url.URL | ||
func GenerateOrReadSignature(cpsigfile, anasigfile string) (string, bool) | ||
func GenerateSignature() string | ||
func ReadSignature(p string) string | ||
func SendMessage(msg *Message, p SendMessageParams) <-chan error | ||
type AuthType int | ||
const AuthNone AuthType = iota ... | ||
func DetectAuthTypeFromEnv(credpath string) AuthType | ||
type Message struct{ ... } | ||
type MessageOpt func(msg *Message) | ||
func BoolFlag(name string, flag bool, ifCmds ...string) MessageOpt | ||
func Command(cmd string) MessageOpt | ||
func DetectFromEnv(cmd string, credfile, cpsigfile, anasigfile string) MessageOpt | ||
func StringFlag(name string, flag string, ifCmds ...string) MessageOpt | ||
type PlatformType int | ||
const PlatformLocal PlatformType = iota ... | ||
func DetectPlatformFromEnv() PlatformType | ||
type Record struct{ ... } | ||
func NewRecord() *Record | ||
type SendMessageParams struct{ ... } | ||
EOT | ||
|
||
filename = "${path.module}/mock-telemetry.ignore" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2023 Terramate GmbH | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
//go:build !localhostEndpoints | ||
|
||
package telemetry | ||
|
||
import ( | ||
"net/url" | ||
) | ||
|
||
func Endpoint() url.URL { | ||
var u url.URL | ||
u.Scheme = "https" | ||
u.Host = "analytics.terramate.io" | ||
u.Path = "/" | ||
return u | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2023 Terramate GmbH | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
//go:build localhostEndpoints | ||
|
||
package telemetry | ||
|
||
import ( | ||
"net/url" | ||
) | ||
|
||
func Endpoint() url.URL { | ||
var u url.URL | ||
u.Scheme = "http" | ||
u.Host = "localhost:3000" | ||
u.Path = "/" | ||
return u | ||
} |
Oops, something went wrong.