mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 10:42: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
				
			
		
							
								
								
									
										18
									
								
								vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -23,21 +23,26 @@ import ( | |||
| 	"encoding/json" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"math/rand" | ||||
| 	rand "math/rand/v2" | ||||
| 
 | ||||
| 	"google.golang.org/grpc/balancer" | ||||
| 	"google.golang.org/grpc/balancer/pickfirst/internal" | ||||
| 	"google.golang.org/grpc/connectivity" | ||||
| 	"google.golang.org/grpc/grpclog" | ||||
| 	"google.golang.org/grpc/internal" | ||||
| 	"google.golang.org/grpc/internal/envconfig" | ||||
| 	internalgrpclog "google.golang.org/grpc/internal/grpclog" | ||||
| 	"google.golang.org/grpc/internal/pretty" | ||||
| 	"google.golang.org/grpc/resolver" | ||||
| 	"google.golang.org/grpc/serviceconfig" | ||||
| 
 | ||||
| 	_ "google.golang.org/grpc/balancer/pickfirst/pickfirstleaf" // For automatically registering the new pickfirst if required. | ||||
| ) | ||||
| 
 | ||||
| func init() { | ||||
| 	if envconfig.NewPickFirstEnabled { | ||||
| 		return | ||||
| 	} | ||||
| 	balancer.Register(pickfirstBuilder{}) | ||||
| 	internal.ShuffleAddressListForTesting = func(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } | ||||
| } | ||||
| 
 | ||||
| var logger = grpclog.Component("pick-first-lb") | ||||
|  | @ -50,7 +55,7 @@ const ( | |||
| 
 | ||||
| type pickfirstBuilder struct{} | ||||
| 
 | ||||
| func (pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { | ||||
| func (pickfirstBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { | ||||
| 	b := &pickfirstBalancer{cc: cc} | ||||
| 	b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) | ||||
| 	return b | ||||
|  | @ -103,10 +108,13 @@ func (b *pickfirstBalancer) ResolverError(err error) { | |||
| 	}) | ||||
| } | ||||
| 
 | ||||
| // Shuffler is an interface for shuffling an address list. | ||||
| type Shuffler interface { | ||||
| 	ShuffleAddressListForTesting(n int, swap func(i, j int)) | ||||
| } | ||||
| 
 | ||||
| // ShuffleAddressListForTesting pseudo-randomizes the order of addresses.  n | ||||
| // is the number of elements.  swap swaps the elements with indexes i and j. | ||||
| func ShuffleAddressListForTesting(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } | ||||
| 
 | ||||
| func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState) error { | ||||
|  | @ -140,7 +148,7 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState | |||
| 		// within each endpoint. - A61 | ||||
| 		if cfg.ShuffleAddressList { | ||||
| 			endpoints = append([]resolver.Endpoint{}, endpoints...) | ||||
| 			internal.ShuffleAddressListForTesting.(func(int, func(int, int)))(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) | ||||
| 			internal.RandShuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) | ||||
| 		} | ||||
| 
 | ||||
| 		// "Flatten the list by concatenating the ordered list of addresses for each | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue