Skip to content

Commit

Permalink
Add NewClientWithDetails API (#241)
Browse files Browse the repository at this point in the history
For multi-instance users, we still need a way to expose the `InitializeDetails`.
  • Loading branch information
kenny-statsig authored Oct 18, 2024
1 parent d123c92 commit 571a6db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ func NewClientWithOptions(sdkKey string, options *Options) *Client {
return client
}

// Initializes a Statsig Client with the given sdkKey and options
// returning the initialized client and details of initialization
func NewClientWithDetails(sdkKey string, options *Options) (*Client, InitializeDetails) {
client, context := newClientImpl(sdkKey, options)
return client, InitializeDetails{
Duration: time.Since(context.Start),
Success: context.Success,
Error: context.Error,
Source: context.Source,
}
}

func newClientImpl(sdkKey string, options *Options) (*Client, *initContext) {
context := newInitContext()
diagnostics := newDiagnostics(options)
Expand Down

0 comments on commit 571a6db

Please sign in to comment.