mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 01:12:24 -05:00 
			
		
		
		
	[chore] update otel libraries (#3740)
* chore: update otel dependencies * refactor: combine tracing & metrics in observability package * chore: update example tracing compose file
This commit is contained in:
		
					parent
					
						
							
								baed591a1d
							
						
					
				
			
			
				commit
				
					
						dd094e4012
					
				
			
		
					 217 changed files with 6873 additions and 2734 deletions
				
			
		
							
								
								
									
										65
									
								
								vendor/google.golang.org/grpc/clientconn.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										65
									
								
								vendor/google.golang.org/grpc/clientconn.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -775,10 +775,7 @@ func (cc *ClientConn) updateResolverStateAndUnlock(s resolver.State, err error) | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	var balCfg serviceconfig.LoadBalancingConfig | ||||
| 	if cc.sc != nil && cc.sc.lbConfig != nil { | ||||
| 		balCfg = cc.sc.lbConfig | ||||
| 	} | ||||
| 	balCfg := cc.sc.lbConfig | ||||
| 	bw := cc.balancerWrapper | ||||
| 	cc.mu.Unlock() | ||||
| 
 | ||||
|  | @ -825,14 +822,13 @@ func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer. | |||
| 	} | ||||
| 
 | ||||
| 	ac := &addrConn{ | ||||
| 		state:          connectivity.Idle, | ||||
| 		cc:             cc, | ||||
| 		addrs:          copyAddresses(addrs), | ||||
| 		scopts:         opts, | ||||
| 		dopts:          cc.dopts, | ||||
| 		channelz:       channelz.RegisterSubChannel(cc.channelz, ""), | ||||
| 		resetBackoff:   make(chan struct{}), | ||||
| 		stateReadyChan: make(chan struct{}), | ||||
| 		state:        connectivity.Idle, | ||||
| 		cc:           cc, | ||||
| 		addrs:        copyAddresses(addrs), | ||||
| 		scopts:       opts, | ||||
| 		dopts:        cc.dopts, | ||||
| 		channelz:     channelz.RegisterSubChannel(cc.channelz, ""), | ||||
| 		resetBackoff: make(chan struct{}), | ||||
| 	} | ||||
| 	ac.ctx, ac.cancel = context.WithCancel(cc.ctx) | ||||
| 	// Start with our address set to the first address; this may be updated if | ||||
|  | @ -1141,10 +1137,15 @@ func (cc *ClientConn) Close() error { | |||
| 
 | ||||
| 	<-cc.resolverWrapper.serializer.Done() | ||||
| 	<-cc.balancerWrapper.serializer.Done() | ||||
| 
 | ||||
| 	var wg sync.WaitGroup | ||||
| 	for ac := range conns { | ||||
| 		ac.tearDown(ErrClientConnClosing) | ||||
| 		wg.Add(1) | ||||
| 		go func(ac *addrConn) { | ||||
| 			defer wg.Done() | ||||
| 			ac.tearDown(ErrClientConnClosing) | ||||
| 		}(ac) | ||||
| 	} | ||||
| 	wg.Wait() | ||||
| 	cc.addTraceEvent("deleted") | ||||
| 	// TraceEvent needs to be called before RemoveEntry, as TraceEvent may add | ||||
| 	// trace reference to the entity being deleted, and thus prevent it from being | ||||
|  | @ -1179,8 +1180,7 @@ type addrConn struct { | |||
| 	addrs   []resolver.Address // All addresses that the resolver resolved to. | ||||
| 
 | ||||
| 	// Use updateConnectivityState for updating addrConn's connectivity state. | ||||
| 	state          connectivity.State | ||||
| 	stateReadyChan chan struct{} // closed and recreated on every READY state change. | ||||
| 	state connectivity.State | ||||
| 
 | ||||
| 	backoffIdx   int // Needs to be stateful for resetConnectBackoff. | ||||
| 	resetBackoff chan struct{} | ||||
|  | @ -1251,6 +1251,8 @@ func (ac *addrConn) resetTransportAndUnlock() { | |||
| 	ac.mu.Unlock() | ||||
| 
 | ||||
| 	if err := ac.tryAllAddrs(acCtx, addrs, connectDeadline); err != nil { | ||||
| 		// TODO: #7534 - Move re-resolution requests into the pick_first LB policy | ||||
| 		// to ensure one resolution request per pass instead of per subconn failure. | ||||
| 		ac.cc.resolveNow(resolver.ResolveNowOptions{}) | ||||
| 		ac.mu.Lock() | ||||
| 		if acCtx.Err() != nil { | ||||
|  | @ -1292,7 +1294,7 @@ func (ac *addrConn) resetTransportAndUnlock() { | |||
| 	ac.mu.Unlock() | ||||
| } | ||||
| 
 | ||||
| // tryAllAddrs tries to creates a connection to the addresses, and stop when at | ||||
| // tryAllAddrs tries to create a connection to the addresses, and stop when at | ||||
| // the first successful one. It returns an error if no address was successfully | ||||
| // connected, or updates ac appropriately with the new transport. | ||||
| func (ac *addrConn) tryAllAddrs(ctx context.Context, addrs []resolver.Address, connectDeadline time.Time) error { | ||||
|  | @ -1369,7 +1371,7 @@ func (ac *addrConn) createTransport(ctx context.Context, addr resolver.Address, | |||
| 	defer cancel() | ||||
| 	copts.ChannelzParent = ac.channelz | ||||
| 
 | ||||
| 	newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onClose) | ||||
| 	newTr, err := transport.NewHTTP2Client(connectCtx, ac.cc.ctx, addr, copts, onClose) | ||||
| 	if err != nil { | ||||
| 		if logger.V(2) { | ||||
| 			logger.Infof("Creating new client transport to %q: %v", addr, err) | ||||
|  | @ -1443,7 +1445,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { | |||
| 	if !ac.scopts.HealthCheckEnabled { | ||||
| 		return | ||||
| 	} | ||||
| 	healthCheckFunc := ac.cc.dopts.healthCheckFunc | ||||
| 	healthCheckFunc := internal.HealthCheckFunc | ||||
| 	if healthCheckFunc == nil { | ||||
| 		// The health package is not imported to set health check function. | ||||
| 		// | ||||
|  | @ -1475,7 +1477,7 @@ func (ac *addrConn) startHealthCheck(ctx context.Context) { | |||
| 	} | ||||
| 	// Start the health checking stream. | ||||
| 	go func() { | ||||
| 		err := ac.cc.dopts.healthCheckFunc(ctx, newStream, setConnectivityState, healthCheckConfig.ServiceName) | ||||
| 		err := healthCheckFunc(ctx, newStream, setConnectivityState, healthCheckConfig.ServiceName) | ||||
| 		if err != nil { | ||||
| 			if status.Code(err) == codes.Unimplemented { | ||||
| 				channelz.Error(logger, ac.channelz, "Subchannel health check is unimplemented at server side, thus health check is disabled") | ||||
|  | @ -1504,29 +1506,6 @@ func (ac *addrConn) getReadyTransport() transport.ClientTransport { | |||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| // getTransport waits until the addrconn is ready and returns the transport. | ||||
| // If the context expires first, returns an appropriate status.  If the | ||||
| // addrConn is stopped first, returns an Unavailable status error. | ||||
| func (ac *addrConn) getTransport(ctx context.Context) (transport.ClientTransport, error) { | ||||
| 	for ctx.Err() == nil { | ||||
| 		ac.mu.Lock() | ||||
| 		t, state, sc := ac.transport, ac.state, ac.stateReadyChan | ||||
| 		ac.mu.Unlock() | ||||
| 		if state == connectivity.Ready { | ||||
| 			return t, nil | ||||
| 		} | ||||
| 		if state == connectivity.Shutdown { | ||||
| 			return nil, status.Errorf(codes.Unavailable, "SubConn shutting down") | ||||
| 		} | ||||
| 
 | ||||
| 		select { | ||||
| 		case <-ctx.Done(): | ||||
| 		case <-sc: | ||||
| 		} | ||||
| 	} | ||||
| 	return nil, status.FromContextError(ctx.Err()).Err() | ||||
| } | ||||
| 
 | ||||
| // tearDown starts to tear down the addrConn. | ||||
| // | ||||
| // Note that tearDown doesn't remove ac from ac.cc.conns, so the addrConn struct | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue