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

Function frontendWithSettings

modules/frontend/search_handlers_test.go:809–912  ·  modules/frontend/search_handlers_test.go::frontendWithSettings

frontendWithSettings returns a new frontend with the given settings. any nil options are given "happy path" defaults

(t require.TestingT, next pipeline.RoundTripper, rdr tempodb.Reader, cfg *Config, cacheProvider cache.Provider,
	opts ...func(*Config, *overrides.Config),
)

Source from the content-addressed store, hash-verified

807// frontendWithSettings returns a new frontend with the given settings. any nil options
808// are given "happy path" defaults
809func frontendWithSettings(t require.TestingT, next pipeline.RoundTripper, rdr tempodb.Reader, cfg *Config, cacheProvider cache.Provider,
810 opts ...func(*Config, *overrides.Config),
811) *QueryFrontend {
812 if next == nil {
813 next = &mockRoundTripper{
814 responseFn: func() proto.Message {
815 return &tempopb.SearchResponse{
816 Traces: []*tempopb.TraceSearchMetadata{
817 {
818 TraceID: "1",
819 StartTimeUnixNano: math.MaxUint64, // forces GRPCDiff in the search combiner to return this trace b/c it's always after CompletedThroughSeconds
820 },
821 },
822 Metrics: &tempopb.SearchMetrics{
823 InspectedTraces: 1,
824 InspectedBytes: 1,
825 },
826 }
827 },
828 }
829 }
830 if rdr == nil {
831 rdr = &mockReader{
832 metas: []*backend.BlockMeta{ // one block with 2 records that are each the target bytes per request will force 2 sub queries
833 {
834 StartTime: time.Unix(1100, 0),
835 EndTime: time.Unix(1200, 0),
836 Size_: defaultTargetBytesPerRequest * 2,
837 TotalRecords: 2,
838 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000000"),
839 },
840 {
841 StartTime: time.Unix(1100, 0),
842 EndTime: time.Unix(1200, 0),
843 Size_: defaultTargetBytesPerRequest * 2,
844 TotalRecords: 2,
845 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000001"),
846 },
847 // These are RF1 metrics blocks
848 {
849 StartTime: time.Unix(1100, 0),
850 EndTime: time.Unix(1200, 0),
851 Size_: defaultTargetBytesPerRequest * 2,
852 TotalRecords: 2,
853 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000002"),
854 ReplicationFactor: 1,
855 },
856 {
857 StartTime: time.Unix(1100, 0),
858 EndTime: time.Unix(1200, 0),
859 Size_: defaultTargetBytesPerRequest * 2,
860 TotalRecords: 2,
861 BlockID: backend.MustParse("00000000-0000-0000-0000-000000000003"),
862 ReplicationFactor: 1,
863 },
864 },
865 }
866 }

Calls 4

MustParseFunction · 0.92
NewOverridesFunction · 0.92
oFunction · 0.85
NewFunction · 0.70

Tested by

no test coverage detected