Skip to content
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

Make users know about telemetry via startupWarnings #1336

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0726f74
Make users know about telemetry via startupWarnings
rumyantseva Oct 27, 2022
f96eb61
No mango anymore
rumyantseva Oct 27, 2022
2e64830
wip
rumyantseva Oct 27, 2022
76d17c9
simple test
rumyantseva Oct 27, 2022
f6d931e
wip
rumyantseva Oct 27, 2022
5cab120
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 27, 2022
1de8753
no delay in the state
rumyantseva Oct 27, 2022
f4f821a
Merge branch 'issue-1328-strtup-warnings-telem' of https://github.com…
rumyantseva Oct 27, 2022
a3a9e2f
wip
rumyantseva Oct 27, 2022
6c95d0c
Update text
AlekSi Oct 27, 2022
a02be04
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 27, 2022
e7c1121
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 28, 2022
40ecd3f
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 28, 2022
1ff7239
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 28, 2022
1ab4445
Update internal/handlers/pg/msg_getlog.go
rumyantseva Oct 30, 2022
cbde123
Tests for various telemetry states
rumyantseva Oct 30, 2022
4efd548
lint
rumyantseva Oct 30, 2022
fb5c3ea
wip
rumyantseva Oct 30, 2022
194336f
wip
rumyantseva Oct 30, 2022
e6bf3b8
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 31, 2022
64bef10
Update integration/setup/common.go
rumyantseva Oct 31, 2022
f1f525d
simplify tests
rumyantseva Oct 31, 2022
7bb9592
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 31, 2022
59d8c26
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 31, 2022
62d4732
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Oct 31, 2022
d7bf906
remove test
rumyantseva Nov 1, 2022
cb898c9
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Nov 1, 2022
33224e6
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Nov 1, 2022
846d839
Merge branch 'main' into issue-1328-strtup-warnings-telem
mergify[bot] Nov 2, 2022
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
no delay in the state
  • Loading branch information
rumyantseva committed Oct 27, 2022
commit 1de8753e5ff05c20028a0c17a6844e420bb5a367
7 changes: 3 additions & 4 deletions internal/handlers/pg/msg_getlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ func (h *Handler) MsgGetLog(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg,

state := h.StateProvider.Get()
if state.Telemetry == nil {
startupWarnings = append(startupWarnings, fmt.Sprintf(
"Telemetry state undecided, waiting %s before the first report."+
startupWarnings = append(startupWarnings,
"Telemetry state undecided, the first report will be delayed."+
" Read more about FerretDB telemetry at https://beacon.ferretdb.io.",
state.UndecidedDelay,
))
)
}

var log types.Array
Expand Down
7 changes: 3 additions & 4 deletions internal/handlers/tigris/msg_getlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ func (h *Handler) MsgGetLog(ctx context.Context, msg *wire.OpMsg) (*wire.OpMsg,

state := h.StateProvider.Get()
if state.Telemetry == nil {
startupWarnings = append(startupWarnings, fmt.Sprintf(
"Telemetry state undecided, waiting %s before the first report."+
startupWarnings = append(startupWarnings,
"Telemetry state undecided, the first report will be delayed."+
" Read more about FerretDB telemetry at https://beacon.ferretdb.io.",
state.UndecidedDelay,
))
)
}

var log types.Array
Expand Down
6 changes: 2 additions & 4 deletions internal/util/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import (

// State represents FerretDB process state.
type State struct {
UUID string `json:"uuid"`
Telemetry *bool `json:"telemetry,omitempty"` // nil for undecided
UndecidedDelay time.Duration `json:"undecided_delay,omitempty"`
UUID string `json:"uuid"`
Telemetry *bool `json:"telemetry,omitempty"` // nil for undecided

// never persisted
Start time.Time `json:"-"`
Expand Down Expand Up @@ -57,7 +56,6 @@ func (s *State) deepCopy() *State {
return &State{
UUID: s.UUID,
Telemetry: telemetry,
UndecidedDelay: s.UndecidedDelay,
Start: s.Start,
LatestVersion: s.LatestVersion,
HandlerVersion: s.HandlerVersion,
Expand Down
2 changes: 1 addition & 1 deletion internal/util/telemetry/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func NewReporter(opts *NewReporterOpts) (*Reporter, error) {
return nil, err
}

if err = opts.P.Update(func(s *state.State) { s.Telemetry = t; s.UndecidedDelay = opts.UndecidedDelay }); err != nil {
if err = opts.P.Update(func(s *state.State) { s.Telemetry = t }); err != nil {
return nil, err
}

Expand Down