Documentation ¶
Index ¶
Constants ¶
const ( MappingModeSingleTable = "single-table" MappingModeMultiTable = "multi-table" )
Mapping modes specify how Telegraf model should be represented in Timestream model. See sample config for more details.
const MaxRecordsPerCall = 100
MaxRecordsPerCall reflects Timestream limit of WriteRecords API call
const MaxWriteRoutinesDefault = 1
Default value for maximum number of parallel go routines to ingest/write data when max_write_go_routines is not specified in the config
Variables ¶
var WriteFactory = func(credentialConfig *internalaws.CredentialConfig) (WriteClient, error) { awsCreds, awsErr := credentialConfig.Credentials() if awsErr != nil { panic("Unable to load credentials config " + awsErr.Error()) } cfg, cfgErr := config.LoadDefaultConfig(context.TODO()) if cfgErr != nil { panic("Unable to load SDK config for Timestream " + cfgErr.Error()) } if credentialConfig.EndpointURL != "" && credentialConfig.Region != "" { customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { return aws.Endpoint{ PartitionID: "aws", URL: credentialConfig.EndpointURL, SigningRegion: credentialConfig.Region, }, nil }) cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithEndpointResolverWithOptions(customResolver)) if err != nil { panic("unable to load SDK config for Timestream " + err.Error()) } cfg.Credentials = awsCreds.Credentials return timestreamwrite.NewFromConfig(cfg, func(o *timestreamwrite.Options) { o.Region = credentialConfig.Region o.EndpointDiscovery.EnableEndpointDiscovery = aws.EndpointDiscoveryDisabled }), nil } cfg.Credentials = awsCreds.Credentials return timestreamwrite.NewFromConfig(cfg, func(o *timestreamwrite.Options) { o.Region = credentialConfig.Region }), nil }
WriteFactory function provides a way to mock the client instantiation for testing purposes.
Functions ¶
This section is empty.
Types ¶
type Timestream ¶
type Timestream struct { MappingMode string `toml:"mapping_mode"` DescribeDatabaseOnStart bool `toml:"describe_database_on_start"` DatabaseName string `toml:"database_name"` SingleTableName string `toml:"single_table_name"` SingleTableDimensionNameForTelegrafMeasurementName string `toml:"single_table_dimension_name_for_telegraf_measurement_name"` CreateTableIfNotExists bool `toml:"create_table_if_not_exists"` CreateTableMagneticStoreRetentionPeriodInDays int64 `toml:"create_table_magnetic_store_retention_period_in_days"` CreateTableMemoryStoreRetentionPeriodInHours int64 `toml:"create_table_memory_store_retention_period_in_hours"` CreateTableTags map[string]string `toml:"create_table_tags"` MaxWriteGoRoutinesCount int `toml:"max_write_go_routines"` Log telegraf.Logger internalaws.CredentialConfig // contains filtered or unexported fields }
func (*Timestream) Close ¶
func (t *Timestream) Close() error
func (*Timestream) Connect ¶
func (t *Timestream) Connect() error
func (*Timestream) SampleConfig ¶
func (*Timestream) SampleConfig() string
func (*Timestream) TransformMetrics ¶
func (t *Timestream) TransformMetrics(metrics []telegraf.Metric) []*timestreamwrite.WriteRecordsInput
TransformMetrics transforms a collection of Telegraf Metrics into write requests to Timestream. Telegraf Metrics are grouped by Name, Tag Keys and Time to use Timestream CommonAttributes. Returns collection of write requests to be performed to Timestream.
type WriteClient ¶
type WriteClient interface { CreateTable(context.Context, *timestreamwrite.CreateTableInput, ...func(*timestreamwrite.Options)) (*timestreamwrite.CreateTableOutput, error) WriteRecords(context.Context, *timestreamwrite.WriteRecordsInput, ...func(*timestreamwrite.Options)) (*timestreamwrite.WriteRecordsOutput, error) DescribeDatabase(context.Context, *timestreamwrite.DescribeDatabaseInput, ...func(*timestreamwrite.Options)) (*timestreamwrite.DescribeDatabaseOutput, error) }