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

fix(promexporter): make spans better #3164

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions contrib/promexporter/exporters/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@
for _, pending := range e.cfg.DFKPending {
if err := e.stuckHeroCountStats(ctx, common.HexToAddress(pending.Owner), pending.ChainName); err != nil {
errs = append(errs, fmt.Errorf("could not get stuck hero count: %w", err))
span.AddEvent("could not get stuck hero count")

Check warning on line 145 in contrib/promexporter/exporters/exporter.go

View check run for this annotation

Codecov / codecov/patch

contrib/promexporter/exporters/exporter.go#L145

Added line #L145 was not covered by tests
}
span.AddEvent("could not get stuck hero count")
}

for _, gasCheck := range e.cfg.SubmitterChecks {
for _, chainID := range gasCheck.ChainIDs {
if err := e.submitterStats(common.HexToAddress(gasCheck.Address), chainID, gasCheck.Name); err != nil {
errs = append(errs, fmt.Errorf("could setup metric: %w", err))
errs = append(errs, fmt.Errorf("could not get submitter stats: %w", err))
span.AddEvent("could not get submitter stats")

Check warning on line 153 in contrib/promexporter/exporters/exporter.go

View check run for this annotation

Codecov / codecov/patch

contrib/promexporter/exporters/exporter.go#L152-L153

Added lines #L152 - L153 were not covered by tests
}
}
span.AddEvent("could get submitter stats")
}

for chainID := range e.cfg.BridgeChecks {
Expand All @@ -161,7 +161,8 @@
return retry.WithBackoff(ctx, func(ctx context.Context) error {
err := e.vpriceStats(ctx, chainID, token)
if err != nil && !errors.Is(err, errPoolNotExist) {
errs = append(errs, fmt.Errorf("stuck hero stats: %w", err))
errs = append(errs, fmt.Errorf("could not get vprice %w", err))
span.AddEvent("could not get vprice stats")

Check warning on line 165 in contrib/promexporter/exporters/exporter.go

View check run for this annotation

Codecov / codecov/patch

contrib/promexporter/exporters/exporter.go#L164-L165

Added lines #L164 - L165 were not covered by tests
}

return nil
Expand All @@ -172,7 +173,7 @@

if len(errs) > 0 {
span.AddEvent("could not collect metrics")
return fmt.Errorf("could not collect metrics: %v", errs)
return fmt.Errorf("could not collect metrics: %w", combineErrors(errs))

Check warning on line 176 in contrib/promexporter/exporters/exporter.go

View check run for this annotation

Codecov / codecov/patch

contrib/promexporter/exporters/exporter.go#L176

Added line #L176 was not covered by tests
}

return nil
Expand Down
Loading