Documentation
¶
Index ¶
- Constants
- Variables
- func AddItemIntoDatabaseIfNotExist(databaseName string, checkingAttribute, checkingAttributeValue []string, ...) error
- func BuildDimensionFilterList(appendDimension int) []types.DimensionFilter
- func CheckMetricAboveZero(metricName string, namespace string, startTime time.Time, endTime time.Time, ...) (bool, error)
- func ConfigureAWSClients(region string) error
- func CreateStackName(stackPrefix string) string
- func DeleteLogGroup(logGroupName string)
- func DeleteLogGroupAndStream(logGroupName, logStreamName string)
- func DeleteLogStream(logGroupName, logStreamName string)
- func DeleteStack(ctx context.Context, stackName string, client *cloudformation.Client)
- func DescribeInstances(instanceIds []string) (*ec2.DescribeInstancesOutput, error)
- func DownloadFile(bucket, key, outFilename string) error
- func FilterExpression(annotations map[string]interface{}) string
- func FindStackInstanceId(ctx context.Context, stackName string, client *cloudformation.Client, ...) string
- func GetBatchTraces(traceIDs []string) ([]types.Trace, error)
- func GetClusterName(clusterArn string) string
- func GetContainerInstanceArns(clusterArn string) ([]string, error)
- func GetContainerInstanceId(containerInstanceArn string) string
- func GetImageId() string
- func GetImdsMetadata() *imds.GetInstanceIdentityDocumentOutput
- func GetInstanceId() string
- func GetInstancePrivateIpDns(instanceId string) (*string, error)
- func GetInstanceType() string
- func GetItemInDatabase(databaseName, indexName string, ...) (map[string]interface{}, error)
- func GetLogEventCountPerType(logGroup, logStream string, since, until *time.Time) (map[string]int, error)
- func GetLogQueryResults(logGroupName string, startTime, endTime int64, queryString string) ([][]types.ResultField, error)
- func GetLogQueryStats(logGroupName string, startTime, endTime int64, queryString string) (*types.QueryStatistics, error)
- func GetLogStreamNames(logGroupName string) []string
- func GetLogStreams(logGroupName string) []types.LogStream
- func GetMetricData(metricDataQueries []types.MetricDataQuery, startTime, endTime time.Time) (*cloudwatch.GetMetricDataOutput, error)
- func GetMetricStatistics(metricName string, namespace string, dimensions []types.Dimension, ...) (*cloudwatch.GetMetricStatisticsOutput, error)
- func GetSegments(traceIDs []string) ([]types.Segment, error)
- func GetStringParameter(name string) string
- func GetTraceIDs(startTime time.Time, endTime time.Time, filter string) ([]string, error)
- func IsLogGroupExists(logGroupName string, logGroupClassArg ...types.LogGroupClass) bool
- func PutStringParameter(name, value string) error
- func ReplaceItemInDatabase(databaseName string, packet map[string]interface{}) error
- func ReportMetric(namespace string, name string, value float64, units types.StandardUnit) error
- func RestartDaemonService(clusterArn, serviceName string) error
- func RestartService(clusterArn string, desiredCount *int32, serviceName string) error
- func StartStack(ctx context.Context, stackName string, client *cloudformation.Client, ...)
- func ValidateLogs(logGroup, logStream string, since, until *time.Time, ...) error
- func ValidateMetric(metricName, namespace string, dimensionsFilter []types.DimensionFilter) error
- func ValidateMetricWithTest(t *testing.T, metricName, namespace string, ...)
- func ValidateSampleCount(metricName, namespace string, dimensions []types.Dimension, ...) bool
- type ContainerInstance
- type EKSClusterType
- type EKSInstance
- type LogEventValidator
- type LogEventsValidator
- type SchemaRetriever
Constants ¶
const (
NoLogTypeFound = "NoLogTypeFound"
)
const (
StandardRetries = 3
)
Variables ¶
var ( // AWS Clients Ec2Client *ec2.Client EcsClient *ecs.Client SsmClient *ssm.Client ImdsClient *imds.Client CwmClient *cloudwatch.Client CwlClient *cloudwatchlogs.Client DynamodbClient *dynamodb.Client S3Client *s3.Client CloudformationClient *cloudformation.Client XrayClient *xray.Client )
var ( StandardExponentialBackoff = backoff.WithMaxRetries(&backoff.ExponentialBackOff{ InitialInterval: 30 * time.Second, RandomizationFactor: 2, Multiplier: 2, MaxInterval: 60 * time.Second, MaxElapsedTime: 30 * time.Second, Stop: backoff.Stop, Clock: backoff.SystemClock, }, StandardRetries) )
Functions ¶
func BuildDimensionFilterList ¶
func BuildDimensionFilterList(appendDimension int) []types.DimensionFilter
func CheckMetricAboveZero ¶
func ConfigureAWSClients ¶
ConfigureAWSClients configures the AWS clients using a set region.
func CreateStackName ¶
func DeleteLogGroup ¶
func DeleteLogGroup(logGroupName string)
DeleteLogGroup cleans up log group by name
func DeleteLogGroupAndStream ¶
func DeleteLogGroupAndStream(logGroupName, logStreamName string)
DeleteLogGroupAndStream cleans up a log group and stream by name. This gracefully handles ResourceNotFoundException errors from calling the APIs
func DeleteLogStream ¶
func DeleteLogStream(logGroupName, logStreamName string)
DeleteLogStream cleans up log stream by name
func DeleteStack ¶
func DeleteStack(ctx context.Context, stackName string, client *cloudformation.Client)
func DescribeInstances ¶
func DescribeInstances(instanceIds []string) (*ec2.DescribeInstancesOutput, error)
func DownloadFile ¶
func FilterExpression ¶
func FindStackInstanceId ¶
func GetClusterName ¶
func GetContainerInstanceId ¶
func GetImageId ¶
func GetImageId() string
func GetImdsMetadata ¶
func GetImdsMetadata() *imds.GetInstanceIdentityDocumentOutput
TODO: Refactor Structure and Interface for more easier follow that shares the same session
func GetInstanceId ¶
func GetInstanceId() string
func GetInstancePrivateIpDns ¶
func GetInstanceType ¶
func GetInstanceType() string
func GetItemInDatabase ¶
func GetLogEventCountPerType ¶
func GetLogQueryResults ¶
func GetLogQueryResults(logGroupName string, startTime, endTime int64, queryString string) ([][]types.ResultField, error)
GetLogQueryResults for the log group between start/end (in epoch seconds) for the query string.
func GetLogQueryStats ¶
func GetLogQueryStats(logGroupName string, startTime, endTime int64, queryString string) (*types.QueryStatistics, error)
GetLogQueryStats for the log group between start/end (in epoch seconds) for the query string.
func GetLogStreamNames ¶
func GetLogStreams ¶
func GetMetricData ¶
func GetMetricData(metricDataQueries []types.MetricDataQuery, startTime, endTime time.Time) (*cloudwatch.GetMetricDataOutput, error)
GetMetricData takes the metric name, metric dimension and metric namespace and return the query metrics
func GetMetricStatistics ¶
func GetStringParameter ¶
func GetTraceIDs ¶
func IsLogGroupExists ¶
func IsLogGroupExists(logGroupName string, logGroupClassArg ...types.LogGroupClass) bool
IsLogGroupExists confirms whether the logGroupName exists or not
func PutStringParameter ¶
func ReplaceItemInDatabase ¶
func ReportMetric ¶
ReportMetric sends a single metric to CloudWatch. Does not support sending dimensions.
func RestartDaemonService ¶
func RestartService ¶
func StartStack ¶
func ValidateLogs ¶
func ValidateLogs(logGroup, logStream string, since, until *time.Time, validators ...LogEventsValidator) error
ValidateLogs queries a given LogGroup/LogStream combination given the start and end times, and executes an arbitrary validator function on the found logs.
func ValidateMetric ¶
func ValidateMetric(metricName, namespace string, dimensionsFilter []types.DimensionFilter) error
func ValidateMetricWithTest ¶
func ValidateMetricWithTest(t *testing.T, metricName, namespace string, dimensionsFilter []types.DimensionFilter, retries int, retryTime time.Duration)
ValidateMetricWithTest takes the metric name, metric dimension and corresponding namespace that contains the metric
Types ¶
type ContainerInstance ¶
type ContainerInstance struct { ContainerInstanceArn string ContainerInstanceId string EC2InstanceId string }
func GetContainerInstances ¶
func GetContainerInstances(clusterArn string) ([]ContainerInstance, error)
type EKSClusterType ¶
type EKSClusterType struct {
Type string
}
type EKSInstance ¶
type EKSInstance struct {
InstanceName *string
}
func GetEKSInstances ¶
func GetEKSInstances(clusterName string) ([]EKSInstance, error)
type LogEventValidator ¶
type LogEventValidator func(event types.OutputLogEvent) error
func AssertLogContainsSubstring ¶
func AssertLogContainsSubstring(substr string) LogEventValidator
func AssertLogSchema ¶
func AssertLogSchema(schemaRetriever SchemaRetriever) LogEventValidator
type LogEventsValidator ¶
type LogEventsValidator func(events []types.OutputLogEvent) error
func AssertLogsCount ¶
func AssertLogsCount(count int) LogEventsValidator
func AssertLogsNotEmpty ¶
func AssertLogsNotEmpty() LogEventsValidator
func AssertNoDuplicateLogs ¶
func AssertNoDuplicateLogs() LogEventsValidator
func AssertPerLog ¶
func AssertPerLog(validators ...LogEventValidator) LogEventsValidator
AssertPerLog runs each validator on each of the log events. Fails fast.
type SchemaRetriever ¶
func WithSchema ¶
func WithSchema(schema string) SchemaRetriever