(t *testing.T)
| 1904 | } |
| 1905 | |
| 1906 | func TestSamplingError(t *testing.T) { |
| 1907 | // Comment this out to run tests when developing. |
| 1908 | t.Skip("Skipping sampling error test") |
| 1909 | |
| 1910 | testQueries := []string{ |
| 1911 | "{} | rate()", // Simple rate, most amount of data |
| 1912 | "{} | rate() by (resource.service.name)", // Same but with subseries |
| 1913 | "{status=error} | rate()", // Somewhat rare |
| 1914 | "{resource.service.name=`loki-querier` && name=`chunksmemcache.store`} | rate()", // Very rare |
| 1915 | "{nestedSetParent=-1} >> {}| rate()", // Structural (common) |
| 1916 | "{nestedSetParent=-1} >> {status=error} | rate()", // Structural (rare) |
| 1917 | "{} | quantile_over_time(duration, .99)", // Quantile (common) |
| 1918 | "{resource.service.name=`tempo-gateway`} | quantile_over_time(duration, .99)", // Quantile (rare) |
| 1919 | |
| 1920 | // Drilldown queries |
| 1921 | /*"{nestedSetParent<0 && true && status=error} | rate()", |
| 1922 | "{nestedSetParent<0 && true && resource.service.name != nil} | rate() by(resource.service.name)", |
| 1923 | "{nestedSetParent<0 && true} | histogram_over_time(duration)", |
| 1924 | `{nestedSetParent<0 && resource.service.name="gme-alertmanager" && resource.service.namespace != nil} | rate() by(resource.service.namespace)`, |
| 1925 | "{true && true && resource.service.name != nil} | rate() by(resource.service.name)",*/ |
| 1926 | } |
| 1927 | |
| 1928 | options := []string{ |
| 1929 | "", // Control, no sampling |
| 1930 | "sample=true", // Automatic sampling |
| 1931 | "sample=0.01", // Aggressive sampling. Automatic should be better accuracy. |
| 1932 | "sample=0.1", // Decent sampling. Automatic should be roughly equal. |
| 1933 | "sample=0.5", // Lowest amount of sampling possible as whole fraction. Automatic should be better performance. |
| 1934 | } |
| 1935 | |
| 1936 | e := traceql.NewEngine() |
| 1937 | ctx := context.TODO() |
| 1938 | opts := common.DefaultSearchOptions() |
| 1939 | opts.TotalPages = 1 |
| 1940 | |
| 1941 | block := blockForBenchmarks(t) |
| 1942 | _, _, err := block.openForSearch(ctx, opts) |
| 1943 | require.NoError(t, err) |
| 1944 | |
| 1945 | f := traceql.NewSpansetFetcherWrapperBoth( |
| 1946 | func(ctx context.Context, req traceql.FetchSpansRequest) (traceql.FetchSpansResponse, error) { |
| 1947 | return block.Fetch(ctx, req, opts) |
| 1948 | }, |
| 1949 | func(ctx context.Context, req traceql.FetchSpansRequest) (traceql.FetchSpansOnlyResponse, error) { |
| 1950 | return block.FetchSpans(ctx, req, opts) |
| 1951 | }, |
| 1952 | ) |
| 1953 | |
| 1954 | executeQuery := func(t *testing.T, q string) (results traceql.SeriesSet, spanCount int) { |
| 1955 | st := uint64(block.meta.StartTime.UnixNano()) |
| 1956 | end := uint64(block.meta.EndTime.UnixNano()) |
| 1957 | |
| 1958 | req := &tempopb.QueryRangeRequest{ |
| 1959 | Query: q, |
| 1960 | Start: st, |
| 1961 | End: end, |
| 1962 | Step: uint64(time.Second * 15), |
| 1963 | MaxSeries: 1000, |
nothing calls this directly
no test coverage detected