ffexporter

package
Version: v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ffexporter defines the data exporter of go-feature-flag

Theses exporters are usable in your init configuration.

ffclient.Init(ffclient.Config{
  //...
  DataExporter: ffclient.DataExporter{
      FlushInterval:   10 * time.Second,
      MaxEventInMemory: 1000,
      Exporter: &ffexporter.File{
          OutputDir: "/output-data/",
      },
  },
  //...
})

Check in this package available exporters.

Index

Constants

View Source
const DefaultCsvTemplate = "{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};" +
	"{{ .Value}};{{ .Default}}\n"
View Source
const DefaultFilenameTemplate = "flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}"

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// Format is the output format you want in your exported file.
	// Available format are JSON and CSV.
	// Default: JSON
	Format string

	// OutputDir is the location of the directory where to store the exported files
	// It should finish with a /
	// Default: the current directory
	OutputDir string

	// Filename is the name of your output file
	// You can use a templated config to define the name of your export files.
	// Available replacement are {{ .Hostname}}, {{ .Timestamp}} and {{ .Format}}
	// Default: "flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}"
	Filename string

	// CsvTemplate is used if your output format is CSV.
	// This field will be ignored if you are using another format than CSV.
	// You can decide which fields you want in your CSV line with a go-template syntax,
	// please check internal/exporter/feature_event.go to see what are the fields available.
	// Default:
	// {{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}}\n
	CsvTemplate string
	// contains filtered or unexported fields
}

func (*File) Export

func (f *File) Export(logger *log.Logger, featureEvents []exporter.FeatureEvent) error

Export is saving a collection of events in a file.

func (*File) IsBulk added in v0.11.0

func (f *File) IsBulk() bool

IsBulk return false if we should directly send the data as soon as it is produce and true if we collect the data to send them in bulk.

type Log added in v0.11.0

type Log struct {
	// Format is the template configuration of the output format of your log.
	// You can use all the key from the exporter.FeatureEvent + a key called FormattedDate that represent the date with
	// the RFC 3339 Format
	// Default: [{{ .FormattedDate}}] user="{{ .UserKey}}", flag="{{ .Key}}", value="{{ .Value}}"
	Format string
	// contains filtered or unexported fields
}

func (*Log) Export added in v0.11.0

func (f *Log) Export(logger *log.Logger, featureEvents []exporter.FeatureEvent) error

Export is saving a collection of events in a file.

func (*Log) IsBulk added in v0.11.0

func (f *Log) IsBulk() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL