Skip to content

Commit

Permalink
Handle non-filled PubSub.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBergmeier6176 committed Jan 23, 2024
1 parent 19b46a2 commit 196c690
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/gcp/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ func DiscoverServices(project, serviceName string, tracerProviderOptions []sdktr
// Does **not** handle errors in close since there usually
// is not much that can be done on Close failure anyway.
func (s *Services) Close() {
s.PubSub.Close()
if s.PubSub != nil {
s.PubSub.Close()
}
s.TracerProvider.ForceFlush(context.Background()) // flushes any pending spans
s.ErrorReporting.Close()
s.Logging.Close()
Expand Down

0 comments on commit 196c690

Please sign in to comment.