Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

chore/deps: upgrade alertmanager package dependency, improve logs and tests#63329

Merged
bobheadxi merged 9 commits into
mainfrom
06-18-chore-upgrade-alertmanager
Jun 19, 2024
Merged

chore/deps: upgrade alertmanager package dependency, improve logs and tests#63329
bobheadxi merged 9 commits into
mainfrom
06-18-chore-upgrade-alertmanager

Conversation

@bobheadxi

@bobheadxi bobheadxi commented Jun 19, 2024

Copy link
Copy Markdown
Member

Upgrades to our forked update v0.27.0, which matches the Alertmanager version we deploy: sourcegraph/alertmanager@3695ef8. Upon closer inspection I also realized I upgraded prometheus/common too far in https://github.com/sourcegraph/sourcegraph/pull/63328 - I've downgraded it to match the revision of Alertmanager we are using, while also fulfilling the OpenFGA dependency https://github.com/sourcegraph/sourcegraph/pull/63329#discussion_r1646630946 for https://github.com/sourcegraph/sourcegraph/pull/63173 💀

The latest version of prometheus/common marshals configuration values that are unknown to our version of Alertmanager (v0.27.0) which rejects the generated configuration from prom-wrapper.

I've also made a few updates to improve the testing and improve the prometheus and alertmanager output by forwarding them to differently-scoped loggers and crude conversion of the log levels:

image

Related: https://github.com/sourcegraph/sourcegraph/pull/63171
Closes CORE-186

Test plan

sg start and sg run prometheus, update some alerting configs in http://localhost:9090/alertmanager/#/status:

In personal settings:

{
  "alerts.hideObservabilitySiteAlerts": false
}

No banners show up indicating Prometheus is unhealthy.

@cla-bot cla-bot Bot added the cla-signed label Jun 19, 2024

bobheadxi commented Jun 19, 2024

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @bobheadxi and the rest of your teammates on Graphite Graphite

Base automatically changed from chore-upgrade-alertmanager-prometheus-grpc to main June 19, 2024 13:55
@bobheadxi bobheadxi force-pushed the 06-18-chore-upgrade-alertmanager branch from 518dc61 to eecafbe Compare June 19, 2024 17:10
@bobheadxi bobheadxi force-pushed the 06-18-chore-upgrade-alertmanager branch from 1769a4f to 5d0d414 Compare June 19, 2024 18:34
@bobheadxi bobheadxi marked this pull request as ready for review June 19, 2024 18:35
@bobheadxi bobheadxi requested review from a team June 19, 2024 18:35
@bobheadxi bobheadxi changed the title chore/deps: upgrade alertmanager package depedency chore/deps: upgrade alertmanager package dependency, improve logs and tests Jun 19, 2024
@bobheadxi bobheadxi requested a review from unknwon June 19, 2024 18:35
}
var buf bytes.Buffer
enc := expfmt.NewEncoder(&buf, expfmt.NewFormat(expfmt.TypeTextPlain))
enc := expfmt.NewEncoder(&buf, expfmt.FmtText)

@unknwon unknwon Jun 19, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert common version to continue using expfmt.FmtText would unsatisfy OpenFGA's requirement of common 💀

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded to the version declared by OpenFGA, v0.48.0 https://github.com/openfga/openfga/blob/77c666d5063c51216f7ffc0b6cc8a0e62957b241/go.mod#L106 - thankfully looks like this is still compatible, running some tests...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I think this is good to go

@github-actions

Copy link
Copy Markdown
Contributor

Caution

License checking failed, please read: how to deal with third parties licensing.

@bobheadxi bobheadxi merged commit d2d4491 into main Jun 19, 2024
@bobheadxi bobheadxi deleted the 06-18-chore-upgrade-alertmanager branch June 19, 2024 20:46
bobheadxi referenced this pull request Jul 11, 2024
…#63790)

The OTEL upgrade https://github.com/sourcegraph/sourcegraph/pull/63171
bumps the `prometheus/common` package too far via transitive deps,
causing us to generate configuration for alertmanager that altertmanager
doesn't accept, at least until the alertmanager project cuts a new
release with a newer version of `promethues/common`.

For now we forcibly downgrade with a replace. Everything still builds,
so we should be good to go.

## Test plan
`sg start` and `sg run prometheus`. On `main`, editing
`observability.alerts` will cause Alertmanager to refuse to accept the
generated configuration. With this patch, all is well it seems - config
changes go through as expected. This is a similar test plan for
https://github.com/sourcegraph/sourcegraph/pull/63329

## Changelog

- Fix Prometheus Alertmanager configuration failing to apply
`observability.alerts` from site config
sourcegraph-release-bot referenced this pull request Jul 11, 2024
…#63790)

The OTEL upgrade https://github.com/sourcegraph/sourcegraph/pull/63171
bumps the `prometheus/common` package too far via transitive deps,
causing us to generate configuration for alertmanager that altertmanager
doesn't accept, at least until the alertmanager project cuts a new
release with a newer version of `promethues/common`.

For now we forcibly downgrade with a replace. Everything still builds,
so we should be good to go.

## Test plan
`sg start` and `sg run prometheus`. On `main`, editing
`observability.alerts` will cause Alertmanager to refuse to accept the
generated configuration. With this patch, all is well it seems - config
changes go through as expected. This is a similar test plan for
https://github.com/sourcegraph/sourcegraph/pull/63329

## Changelog

- Fix Prometheus Alertmanager configuration failing to apply
`observability.alerts` from site config

(cherry picked from commit ffa873f)
jdpleiness referenced this pull request Jul 11, 2024
… generated config (#63793)

The OTEL upgrade https://github.com/sourcegraph/sourcegraph/pull/63171
bumps the `prometheus/common` package too far via transitive deps,
causing us to generate configuration for alertmanager that altertmanager
doesn't accept, at least until the alertmanager project cuts a new
release with a newer version of `promethues/common`.

For now we forcibly downgrade with a replace. Everything still builds,
so we should be good to go.

## Test plan
`sg start` and `sg run prometheus`. On `main`, editing
`observability.alerts` will cause Alertmanager to refuse to accept the
generated configuration. With this patch, all is well it seems - config
changes go through as expected. This is a similar test plan for
https://github.com/sourcegraph/sourcegraph/pull/63329

## Changelog

- Fix Prometheus Alertmanager configuration failing to apply
`observability.alerts` from site config <br> Backport
ffa873f from #63790

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants