Documentation
¶
Index ¶
- func DataObject(t *testing.T, sections ...dataobj.SectionBuilder) (*dataobj.Object, io.Closer)
- func LogsSection(t *testing.T, tenant string, rows []logs.Record, opts ...LogSectionOpt) dataobj.SectionBuilder
- func ReadTenantLogSection(t *testing.T, obj *dataobj.Object, tenant string, sectionIndex int) []logs.Record
- func ReadTenantLogs(t *testing.T, obj *dataobj.Object, tenant string) []logs.Record
- func ReadTenantStreams(t *testing.T, obj *dataobj.Object, tenant string) []streams.Stream
- func StoredDataObject(t *testing.T, bucket objstore.Bucket, sections ...dataobj.SectionBuilder) string
- func StreamsSection(t *testing.T, tenant string, labelSets []streams.Stream, ...) dataobj.SectionBuilder
- type LogFixtureBuilder
- type LogFixtureOpt
- type LogSectionOpt
- type StreamFixture
- type StreamsSectionOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataObject ¶
DataObject returns a dataobj.Object populated with the given sections.
func LogsSection ¶
func LogsSection(t *testing.T, tenant string, rows []logs.Record, opts ...LogSectionOpt) dataobj.SectionBuilder
LogsSection returns a logs.Builder populated with the given rows and assigned the specified tenant Additional opts control the construction of the Logs section. If no Opts are provided, suitable defaults are used. The default log ordering is SortStreamASC (StreamID ASC, Timestamp DESC)
func ReadTenantLogSection ¶
func ReadTenantLogSection(t *testing.T, obj *dataobj.Object, tenant string, sectionIndex int) []logs.Record
ReadTenantLogSection reads one logs-relative section in physical row order. The index counts every logs section in the object, including other tenants'. Returned records are independent of the iterator's reused buffers.
func ReadTenantLogs ¶
ReadTenantLogs reads the tenant's records across all logs sections in object order, preserving their physical read order. Records are copied because the logs iterator reuses its buffers.
func ReadTenantStreams ¶
ReadTenantStreams reads the tenant's streams across all streams sections in object order. Returned labels are copied so the streams remain valid after the iterator advances.
func StoredDataObject ¶
func StoredDataObject(t *testing.T, bucket objstore.Bucket, sections ...dataobj.SectionBuilder) string
StoredDataObject builds a data object from the given sections, writes it to bucket, and returns the path it was written to.
func StreamsSection ¶
func StreamsSection(t *testing.T, tenant string, labelSets []streams.Stream, opts ...StreamsSectionOpt) dataobj.SectionBuilder
StreamsSection returns a streams builder for tenant that holds labelSets. The section records a layout; see WithStreamsLayout and WithoutStreamsLayout.
Types ¶
type LogFixtureBuilder ¶
type LogFixtureBuilder struct {
// contains filtered or unexported fields
}
LogFixtureBuilder builds matching stream and log records for section fixtures. IDs are assigned in first-seen stream order; log records retain insertion order. Sort keys are computed while building each record; they are used to define order but are not persisted.
func NewLogsFixtureBuilder ¶
func NewLogsFixtureBuilder(t *testing.T, opts ...LogFixtureOpt) *LogFixtureBuilder
NewLogsFixtureBuilder returns a fluid builder for creating matching sets of Streams and Log Records, with StreamIDs assigned automatically. IDs are assigned in first-seen stream order and log records are returned in insertion order.
Callers may use either the ForStream(labelString).Entry(ts, md, msg) syntax or the more verbose Entry(stream, ts, md, msg) syntax. Use WithSchemaLabels to choose the schema key used while building records. The shard bucket comes from the stable hash of the stream labels; see WithLayout.
func (*LogFixtureBuilder) Entry ¶
func (b *LogFixtureBuilder) Entry(stream labels.Labels, tsSeconds int, structuredMetadata string, logMessage string)
Entry adds a single log message to the dataset with the provided stream, timestamp, and structured metadata.
func (*LogFixtureBuilder) ForStream ¶
func (b *LogFixtureBuilder) ForStream(labels string) *StreamFixture
ForStream returns a pre-parsed helper which enables easier addition of log messages for the same stream
func (*LogFixtureBuilder) Logs ¶
func (b *LogFixtureBuilder) Logs() []logs.Record
Logs returns the raw logs.Records held by this builder. They can be passed directly to LogsSection to build a dataobject section.
func (*LogFixtureBuilder) Streams ¶
func (b *LogFixtureBuilder) Streams() []streams.Stream
Streams returns the raw streams.Streams held by this builder. They can be passed directly to StreamsSection to build a dataobject section.
type LogFixtureOpt ¶
type LogFixtureOpt func(*LogFixtureBuilder)
LogFixtureOpt customizes a LogFixtureBuilder.
func WithLayout ¶
func WithLayout(layout streams.Layout) LogFixtureOpt
WithLayout computes the schema sort key and the shard bucket of each record with layout. Without this option, the shard bucket comes from the default shard layout.
func WithSchemaLabels ¶
func WithSchemaLabels(schemaLabels ...string) LogFixtureOpt
WithSchemaLabels computes the schema sort key for each log record from its stream labels. Without this option, SchemaKey is left unset.
type LogSectionOpt ¶
type LogSectionOpt func(*logSectionConfig)
func WithBuilderOptions ¶
func WithBuilderOptions(builderOptions *logs.BuilderOptions) LogSectionOpt
WithBuilderOptions enables customization of the builder options for the logs section.
type StreamFixture ¶
type StreamFixture struct {
// contains filtered or unexported fields
}
func (*StreamFixture) Entry ¶
func (f *StreamFixture) Entry(tsSeconds int, structuredMetadata string, logMessage string) *StreamFixture
Entry adds a single log message to the dataset using the pre-defined stream and provided timestamp and structured metadata.
type StreamsSectionOpt ¶
type StreamsSectionOpt func(*streamSectionConfig)
StreamsSectionOpt customizes the streams section that StreamsSection builds.
func WithStreamsLayout ¶
func WithStreamsLayout(layout streams.Layout) StreamsSectionOpt
WithStreamsLayout makes the streams section record layout instead of the default layout, which has the default shard layout and the schema label service_name.
func WithoutStreamsLayout ¶
func WithoutStreamsLayout() StreamsSectionOpt
WithoutStreamsLayout makes the streams section record no layout. The section uses the default shard layout.