MCPcopy
hub / github.com/grafana/tempo / traceQLDuration

Function traceQLDuration

tempodb/tempodb_search_test.go:1680–1806  ·  view source on GitHub ↗
(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, searchesThatMatch, searchesThatDontMatch []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock)

Source from the content-addressed store, hash-verified

1678}
1679
1680func traceQLDuration(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, searchesThatMatch, searchesThatDontMatch []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock) {
1681 ctx := context.Background()
1682 e := traceql.NewEngine()
1683
1684 // We've got two `span:duration`: 1000000000ns && 2000000000ns
1685 // We've got one `trace:duration`: 2000000000ns
1686
1687 quotedAttributesThatMatch := []*tempopb.SearchRequest{
1688 {Query: `{ span:duration >= 999999999 && span:duration <= 1000000001 }`},
1689 {Query: `{ span:duration > 999999999 && span:duration < 1000000001 }`},
1690 {Query: `{ span:duration >= 1000000000 && span:duration <= 1000000000 }`},
1691 {Query: `{ span:duration = 1000000000 }`},
1692
1693 {Query: `{ span:duration >= 999999999.9 && span:duration <= 1000000000.1 }`},
1694 {Query: `{ span:duration > 999999999.9 && span:duration < 1000000000.1 }`},
1695 {Query: `{ span:duration >= 1000000000.0 && span:duration <= 1000000000.0 }`},
1696 {Query: `{ span:duration = 1000000000.0 }`},
1697
1698 {Query: `{ span:duration >= 2999999999ns / 3 && span:duration <= 3000000001ns / 3 }`},
1699 {Query: `{ span:duration > 2999999999ns / 3 && span:duration < 3000000001ns / 3 }`},
1700 {Query: `{ span:duration >= 3000000000ns / 3 && span:duration <= 3000000000ns / 3 }`},
1701 {Query: `{ span:duration = 3000000000ns / 3 }`},
1702
1703 {Query: `{ span:duration >= 4999999999 * .2 && span:duration <= 5000000001 * .2 }`},
1704 {Query: `{ span:duration > 4999999999 * .2 && span:duration < 5000000001 * .2 }`},
1705 {Query: `{ span:duration >= 5000000000 * .2 && span:duration <= 5000000000 * .2 }`},
1706 {Query: `{ span:duration = 5000000000 * .2 }`},
1707
1708 {Query: `{ span:duration >= 3333333333ns * .3 && span:duration <= 3333333334ns * .3 }`},
1709 {Query: `{ span:duration > 3333333333ns * .3 && span:duration < 3333333334ns * .3 }`},
1710 {Query: `{ span:duration >= 5000000000ns * .2 && span:duration <= 5000000000ns * .2 }`},
1711 {Query: `{ span:duration = 5000000000ns * .2 }`},
1712
1713 {Query: `{ span:duration >= 333333333ns * 3 && span:duration <= 333333334ns * 3 }`},
1714 {Query: `{ span:duration > 333333333ns * 3 && span:duration < 333333334ns * 3 }`},
1715 {Query: `{ span:duration >= 500000000 * 2 && span:duration <= 500000000 * 2 }`},
1716 {Query: `{ span:duration = 500000000 * 2 }`},
1717
1718 {Query: `{ trace:duration >= 1999999999 && trace:duration <= 2000000001 }`},
1719 {Query: `{ trace:duration > 1999999999 && trace:duration < 2000000001 }`},
1720 {Query: `{ trace:duration >= 2000000000 && trace:duration <= 2000000000 }`},
1721 {Query: `{ trace:duration = 2000000000 }`},
1722
1723 {Query: `{ trace:duration >= 1999999999.9 && trace:duration <= 2000000000.1 }`},
1724 {Query: `{ trace:duration > 1999999999.9 && trace:duration < 2000000000.1 }`},
1725 {Query: `{ trace:duration >= 2000000000.0 && trace:duration <= 2000000000.0 }`},
1726 {Query: `{ trace:duration = 2000000000.0 }`},
1727
1728 {Query: `{ trace:duration >= 5999999999ns / 3 && trace:duration <= 6000000001ns / 3 }`},
1729 {Query: `{ trace:duration > 5999999999ns / 3 && trace:duration < 6000000001ns / 3 }`},
1730 {Query: `{ trace:duration >= 6000000000ns / 3 && trace:duration <= 6000000000ns / 3 }`},
1731 {Query: `{ trace:duration = 6000000000ns / 3 }`},
1732
1733 {Query: `{ trace:duration >= 9999999999 * .2 && trace:duration <= 10000000001 * .2 }`},
1734 {Query: `{ trace:duration > 9999999999 * .2 && trace:duration < 10000000001 * .2 }`},
1735 {Query: `{ trace:duration >= 10000000000 * .2 && trace:duration <= 10000000000 * .2 }`},
1736 {Query: `{ trace:duration = 10000000000 * .2 }`},
1737

Callers

nothing calls this directly

Calls 7

ExecuteSearchMethod · 0.95
NewEngineFunction · 0.92
NewSpansetFetcherWrapperFunction · 0.92
DefaultSearchOptionsFunction · 0.92
actualForExpectedMetaFunction · 0.85
FetchMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected