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

add tests for Prometheus agent #22

Merged
merged 5 commits into from
Oct 18, 2021
Merged

add tests for Prometheus agent #22

merged 5 commits into from
Oct 18, 2021

Conversation

spaparaju
Copy link

This PR adds tests for Prometheus agent

Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good, just small nits here and there

cmd/prometheus/prometheus_agent_main_test.go Outdated Show resolved Hide resolved
cmd/prometheus/prometheus_agent_main_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
@spaparaju
Copy link
Author

@rfratto updated the CopyRight across the board.

Copy link
Member

@codesome codesome left a comment

Choose a reason for hiding this comment

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

Thanks, good start. I have left a bunch of comments.

We should not change the year of existing in the license notice, we should be making it 2021 in new files that this PR adds. Can you please revert the year changes for the existing files?

We also need to test a few more things:

  1. Working of checkpointing and replays with that.
  2. Rollbacks

In the main PR I have left comments about handling duplicate series records, once that is fixed, we will need to add tests cases for that too (which can be done post this PR)

cmd/prometheus/prometheus_main_test.go Outdated Show resolved Hide resolved
cmd/prometheus/prometheus_agent_main_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
tsdb/agent/storage_test.go Outdated Show resolved Hide resolved
web/prometheus_agent_web_test.go Outdated Show resolved Hide resolved
web/prometheus_agent_web_test.go Outdated Show resolved Hide resolved
web/prometheus_agent_web_test.go Outdated Show resolved Hide resolved
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

Thank you! Further review can be done upstream.

@rfratto rfratto merged commit e6d5ea4 into grafana:agent Oct 18, 2021
rfratto pushed a commit that referenced this pull request Oct 18, 2021
* add tests for Prometheus agent

* add tests for Prometheus agent

* rearranged tests as per the review comments

* update tests for Agent

* changes as per code review comments

Signed-off-by: SriKrishna Paparaju <paparaju@gmail.com>
rfratto pushed a commit that referenced this pull request Oct 28, 2021
* add tests for Prometheus agent

* add tests for Prometheus agent

* rearranged tests as per the review comments

* update tests for Agent

* changes as per code review comments

Signed-off-by: SriKrishna Paparaju <paparaju@gmail.com>
rfratto added a commit that referenced this pull request Feb 3, 2022
* Initial draft of prometheus-agent

This commit introduces a new binary, prometheus-agent, based on the
Grafana Agent code. It runs a WAL-only version of prometheus without the
TSDB, alerting, or rule evaluations. It is intended to be used to
remote_write to Prometheus or another remote_write receiver.

By default, prometheus-agent will listen on port 9095 to not collide
with the prometheus default of 9090.

Truncation of the WAL cooperates on a best-effort case with Remote
Write. Every time the WAL is truncated, the minimum timestamp of data to
truncate is determined by the lowest sent timestamp of all samples
across all remote_write endpoints. This gives loose guarantees that data
from the WAL will not try to be removed until the maximum sample
lifetime passes or remote_write starts functionining.

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* add tests for Prometheus agent (#22)

* add tests for Prometheus agent

* add tests for Prometheus agent

* rearranged tests as per the review comments

* update tests for Agent

* changes as per code review comments

Signed-off-by: SriKrishna Paparaju <paparaju@gmail.com>

* incremental changes to prometheus agent

Signed-off-by: SriKrishna Paparaju <paparaju@gmail.com>

* changes as per code review comments

Signed-off-by: SriKrishna Paparaju <paparaju@gmail.com>

* Commit feedback from code review

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* Port over some comments from grafana/agent

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* Rename agent.Storage to agent.DB for tsdb consistency

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* Consolidate agentMode ifs in cmd/prometheus/main.go

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* Document PreAction usage requirements better for agent mode flags

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* remove unnecessary defaultListenAddr

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* `go fmt ./tsdb/agent` and fix lint errors

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

Co-authored-by: SriKrishna Paparaju <paparaju@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants