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

prom-wrapper: remove direct Prometheus access, remove alerts endpoints#46299

Merged
bobheadxi merged 6 commits into
mainfrom
01-10-prom-wrapper_remove_direct_Prometheus_access_remove_alerts_endpoints
Jan 11, 2023
Merged

prom-wrapper: remove direct Prometheus access, remove alerts endpoints#46299
bobheadxi merged 6 commits into
mainfrom
01-10-prom-wrapper_remove_direct_Prometheus_access_remove_alerts_endpoints

Conversation

@bobheadxi

@bobheadxi bobheadxi commented Jan 10, 2023

Copy link
Copy Markdown
Member

This removes the one instance of Sourcegraph being able to directly query Prometheus. Likely not something we should have done in the first place, and will make it easier for Cloud the potentially run a completely-managed Prometheus. We retain some APIs for the embedded Alertmanager instance for configuration validation and the like - Alertmanager has a smaller surface area, and future alert summary queries should use the Alertmanager API instead.

The GraphQL endpoints have been marked as deprecated and no longer return any data. In the future, we could replace with this the endpoints that talk to Alertmanager to get alerts summaries - the Alertmanager API is a smaller surface area and we likely want to continue to self-host Alertmanager in the future for the ability to better configure alerting.

This endpoint is rarely used - the only two usages I could find are:

  1. report-bug page (awareness of this is very low, and the data is noisy - the integration has been removed in this PR)
  2. instancehealth in src-cli - this is a non-critical, experimental integration and we can replace it with manual checks and/or a new API as described above

Test plan

Test pass, sg start works

@cla-bot cla-bot Bot added the cla-signed label Jan 10, 2023
@bobheadxi

Copy link
Copy Markdown
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

Base automatically changed from prom-wrapper-lib-log to main January 10, 2023 23:14
@bobheadxi bobheadxi requested a review from danieldides January 10, 2023 23:16
@bobheadxi bobheadxi force-pushed the 01-10-prom-wrapper_remove_direct_Prometheus_access_remove_alerts_endpoints branch from b57a979 to 0560e17 Compare January 10, 2023 23:16
Comment on lines -82 to -90
// prometheus client
promClient, err := prometheusAPI.NewClient(prometheusAPI.Config{
Address: fmt.Sprintf("http://127.0.0.1:%s", prometheusPort),
})
if err != nil {
logger.Fatal("failed to initialize prometheus client",
log.Error(err))
}

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.

The key result - we no longer need to talk to Prometheus directly.

@bobheadxi bobheadxi requested a review from michaellzc January 10, 2023 23:18
@sg-e2e-regression-test-bob

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) -0.01% (-0.80 kb) -0.01% (-0.80 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits a16abf7 and 18911c0 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@bobheadxi bobheadxi merged commit 656a7bc into main Jan 11, 2023
@bobheadxi bobheadxi deleted the 01-10-prom-wrapper_remove_direct_Prometheus_access_remove_alerts_endpoints branch January 11, 2023 20:15
bobheadxi referenced this pull request in sourcegraph/src-cli Jan 12, 2023
scjohns referenced this pull request in sourcegraph/src-cli Apr 24, 2023
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