Documentation ¶
Overview ¶
Kudzu RPC Client for pushing analytics data
This package implements the gRPC analytics client package that can be used for implementing embedded analytics forwardrs to the Kudzu Analytis platform.
Example ¶
package main import ( "github.com/kudzutechnologies/analytics/api" "github.com/kudzutechnologies/analytics/client" ) func main() { // Create a client c := client.CreateAnalyticsClient(client.AnalyticsClientConfig{ ClientId: "1122334455667788", ClientKey: "11223344556677889900aabbccddeeff", }) // Connect to the server err := c.Connect() if err != nil { panic(err) } // Push analytics data metrics := &api.AnalyticsMetrics{} err = c.PushMetrics(metrics) if err != nil { panic(err) } // Disconnect the client c.Disconnect() }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ClientVersion = 2
Revision: v1 - First public release of the client v2 - Added support for multiple antennas
Variables ¶
View Source
var ( // An error thrown when trying to use the client while not connected ErrNotConnected = fmt.Errorf("client is not connnected") )
Functions ¶
This section is empty.
Types ¶
type AnalyticsClientConfig ¶
type AnalyticsClientConfig struct { // The API client ID & Key for signing in ClientId string `json:"client_id"` ClientKey string `json:"client_key"` // The endpoint to use for uploading the data (Optional) Endpoint string `json:"endpoint,omitempty"` // The server CA certificate file to use for validating the connection (Optional) CAFile string `json:"ca_file,omitempty"` // The default timeout for connecting (seconds) ConnectTimeout int32 `json:"connect_timeout,omitempty"` // The default timeout for all the requests (seconds) RequestTimeout int32 `json:"request_timeout,omitempty"` // The maximum re-connection back-off (seconds) MaxReconnectBackoff int32 `json:"max_reconnect_backoff,omitempty"` // Wether or not to automatically re-connect to the server AutoReconnect *bool `json:"reconnect,omitempty"` // Indicates that we are forwarding data from the server-side ServerSide *bool `json:"server_side,omitempty"` }
Configuration parameters that can be passed to the analytics client
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
the RPC client
func CreateAnalyticsClient ¶
func CreateAnalyticsClient(config AnalyticsClientConfig) *Client
Create an instance of the analytics client
The client will not be connected until you call the .Connect method.
func (*Client) Disconnect ¶
func (*Client) PushMetrics ¶
func (c *Client) PushMetrics(metrics *api.AnalyticsMetrics) error
Pushes analyics metrics to the service
Click to show internal directories.
Click to hide internal directories.