Installation steps

  1. Install Atatus Go Agent and messaging module

    copy
    icon/buttons/copy
    go get go.atatus.com/agent
    go get go.atatus.com/agent/module/atawssdkgo
    
  2. Set up tracer and wrap the messaging client

    copy
    icon/buttons/copy
    import (
        "go.atatus.com/agent"
        "go.atatus.com/agent/module/atawssdkgo"
    
        "github.com/aws/aws-sdk-go/aws"
        "github.com/aws/aws-sdk-go/aws/session"
        "github.com/aws/aws-sdk-go/service/s3/s3manager"
    )
    
    func main() {
      // Initialize Atatus tracer with values from environment
        tracer := atatus.DefaultTracer
        tracer.Service.LicenseKey = os.Getenv("ATATUS_LICENSE_KEY")
        tracer.Service.AppName = os.Getenv("ATATUS_APP_NAME")
        tracer.Service.Tracing = os.Getenv("ATATUS_TRACING")
        tracer.Service.Analytics = os.Getenv("ATATUS_ANALYTICS")
    
        session := session.Must(session.NewSession())
        session = atawssdkgo.WrapSession(session)
    
        uploader := s3manager.NewUploader(session)
        s := &server{uploader}
        ...
    }
    
    func (s *server) handleRequest(w http.ResponseWriter, req *http.Request) {
        ctx := req.Context()
        out, err := s.uploader.UploadWithContext(ctx, &s3manager.UploadInput{
        Bucket: aws.String("your-bucket"),
        Key:    aws.String("your-key"),
        Body:   bytes.NewBuffer([]byte("your-body")),
      })
      ...
    }
    
  3. Clean Up Dependencies

    copy
    icon/buttons/copy

    go mod tidy
    
  4. Run the Application

    copy
    icon/buttons/copy

    go run main.go