Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: implement observability of notifications subsystem#13799

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 27 commits intomainfromdk/system-notifications-o11y
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
27 commits
Select commitHold shift + click to select a range
7f60c0f
Implement observability of notification subsystem
dannykoppingJul 3, 2024
d62d704
make lint
dannykoppingJul 5, 2024
96dac65
make gen
dannykoppingJul 5, 2024
130de49
make fmt
dannykoppingJul 8, 2024
e868752
Small fixes
dannykoppingJul 8, 2024
cee93cb
Review comments
dannykoppingJul 8, 2024
387b557
Apply suggestions from code review
dannykoppingJul 8, 2024
114797d
Correcting query
dannykoppingJul 8, 2024
5ff29c0
Merge branch 'main' of github.com:/coder/coder into dk/system-notific…
dannykoppingJul 9, 2024
88451a1
Only return UUID from EnqueueNotificationMessage
dannykoppingJul 9, 2024
09f7305
Review feedback
dannykoppingJul 9, 2024
91e2a23
Minor fixups
dannykoppingJul 9, 2024
9f1d6b3
Revert hack, no output param needed
dannykoppingJul 10, 2024
15c4537
Small touch-ups
dannykoppingJul 10, 2024
53ecad4
Merge branch 'main' of https://github.com/coder/coder into dk/system-…
dannykoppingJul 10, 2024
bc2a4cb
Merge branch 'main' of https://github.com/coder/coder into dk/system-…
dannykoppingJul 10, 2024
716e591
Harden tests, fail early
dannykoppingJul 10, 2024
d408ed2
make fmt
dannykoppingJul 10, 2024
2b9eec3
Restoring deleted line
dannykoppingJul 10, 2024
4211c84
Comments
dannykoppingJul 10, 2024
24417c5
Lock before modification
dannykoppingJul 10, 2024
72bb1be
Remove TestNotifierPaused's unnecessarily fast fetch interval
dannykoppingJul 10, 2024
bfca2c1
Merge branch 'main' of https://github.com/coder/coder into dk/system-…
dannykoppingJul 10, 2024
6602682
Rename migration after numbering conflict
dannykoppingJul 10, 2024
00633a1
Small fixes
dannykoppingJul 11, 2024
f454184
Merge branch 'main' of https://github.com/coder/coder into dk/system-…
dannykoppingJul 11, 2024
84d07d4
Logging improvement
dannykoppingJul 11, 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
PrevPrevious commit
NextNext commit
make gen
Signed-off-by: Danny Kopping <danny@coder.com>
  • Loading branch information
@dannykopping
dannykopping committedJul 8, 2024
commit96dac65d87284b5250a8b4c8d1df9df470b5f15d
3 changes: 2 additions & 1 deletioncoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

13 changes: 5 additions & 8 deletionscoderd/notifications/manager.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,10 +60,6 @@ type Manager struct {
// helpers is a map of template helpers which are used to customize notification messages to use global settings like
// access URL etc.
func NewManager(cfg codersdk.NotificationsConfig, store Store, metrics *Metrics, log slog.Logger) (*Manager, error) {
if metrics == nil {
panic("nil metrics passed to notifications manager")
}

method, err := dispatchMethodFromCfg(cfg)
if err != nil {
return nil, err
Expand DownExpand Up@@ -211,6 +207,11 @@ func (m *Manager) BufferedUpdatesCount() (success int, failure int) {

// syncUpdates updates messages in the store based on the given successful and failed message dispatch results.
func (m *Manager) syncUpdates(ctx context.Context) {
// Ensure we update the metrics to reflect the current state after each invocation.
defer func() {
m.metrics.PendingUpdates.Set(float64(len(m.success) + len(m.failure)))
}()

select {
case <-ctx.Done():
return
Expand All@@ -220,10 +221,6 @@ func (m *Manager) syncUpdates(ctx context.Context) {
nSuccess := len(m.success)
nFailure := len(m.failure)

defer func() {
m.metrics.PendingUpdates.Set(float64(len(m.success) + len(m.failure)))
}()

// Nothing to do.
if nSuccess+nFailure == 0 {
return
Expand Down
1 change: 0 additions & 1 deletioncoderd/notifications/notifications_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -516,7 +516,6 @@ func TestInvalidConfig(t *testing.T) {
cfg.LeasePeriod = serpent.Duration(leasePeriod)
cfg.DispatchTimeout = serpent.Duration(leasePeriod)

// TODO
_, err := notifications.NewManager(cfg, db, createMetrics(), logger.Named("manager"))
require.ErrorIs(t, err, notifications.ErrInvalidDispatchTimeout)
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp