mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 08:12:26 -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
				
			
		
							
								
								
									
										47
									
								
								vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -24,8 +24,9 @@ import ( | |||
| 	"context" | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"math/rand" | ||||
| 	rand "math/rand/v2" | ||||
| 	"net" | ||||
| 	"net/netip" | ||||
| 	"os" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
|  | @ -122,7 +123,7 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts | |||
| 	} | ||||
| 
 | ||||
| 	// IP address. | ||||
| 	if ipAddr, ok := formatIP(host); ok { | ||||
| 	if ipAddr, err := formatIP(host); err == nil { | ||||
| 		addr := []resolver.Address{{Addr: ipAddr + ":" + port}} | ||||
| 		cc.UpdateState(resolver.State{Addresses: addr}) | ||||
| 		return deadResolver{}, nil | ||||
|  | @ -177,7 +178,7 @@ type dnsResolver struct { | |||
| 	// finished. Otherwise, data race will be possible. [Race Example] in | ||||
| 	// dns_resolver_test we replace the real lookup functions with mocked ones to | ||||
| 	// facilitate testing. If Close() doesn't wait for watcher() goroutine | ||||
| 	// finishes, race detector sometimes will warns lookup (READ the lookup | ||||
| 	// finishes, race detector sometimes will warn lookup (READ the lookup | ||||
| 	// function pointers) inside watcher() goroutine has data race with | ||||
| 	// replaceNetFunc (WRITE the lookup function pointers). | ||||
| 	wg                   sync.WaitGroup | ||||
|  | @ -237,7 +238,9 @@ func (d *dnsResolver) watcher() { | |||
| } | ||||
| 
 | ||||
| func (d *dnsResolver) lookupSRV(ctx context.Context) ([]resolver.Address, error) { | ||||
| 	if !EnableSRVLookups { | ||||
| 	// Skip this particular host to avoid timeouts with some versions of | ||||
| 	// systemd-resolved. | ||||
| 	if !EnableSRVLookups || d.host == "metadata.google.internal." { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| 	var newAddrs []resolver.Address | ||||
|  | @ -258,9 +261,9 @@ func (d *dnsResolver) lookupSRV(ctx context.Context) ([]resolver.Address, error) | |||
| 			return nil, err | ||||
| 		} | ||||
| 		for _, a := range lbAddrs { | ||||
| 			ip, ok := formatIP(a) | ||||
| 			if !ok { | ||||
| 				return nil, fmt.Errorf("dns: error parsing A record IP address %v", a) | ||||
| 			ip, err := formatIP(a) | ||||
| 			if err != nil { | ||||
| 				return nil, fmt.Errorf("dns: error parsing A record IP address %v: %v", a, err) | ||||
| 			} | ||||
| 			addr := ip + ":" + strconv.Itoa(int(s.Port)) | ||||
| 			newAddrs = append(newAddrs, resolver.Address{Addr: addr, ServerName: s.Target}) | ||||
|  | @ -320,9 +323,9 @@ func (d *dnsResolver) lookupHost(ctx context.Context) ([]resolver.Address, error | |||
| 	} | ||||
| 	newAddrs := make([]resolver.Address, 0, len(addrs)) | ||||
| 	for _, a := range addrs { | ||||
| 		ip, ok := formatIP(a) | ||||
| 		if !ok { | ||||
| 			return nil, fmt.Errorf("dns: error parsing A record IP address %v", a) | ||||
| 		ip, err := formatIP(a) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("dns: error parsing A record IP address %v: %v", a, err) | ||||
| 		} | ||||
| 		addr := ip + ":" + d.port | ||||
| 		newAddrs = append(newAddrs, resolver.Address{Addr: addr}) | ||||
|  | @ -349,19 +352,19 @@ func (d *dnsResolver) lookup() (*resolver.State, error) { | |||
| 	return &state, nil | ||||
| } | ||||
| 
 | ||||
| // formatIP returns ok = false if addr is not a valid textual representation of | ||||
| // an IP address. If addr is an IPv4 address, return the addr and ok = true. | ||||
| // formatIP returns an error if addr is not a valid textual representation of | ||||
| // an IP address. If addr is an IPv4 address, return the addr and error = nil. | ||||
| // If addr is an IPv6 address, return the addr enclosed in square brackets and | ||||
| // ok = true. | ||||
| func formatIP(addr string) (addrIP string, ok bool) { | ||||
| 	ip := net.ParseIP(addr) | ||||
| 	if ip == nil { | ||||
| 		return "", false | ||||
| // error = nil. | ||||
| func formatIP(addr string) (string, error) { | ||||
| 	ip, err := netip.ParseAddr(addr) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
| 	if ip.To4() != nil { | ||||
| 		return addr, true | ||||
| 	if ip.Is4() { | ||||
| 		return addr, nil | ||||
| 	} | ||||
| 	return "[" + addr + "]", true | ||||
| 	return "[" + addr + "]", nil | ||||
| } | ||||
| 
 | ||||
| // parseTarget takes the user input target string and default port, returns | ||||
|  | @ -377,7 +380,7 @@ func parseTarget(target, defaultPort string) (host, port string, err error) { | |||
| 	if target == "" { | ||||
| 		return "", "", internal.ErrMissingAddr | ||||
| 	} | ||||
| 	if ip := net.ParseIP(target); ip != nil { | ||||
| 	if _, err := netip.ParseAddr(target); err == nil { | ||||
| 		// target is an IPv4 or IPv6(without brackets) address | ||||
| 		return target, defaultPort, nil | ||||
| 	} | ||||
|  | @ -425,7 +428,7 @@ func chosenByPercentage(a *int) bool { | |||
| 	if a == nil { | ||||
| 		return true | ||||
| 	} | ||||
| 	return rand.Intn(100)+1 <= *a | ||||
| 	return rand.IntN(100)+1 <= *a | ||||
| } | ||||
| 
 | ||||
| func canaryingSC(js string) string { | ||||
|  |  | |||
							
								
								
									
										2
									
								
								vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -55,7 +55,7 @@ func (r *passthroughResolver) start() { | |||
| 	r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint()}}}) | ||||
| } | ||||
| 
 | ||||
| func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} | ||||
| func (*passthroughResolver) ResolveNow(resolver.ResolveNowOptions) {} | ||||
| 
 | ||||
| func (*passthroughResolver) Close() {} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue