This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add alert to notify about duplicate sample/metric ingestion
This commit does the following, 1. Merge duplicate reporter into throughput reporter 2. Add alert about duplicate sample/metric ingestion 3. Add an e2e test to verify metrics related to duplicates are populated Signed-off-by: Arunprasad Rajkumar <[email protected]>
- Loading branch information
Showing
6 changed files
with
87 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# PromscaleIngestHighDataDuplication | ||
|
||
## Meaning | ||
|
||
Client payload has either duplicates or retrying many a time for the data which has been already ingested. | ||
|
||
|
||
## Impact | ||
|
||
Ingestion performance will be poor | ||
|
||
|
||
## Diagnosis | ||
1. If Prometheus is running in HA mode, go to [Prometheus high availability](#prometheus-high-availability) | ||
|
||
## Mitigation | ||
|
||
### Prometheus high availability | ||
1. Follow the guideline on [running Prometheus in HA mode](https://docs.timescale.com/promscale/latest/scale-ha/high-availability/#promscale-and-prometheus-high-availability). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
pkg/tests/end_to_end_tests/metrics_duplicate_insert_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package end_to_end_tests | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/jackc/pgx/v4/pgxpool" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/testutil" | ||
"github.com/stretchr/testify/require" | ||
ingstr "github.com/timescale/promscale/pkg/pgmodel/ingestor" | ||
"github.com/timescale/promscale/pkg/pgmodel/metrics" | ||
"github.com/timescale/promscale/pkg/pgxconn" | ||
) | ||
|
||
func TestMetricsDuplicateInsert(t *testing.T) { | ||
ctx := context.Background() | ||
ts := generateSmallTimeseries() | ||
withDB(t, *testDatabase, func(db *pgxpool.Pool, t testing.TB) { | ||
ingestor, err := ingstr.NewPgxIngestorForTests(pgxconn.NewPgxConn(db), nil) | ||
require.NoError(t, err) | ||
defer ingestor.Close() | ||
_, _, err = ingestor.IngestMetrics(ctx, newWriteRequestWithTs(copyMetrics(ts))) | ||
require.NoError(t, err) | ||
require.Zero(t, testutil.ToFloat64(metrics.IngestorDuplicates.With(prometheus.Labels{"type": "metric", "kind": "sample"})), "must be zero when no duplicates are ingested") | ||
_, _, err = ingestor.IngestMetrics(ctx, newWriteRequestWithTs(copyMetrics(ts))) | ||
require.NoError(t, err) | ||
require.Greater(t, testutil.ToFloat64(metrics.IngestorDuplicates.With(prometheus.Labels{"type": "metric", "kind": "sample"})), 0.0, "duplicates insert must have occurred") | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters