mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:42:24 -05:00 
			
		
		
		
	[feature] Support OTLP HTTP, drop Jaeger (#2184)
* [feature] Add http trace exporter, drop Jaeger Jaeger supports ingesting traces using the OpenTelemetry gRPC or HTTP methods. The Jaeger project has deprecated the old jaeger transport. * Add support for submitting traces over HTTP * Drop support for the old Jaeger protocol * Upgrade the trace libraries to v1.17 Fixes: #2176 Fixes: #2179
This commit is contained in:
		
					parent
					
						
							
								916c6d07ba
							
						
					
				
			
			
				commit
				
					
						14ef098099
					
				
			
		
					 199 changed files with 12972 additions and 18581 deletions
				
			
		
							
								
								
									
										75
									
								
								vendor/google.golang.org/grpc/service_config.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										75
									
								
								vendor/google.golang.org/grpc/service_config.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -23,8 +23,6 @@ import ( | |||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"reflect" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"google.golang.org/grpc/codes" | ||||
|  | @ -106,8 +104,8 @@ type healthCheckConfig struct { | |||
| 
 | ||||
| type jsonRetryPolicy struct { | ||||
| 	MaxAttempts          int | ||||
| 	InitialBackoff       string | ||||
| 	MaxBackoff           string | ||||
| 	InitialBackoff       internalserviceconfig.Duration | ||||
| 	MaxBackoff           internalserviceconfig.Duration | ||||
| 	BackoffMultiplier    float64 | ||||
| 	RetryableStatusCodes []codes.Code | ||||
| } | ||||
|  | @ -129,50 +127,6 @@ type retryThrottlingPolicy struct { | |||
| 	TokenRatio float64 | ||||
| } | ||||
| 
 | ||||
| func parseDuration(s *string) (*time.Duration, error) { | ||||
| 	if s == nil { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| 	if !strings.HasSuffix(*s, "s") { | ||||
| 		return nil, fmt.Errorf("malformed duration %q", *s) | ||||
| 	} | ||||
| 	ss := strings.SplitN((*s)[:len(*s)-1], ".", 3) | ||||
| 	if len(ss) > 2 { | ||||
| 		return nil, fmt.Errorf("malformed duration %q", *s) | ||||
| 	} | ||||
| 	// hasDigits is set if either the whole or fractional part of the number is | ||||
| 	// present, since both are optional but one is required. | ||||
| 	hasDigits := false | ||||
| 	var d time.Duration | ||||
| 	if len(ss[0]) > 0 { | ||||
| 		i, err := strconv.ParseInt(ss[0], 10, 32) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("malformed duration %q: %v", *s, err) | ||||
| 		} | ||||
| 		d = time.Duration(i) * time.Second | ||||
| 		hasDigits = true | ||||
| 	} | ||||
| 	if len(ss) == 2 && len(ss[1]) > 0 { | ||||
| 		if len(ss[1]) > 9 { | ||||
| 			return nil, fmt.Errorf("malformed duration %q", *s) | ||||
| 		} | ||||
| 		f, err := strconv.ParseInt(ss[1], 10, 64) | ||||
| 		if err != nil { | ||||
| 			return nil, fmt.Errorf("malformed duration %q: %v", *s, err) | ||||
| 		} | ||||
| 		for i := 9; i > len(ss[1]); i-- { | ||||
| 			f *= 10 | ||||
| 		} | ||||
| 		d += time.Duration(f) | ||||
| 		hasDigits = true | ||||
| 	} | ||||
| 	if !hasDigits { | ||||
| 		return nil, fmt.Errorf("malformed duration %q", *s) | ||||
| 	} | ||||
| 
 | ||||
| 	return &d, nil | ||||
| } | ||||
| 
 | ||||
| type jsonName struct { | ||||
| 	Service string | ||||
| 	Method  string | ||||
|  | @ -201,7 +155,7 @@ func (j jsonName) generatePath() (string, error) { | |||
| type jsonMC struct { | ||||
| 	Name                    *[]jsonName | ||||
| 	WaitForReady            *bool | ||||
| 	Timeout                 *string | ||||
| 	Timeout                 *internalserviceconfig.Duration | ||||
| 	MaxRequestMessageBytes  *int64 | ||||
| 	MaxResponseMessageBytes *int64 | ||||
| 	RetryPolicy             *jsonRetryPolicy | ||||
|  | @ -252,15 +206,10 @@ func parseServiceConfig(js string) *serviceconfig.ParseResult { | |||
| 		if m.Name == nil { | ||||
| 			continue | ||||
| 		} | ||||
| 		d, err := parseDuration(m.Timeout) | ||||
| 		if err != nil { | ||||
| 			logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) | ||||
| 			return &serviceconfig.ParseResult{Err: err} | ||||
| 		} | ||||
| 
 | ||||
| 		mc := MethodConfig{ | ||||
| 			WaitForReady: m.WaitForReady, | ||||
| 			Timeout:      d, | ||||
| 			Timeout:      (*time.Duration)(m.Timeout), | ||||
| 		} | ||||
| 		if mc.RetryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { | ||||
| 			logger.Warningf("grpc: unmarshaling service config %s: %v", js, err) | ||||
|  | @ -312,18 +261,10 @@ func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPol | |||
| 	if jrp == nil { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| 	ib, err := parseDuration(&jrp.InitialBackoff) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	mb, err := parseDuration(&jrp.MaxBackoff) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	if jrp.MaxAttempts <= 1 || | ||||
| 		*ib <= 0 || | ||||
| 		*mb <= 0 || | ||||
| 		jrp.InitialBackoff <= 0 || | ||||
| 		jrp.MaxBackoff <= 0 || | ||||
| 		jrp.BackoffMultiplier <= 0 || | ||||
| 		len(jrp.RetryableStatusCodes) == 0 { | ||||
| 		logger.Warningf("grpc: ignoring retry policy %v due to illegal configuration", jrp) | ||||
|  | @ -332,8 +273,8 @@ func convertRetryPolicy(jrp *jsonRetryPolicy) (p *internalserviceconfig.RetryPol | |||
| 
 | ||||
| 	rp := &internalserviceconfig.RetryPolicy{ | ||||
| 		MaxAttempts:          jrp.MaxAttempts, | ||||
| 		InitialBackoff:       *ib, | ||||
| 		MaxBackoff:           *mb, | ||||
| 		InitialBackoff:       time.Duration(jrp.InitialBackoff), | ||||
| 		MaxBackoff:           time.Duration(jrp.MaxBackoff), | ||||
| 		BackoffMultiplier:    jrp.BackoffMultiplier, | ||||
| 		RetryableStatusCodes: make(map[codes.Code]bool), | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue