(t *testing.T)
| 394 | } |
| 395 | |
| 396 | func TestExemplar(t *testing.T) { |
| 397 | s, err := e2e.NewScenario(networkName) |
| 398 | require.NoError(t, err) |
| 399 | defer s.Close() |
| 400 | |
| 401 | // Start dependencies. |
| 402 | consul := e2edb.NewConsulWithName("consul") |
| 403 | require.NoError(t, s.StartAndWaitReady(consul)) |
| 404 | |
| 405 | flags := mergeFlags( |
| 406 | AlertmanagerLocalFlags(), |
| 407 | map[string]string{ |
| 408 | "-store.engine": blocksStorageEngine, |
| 409 | "-blocks-storage.backend": "filesystem", |
| 410 | "-blocks-storage.tsdb.head-compaction-interval": "4m", |
| 411 | "-blocks-storage.bucket-store.sync-interval": "15m", |
| 412 | "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory, |
| 413 | "-blocks-storage.bucket-store.bucket-index.enabled": "true", |
| 414 | "-blocks-storage.tsdb.ship-interval": "1s", |
| 415 | "-blocks-storage.tsdb.enable-native-histograms": "true", |
| 416 | // Ingester. |
| 417 | "-ring.store": "consul", |
| 418 | "-consul.hostname": consul.NetworkHTTPEndpoint(), |
| 419 | "-ingester.max-exemplars": "100", |
| 420 | // Distributor. |
| 421 | "-distributor.replication-factor": "1", |
| 422 | "-distributor.remote-writev2-enabled": "true", |
| 423 | // Store-gateway. |
| 424 | "-store-gateway.sharding-enabled": "false", |
| 425 | // alert manager |
| 426 | "-alertmanager.web.external-url": "http://localhost/alertmanager", |
| 427 | }, |
| 428 | ) |
| 429 | |
| 430 | // make alert manager config dir |
| 431 | require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{})) |
| 432 | |
| 433 | path := path.Join(s.SharedDir(), "cortex-1") |
| 434 | |
| 435 | flags = mergeFlags(flags, map[string]string{"-blocks-storage.filesystem.dir": path}) |
| 436 | // Start Cortex replicas. |
| 437 | cortex := e2ecortex.NewSingleBinary("cortex", flags, "") |
| 438 | require.NoError(t, s.StartAndWaitReady(cortex)) |
| 439 | |
| 440 | // Wait until Cortex replicas have updated the ring state. |
| 441 | require.NoError(t, cortex.WaitSumMetrics(e2e.Equals(float64(512)), "cortex_ring_tokens_total")) |
| 442 | |
| 443 | c, err := e2ecortex.NewClient(cortex.HTTPEndpoint(), cortex.HTTPEndpoint(), "", "", "user-1") |
| 444 | require.NoError(t, err) |
| 445 | |
| 446 | now := time.Now() |
| 447 | tsMillis := e2e.TimeToMilliseconds(now) |
| 448 | |
| 449 | symbols := []string{"", "__name__", "test_metric", "b", "c", "baz", "qux", "d", "e", "foo", "bar", "f", "g", "h", "i", "Test gauge for test purposes", "Maybe op/sec who knows (:", "Test counter for test purposes"} |
| 450 | timeseries := []writev2.TimeSeries{ |
| 451 | { |
| 452 | LabelsRefs: []uint32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, // Symbolized writeRequestFixture.Timeseries[0].Labels |
| 453 | Metadata: writev2.Metadata{ |
nothing calls this directly
no test coverage detected