Documentation ¶
Index ¶
- Constants
- Variables
- func AddFileToZip(zipWriter *zip.Writer, filename string) error
- func AppendError(callingMethodName string, firstError *error, secondError *error)
- func AssertErrorIfDev(err error)
- func Contains(in interface{}, elem interface{}) bool
- func ContainsString(slice []string, str string) bool
- func Copy(dst, src interface{})
- func CreateTMPDIR(rudderTmpDir string) (string, error)
- func GetChronologicalTimeStamp(receivedAt, sentAt, originalTimestamp time.Time) time.Time
- func GetHash(s string) int
- func GetIPFromReq(req *http.Request) string
- func GetMD5Hash(input string) string
- func GetMD5UUID(str string) (uuid.UUID, error)
- func GetMacAddress() string
- func GetMandatoryJSONFieldNames(st interface{}) []string
- func GetObjectStorageConfig(provider string, objectStorageConfig interface{}, accessKeyID string, ...) map[string]interface{}
- func GetOutboundIP() (net.IP, error)
- func GetParsedTimestamp(input interface{}) (time.Time, bool)
- func GetRudderEventVal(key string, rudderEvent types.SingularEventT) (interface{}, bool)
- func GetRudderID(event types.SingularEventT) (string, bool)
- func GetSpacesLocation(location string) (region string)
- func GetTagName(id string, names ...string) string
- func HasAWSKeysInConfig(config interface{}) bool
- func IncrementMapByKey(m map[string]int, key string, increment int)
- func IntArrayToString(a []int64, delim string) string
- func IsValidUUID(uuid string) bool
- func KeepProcessAlive()
- func MakeJSONArray(bytesArray [][]byte) []byte
- func MakeRetryablePostRequest(url string, endpoint string, data interface{}) (response []byte, statusCode int, err error)
- func MapStringKeys(input map[string]interface{}) []string
- func MinInt(a, b int) int
- func ParseRudderEventBatch(eventPayload json.RawMessage) ([]types.SingularEventT, bool)
- func PrintMemUsage()
- func QuoteLiteral(literal string) string
- func ReadLines(path string) ([]string, error)
- func RecordAppError(err error, errorStorePath string)
- func RemoveFilePaths(filepaths ...string)
- func ReplaceDB(dbName, targetName string, configDBUtilsList ...interface{})
- func ReplaceMultiRegex(str string, expList map[string]string) (string, error)
- func RunWithTimeout(f func(), onTimeout func(), d time.Duration)
- func SingleQuoteLiteralJoin(slice []string) string
- func SortedMapKeys(input interface{}) []string
- func SortedStructSliceValues(input interface{}, filedName string) []string
- func StringKeys(input interface{}) []string
- func TailTruncateStr(str string, count int) string
- func TruncateStr(str string, limit int) string
- func UnZipSingleFile(outputfile string, filename string)
- func ZipFiles(filename string, files []string) error
- type ConfigDBUtils
- type ErrorStoreT
- type GZipWriter
- type PerfStats
- type RudderError
- type WaitGroup
Constants ¶
const (
// RFC3339Milli with milli sec precision
RFC3339Milli = "2006-01-02T15:04:05.000Z07:00"
)
Variables ¶
var AppStartTime int64
var DefaultConfigDBUtils = ConfigDBUtils{Host: "localhost", User: "ubuntu", Port: 5432, Password: "ubuntu", Sslmode: "disable"}
Functions ¶
func AddFileToZip ¶
AddFileToZip adds file to zip including size header stats
func AppendError ¶
AppendError creates or appends second error to first error
func AssertErrorIfDev ¶
func AssertErrorIfDev(err error)
func Contains ¶
func Contains(in interface{}, elem interface{}) bool
Contains returns true if an element is present in a iteratee. https://github.com/thoas/go-funk
func ContainsString ¶
func Copy ¶
func Copy(dst, src interface{})
Copy copies the exported fields from src to dest Used for copying the default transport
func CreateTMPDIR ¶
CreateTMPDIR creates tmp dir at path configured via RUDDER_TMPDIR env var
func GetChronologicalTimeStamp ¶
Returns chronological timestamp of the event using the formula timestamp = receivedAt - (sentAt - originalTimestamp)
func GetIPFromReq ¶
GetIPFromReq gets ip address from request
func GetMD5Hash ¶
GetMD5Hash returns EncodeToString(md5 hash of the input string)
func GetMD5UUID ¶
GetMD5UUID hashes the given string into md5 and returns it as auuid
func GetMacAddress ¶
func GetMacAddress() string
func GetMandatoryJSONFieldNames ¶
func GetMandatoryJSONFieldNames(st interface{}) []string
GetMandatoryJSONFieldNames returns all the json field names defined against the json tag for each field.
func GetObjectStorageConfig ¶
func GetOutboundIP ¶
GetOutboundIP returns preferred outbound ip of this machine https://stackoverflow.com/a/37382208
func GetParsedTimestamp ¶
GetParsedTimestamp returns the parsed timestamp
func GetRudderEventVal ¶
func GetRudderEventVal(key string, rudderEvent types.SingularEventT) (interface{}, bool)
GetRudderEventVal returns the value corresponding to the key in the message structure
func GetRudderID ¶
func GetRudderID(event types.SingularEventT) (string, bool)
GetRudderID return the UserID from the object
func GetSpacesLocation ¶
func GetTagName ¶
GetTagName gets the tag name using a uuid and name
func HasAWSKeysInConfig ¶
func HasAWSKeysInConfig(config interface{}) bool
func IncrementMapByKey ¶
IncrementMapByKey starts with 1 and increments the counter of a key
func IntArrayToString ¶
func IsValidUUID ¶
IsValidUUID will check if provided string is a valid UUID
func KeepProcessAlive ¶
func KeepProcessAlive()
func MakeJSONArray ¶
func MakeRetryablePostRequest ¶
func MakeRetryablePostRequest(url string, endpoint string, data interface{}) (response []byte, statusCode int, err error)
MakeRetryablePostRequest is Util function to make a post request.
func MapStringKeys ¶
func ParseRudderEventBatch ¶
func ParseRudderEventBatch(eventPayload json.RawMessage) ([]types.SingularEventT, bool)
ParseRudderEventBatch looks for the batch structure inside event
func PrintMemUsage ¶
func PrintMemUsage()
PrintMemUsage outputs the current, total and OS memory being used. As well as the number of garage collection cycles completed.
func QuoteLiteral ¶
func RecordAppError ¶
RecordAppError appends the error occured to error_store.json
func RemoveFilePaths ¶
func RemoveFilePaths(filepaths ...string)
func ReplaceMultiRegex ¶
func RunWithTimeout ¶
RunWithTimeout runs provided function f until provided timeout d. If the timeout is reached, onTimeout callback will be called.
func SingleQuoteLiteralJoin ¶
func SortedMapKeys ¶
func SortedMapKeys(input interface{}) []string
func SortedStructSliceValues ¶
func StringKeys ¶
func StringKeys(input interface{}) []string
func TailTruncateStr ¶
TailTruncateStr returns the last `count` digits of a string
func TruncateStr ¶
func UnZipSingleFile ¶
UnZipSingleFile unzips zip containing single file into ouputfile path passed
Types ¶
type ConfigDBUtils ¶
type ErrorStoreT ¶
type ErrorStoreT struct {
Errors []RudderError
}
ErrorStoreT : DS to store the app errors
type GZipWriter ¶
func CreateGZ ¶
func CreateGZ(s string) (w GZipWriter, err error)
func (GZipWriter) CloseGZ ¶
func (w GZipWriter) CloseGZ() error
func (GZipWriter) Write ¶
func (w GZipWriter) Write(b []byte)
func (GZipWriter) WriteGZ ¶
func (w GZipWriter) WriteGZ(s string)
type PerfStats ¶
type PerfStats struct {
// contains filtered or unexported fields
}
PerfStats is the class for managing performance stats. Not multi-threaded safe now
func (*PerfStats) End ¶
End marks the end of one round of stat collection. events is number of events processed since start
type RudderError ¶
type RudderError struct { StartTime int64 CrashTime int64 ReadableStartTime string ReadableCrashTime string Message string StackTrace string Code int }
RudderError : to store rudder error
type WaitGroup ¶
type WaitGroup struct {
// contains filtered or unexported fields
}
func NewWaitGroup ¶
func NewWaitGroup() *WaitGroup