Skip to content

Commit

Permalink
add GlobalClient() function to mirror old package variable GlobalClient
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <[email protected]>
  • Loading branch information
eliottness committed Jan 30, 2025
1 parent f654610 commit 21d0f01
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/newtelemetry/globalclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ var (
metricsHandleHotPointersMu sync.Mutex
)

// GlobalClient returns the global telemetry client.
func GlobalClient() Client {
client := globalClient.Load()
if client == nil {
return nil
}
return *client
}

// StartApp starts the telemetry client with the given client send the app-started telemetry and sets it as the global (*client).
func StartApp(client Client) {
if Disabled() || globalClient.Load() != nil {
Expand Down

0 comments on commit 21d0f01

Please sign in to comment.