(t *testing.T)
| 1659 | } |
| 1660 | |
| 1661 | func TestSamplingError(t *testing.T) { |
| 1662 | // Comment this out to run tests when developing. |
| 1663 | t.Skip("Skipping sampling error test") |
| 1664 | |
| 1665 | testQueries := []string{ |
| 1666 | "{} | rate()", // Simple rate, most amount of data |
| 1667 | "{} | rate() by (resource.service.name)", // Same but with subseries |
| 1668 | "{status=error} | rate()", // Somewhat rare |
| 1669 | "{resource.service.name=`loki-querier` && name=`chunksmemcache.store`} | rate()", // Very rare |
| 1670 | "{nestedSetParent=-1} >> {}| rate()", // Structural (common) |
| 1671 | "{nestedSetParent=-1} >> {status=error} | rate()", // Structural (rare) |
| 1672 | "{} | quantile_over_time(duration, .99)", // Quantile (common) |
| 1673 | "{resource.service.name=`tempo-gateway`} | quantile_over_time(duration, .99)", // Quantile (rare) |
| 1674 | |
| 1675 | // Drilldown queries |
| 1676 | /*"{nestedSetParent<0 && true && status=error} | rate()", |
| 1677 | "{nestedSetParent<0 && true && resource.service.name != nil} | rate() by(resource.service.name)", |
| 1678 | "{nestedSetParent<0 && true} | histogram_over_time(duration)", |
| 1679 | `{nestedSetParent<0 && resource.service.name="gme-alertmanager" && resource.service.namespace != nil} | rate() by(resource.service.namespace)`, |
| 1680 | "{true && true && resource.service.name != nil} | rate() by(resource.service.name)",*/ |
| 1681 | } |
| 1682 | |
| 1683 | options := []string{ |
| 1684 | "", // Control, no sampling |
| 1685 | "sample=true", // Automatic sampling |
| 1686 | "sample=0.01", // Aggressive sampling. Automatic should be better accuracy. |
| 1687 | "sample=0.1", // Decent sampling. Automatic should be roughly equal. |
| 1688 | "sample=0.5", // Lowest amount of sampling possible as whole fraction. Automatic should be better performance. |
| 1689 | } |
| 1690 | |
| 1691 | e := traceql.NewEngine() |
| 1692 | ctx := context.TODO() |
| 1693 | opts := common.DefaultSearchOptions() |
| 1694 | opts.TotalPages = 1 |
| 1695 | |
| 1696 | block := blockForBenchmarks(t) |
| 1697 | _, _, err := block.openForSearch(ctx, opts) |
| 1698 | require.NoError(t, err) |
| 1699 | |
| 1700 | f := traceql.NewSpansetFetcherWrapper(func(ctx context.Context, req traceql.FetchSpansRequest) (traceql.FetchSpansResponse, error) { |
| 1701 | return block.Fetch(ctx, req, opts) |
| 1702 | }) |
| 1703 | |
| 1704 | executeQuery := func(t *testing.T, q string) (results traceql.SeriesSet, spanCount int) { |
| 1705 | st := uint64(block.meta.StartTime.UnixNano()) |
| 1706 | end := uint64(block.meta.EndTime.UnixNano()) |
| 1707 | |
| 1708 | req := &tempopb.QueryRangeRequest{ |
| 1709 | Query: q, |
| 1710 | Start: st, |
| 1711 | End: end, |
| 1712 | Step: uint64(time.Second * 15), |
| 1713 | MaxSeries: 1000, |
| 1714 | Exemplars: 2, |
| 1715 | } |
| 1716 | |
| 1717 | eval, err := e.CompileMetricsQueryRange(req) |
| 1718 | require.NoError(t, err) |
nothing calls this directly
no test coverage detected