func NewClientLibraryExporter()

in pcap-fsnotify/internal/gcs/client_library_exporter.go [389:441]


func NewClientLibraryExporter(
	ctx context.Context,
	logger *log.Logger,
	projectID string,
	service string,
	instanceID string,
	bucket string,
	directory string,
	maxRetries uint,
	retriesDelay uint,
) Exporter {
	x := newExporter(logger, directory, maxRetries, retriesDelay)

	exporter := &libraryExporter{
		exporter:   x,
		projectID:  projectID,
		service:    service,
		instanceID: instanceID,
		bucket:     bucket,
		dialer: &net.Dialer{
			Timeout: 5 * time.Minute,
			KeepAliveConfig: net.KeepAliveConfig{
				Enable:   true,
				Idle:     30 * time.Second,
				Interval: 15 * time.Second,
				Count:    2,
			},
		},
		keepalive: keepalive.ClientParameters{
			Time:                60 * time.Second,
			Timeout:             10 * time.Second,
			PermitWithoutStream: true,
		},
	}

	if exporter, err := exporter.
		initialize(ctx); err == nil {
		return exporter
	} else {
		logger.LogEvent(
			zapcore.ErrorLevel,
			"failed to create PCAP files client library exporter",
			PCAP_EXPORT,
			map[string]any{
				"project": projectID,
				"bucket":  bucket,
			},
			err)
	}

	// return the NIL exporter by default
	return NewNilExporter(logger)
}