MCPcopy Create free account
hub / github.com/dagger/dagger / notifyOnFailure

Method notifyOnFailure

toolchains/engine-dev/bench.go:64–93  ·  view source on GitHub ↗
(ctx context.Context, repo *dagger.GitRepository, err error, discordWebhook *dagger.Secret)

Source from the content-addressed store, hash-verified

62}
63
64func (dev *EngineDev) notifyOnFailure(ctx context.Context, repo *dagger.GitRepository, err error, discordWebhook *dagger.Secret) error {
65 if err == nil {
66 return nil
67 }
68 if discordWebhook == nil {
69 return err
70 }
71
72 commit, err := repo.Head().Commit(ctx)
73 if err != nil {
74 commit = "failed to find commit SHA"
75 }
76
77 daggerCloudURL, err := dag.Notify().DaggerCloudTraceURL(ctx)
78 if err != nil {
79 return fmt.Errorf("failed to fetch trace URL for failed benchmarks: %w", err)
80 }
81
82 message := fmt.Sprintf(
83 "[failed](%s) on SHA [%s](https://github.com/dagger/dagger/commit/%s)",
84 daggerCloudURL,
85 commit,
86 commit,
87 )
88 _, discordErr := dag.Notify().Discord(ctx, discordWebhook, message)
89 if discordErr != nil {
90 return fmt.Errorf("failed to notify discord that benchmarks failed: %w, discord error %w", err, discordErr)
91 }
92 return err
93}
94
95// Run specific benchmarks while curling (pprof) dumps from their associated dev engine:
96// defaults to heap dumps, eg: take a heap dump every second and one after the tests complete:

Callers 1

BenchmarkMethod · 0.95

Calls 5

CommitMethod · 0.65
HeadMethod · 0.45
DaggerCloudTraceURLMethod · 0.45
NotifyMethod · 0.45
DiscordMethod · 0.45

Tested by

no test coverage detected