Skip to content

3.6.0

Compare
Choose a tag to compare
@pzartem pzartem released this 16 Sep 08:56
· 34 commits to master since this release
11411b8

Performance and memory usage improvement in S3Client:

  • Doesn't store Message before sending it to S3

  • Messages are serialized and gzipped directly to the buffer (before lib was aggregating them in memory)

  • Added a file buffer support, it allows us to put 100 MiB gzipped files (gunzipped 1.5gb) with a really small memory footprint.

Usage of file buffer examples:

package main

import "github.com/FindHotel/analytics-go"

func main() {
    client, err := analytics.NewS3ClientWithConfig(analytics.S3ClientConfig{
	Config: analytics.Config{},
	S3: analytics.S3{
		Stage:  "dev",
		Stream: "tuna",
                BatchFilePath: "/tmp/events.tmp"
	},
    })
    if err != nil { // ALWAYS check for errors!
        panic(err)
    }

    // This will go to tuna stream
    client.Enqueue(analytics.Track{
        UserId: "test-user",
        Event:  "OfferFound",
    })

    // Flushes any queued messages and closes the client - DON'T forget this step.
    tunaClient.Close()
}