mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 01:02:25 -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
				
			
		
							
								
								
									
										62
									
								
								vendor/google.golang.org/grpc/stream.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										62
									
								
								vendor/google.golang.org/grpc/stream.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -23,7 +23,7 @@ import ( | |||
| 	"errors" | ||||
| 	"io" | ||||
| 	"math" | ||||
| 	"math/rand" | ||||
| 	rand "math/rand/v2" | ||||
| 	"strconv" | ||||
| 	"sync" | ||||
| 	"time" | ||||
|  | @ -113,7 +113,9 @@ type ClientStream interface { | |||
| 	// SendMsg is generally called by generated code. On error, SendMsg aborts | ||||
| 	// the stream. If the error was generated by the client, the status is | ||||
| 	// returned directly; otherwise, io.EOF is returned and the status of | ||||
| 	// the stream may be discovered using RecvMsg. | ||||
| 	// the stream may be discovered using RecvMsg. For unary or server-streaming | ||||
| 	// RPCs (StreamDesc.ClientStreams is false), a nil error is returned | ||||
| 	// unconditionally. | ||||
| 	// | ||||
| 	// SendMsg blocks until: | ||||
| 	//   - There is sufficient flow control to schedule m with the transport, or | ||||
|  | @ -216,7 +218,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth | |||
| 
 | ||||
| 	var mc serviceconfig.MethodConfig | ||||
| 	var onCommit func() | ||||
| 	var newStream = func(ctx context.Context, done func()) (iresolver.ClientStream, error) { | ||||
| 	newStream := func(ctx context.Context, done func()) (iresolver.ClientStream, error) { | ||||
| 		return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, done, opts...) | ||||
| 	} | ||||
| 
 | ||||
|  | @ -584,7 +586,7 @@ type csAttempt struct { | |||
| 	ctx        context.Context | ||||
| 	cs         *clientStream | ||||
| 	t          transport.ClientTransport | ||||
| 	s          *transport.Stream | ||||
| 	s          *transport.ClientStream | ||||
| 	p          *parser | ||||
| 	pickResult balancer.PickResult | ||||
| 
 | ||||
|  | @ -706,11 +708,10 @@ func (a *csAttempt) shouldRetry(err error) (bool, error) { | |||
| 		cs.numRetriesSincePushback = 0 | ||||
| 	} else { | ||||
| 		fact := math.Pow(rp.BackoffMultiplier, float64(cs.numRetriesSincePushback)) | ||||
| 		cur := float64(rp.InitialBackoff) * fact | ||||
| 		if max := float64(rp.MaxBackoff); cur > max { | ||||
| 			cur = max | ||||
| 		} | ||||
| 		dur = time.Duration(rand.Int63n(int64(cur))) | ||||
| 		cur := min(float64(rp.InitialBackoff)*fact, float64(rp.MaxBackoff)) | ||||
| 		// Apply jitter by multiplying with a random factor between 0.8 and 1.2 | ||||
| 		cur *= 0.8 + 0.4*rand.Float64() | ||||
| 		dur = time.Duration(int64(cur)) | ||||
| 		cs.numRetriesSincePushback++ | ||||
| 	} | ||||
| 
 | ||||
|  | @ -991,7 +992,7 @@ func (cs *clientStream) CloseSend() error { | |||
| 	} | ||||
| 	cs.sentLast = true | ||||
| 	op := func(a *csAttempt) error { | ||||
| 		a.t.Write(a.s, nil, nil, &transport.Options{Last: true}) | ||||
| 		a.s.Write(nil, nil, &transport.WriteOptions{Last: true}) | ||||
| 		// Always return nil; io.EOF is the only error that might make sense | ||||
| 		// instead, but there is no need to signal the client to call RecvMsg | ||||
| 		// as the only use left for the stream after CloseSend is to call | ||||
|  | @ -1083,7 +1084,7 @@ func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength | |||
| 		} | ||||
| 		a.mu.Unlock() | ||||
| 	} | ||||
| 	if err := a.t.Write(a.s, hdr, payld, &transport.Options{Last: !cs.desc.ClientStreams}); err != nil { | ||||
| 	if err := a.s.Write(hdr, payld, &transport.WriteOptions{Last: !cs.desc.ClientStreams}); err != nil { | ||||
| 		if !cs.desc.ClientStreams { | ||||
| 			// For non-client-streaming RPCs, we return nil instead of EOF on error | ||||
| 			// because the generated code requires it.  finish is not called; RecvMsg() | ||||
|  | @ -1097,9 +1098,6 @@ func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength | |||
| 			sh.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now())) | ||||
| 		} | ||||
| 	} | ||||
| 	if channelz.IsOn() { | ||||
| 		a.t.IncrMsgSent() | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
|  | @ -1153,9 +1151,6 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { | |||
| 			Length:           payInfo.uncompressedBytes.Len(), | ||||
| 		}) | ||||
| 	} | ||||
| 	if channelz.IsOn() { | ||||
| 		a.t.IncrMsgRecv() | ||||
| 	} | ||||
| 	if cs.desc.ServerStreams { | ||||
| 		// Subsequent messages should be received by subsequent RecvMsg calls. | ||||
| 		return nil | ||||
|  | @ -1183,7 +1178,7 @@ func (a *csAttempt) finish(err error) { | |||
| 	} | ||||
| 	var tr metadata.MD | ||||
| 	if a.s != nil { | ||||
| 		a.t.CloseStream(a.s, err) | ||||
| 		a.s.Close(err) | ||||
| 		tr = a.s.Trailer() | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1340,7 +1335,7 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin | |||
| } | ||||
| 
 | ||||
| type addrConnStream struct { | ||||
| 	s         *transport.Stream | ||||
| 	s         *transport.ClientStream | ||||
| 	ac        *addrConn | ||||
| 	callHdr   *transport.CallHdr | ||||
| 	cancel    context.CancelFunc | ||||
|  | @ -1380,7 +1375,7 @@ func (as *addrConnStream) CloseSend() error { | |||
| 	} | ||||
| 	as.sentLast = true | ||||
| 
 | ||||
| 	as.t.Write(as.s, nil, nil, &transport.Options{Last: true}) | ||||
| 	as.s.Write(nil, nil, &transport.WriteOptions{Last: true}) | ||||
| 	// Always return nil; io.EOF is the only error that might make sense | ||||
| 	// instead, but there is no need to signal the client to call RecvMsg | ||||
| 	// as the only use left for the stream after CloseSend is to call | ||||
|  | @ -1430,7 +1425,7 @@ func (as *addrConnStream) SendMsg(m any) (err error) { | |||
| 		return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payload.Len(), *as.callInfo.maxSendMessageSize) | ||||
| 	} | ||||
| 
 | ||||
| 	if err := as.t.Write(as.s, hdr, payload, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { | ||||
| 	if err := as.s.Write(hdr, payload, &transport.WriteOptions{Last: !as.desc.ClientStreams}); err != nil { | ||||
| 		if !as.desc.ClientStreams { | ||||
| 			// For non-client-streaming RPCs, we return nil instead of EOF on error | ||||
| 			// because the generated code requires it.  finish is not called; RecvMsg() | ||||
|  | @ -1440,9 +1435,6 @@ func (as *addrConnStream) SendMsg(m any) (err error) { | |||
| 		return io.EOF | ||||
| 	} | ||||
| 
 | ||||
| 	if channelz.IsOn() { | ||||
| 		as.t.IncrMsgSent() | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
|  | @ -1480,9 +1472,6 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { | |||
| 		return toRPCErr(err) | ||||
| 	} | ||||
| 
 | ||||
| 	if channelz.IsOn() { | ||||
| 		as.t.IncrMsgRecv() | ||||
| 	} | ||||
| 	if as.desc.ServerStreams { | ||||
| 		// Subsequent messages should be received by subsequent RecvMsg calls. | ||||
| 		return nil | ||||
|  | @ -1510,7 +1499,7 @@ func (as *addrConnStream) finish(err error) { | |||
| 		err = nil | ||||
| 	} | ||||
| 	if as.s != nil { | ||||
| 		as.t.CloseStream(as.s, err) | ||||
| 		as.s.Close(err) | ||||
| 	} | ||||
| 
 | ||||
| 	if err != nil { | ||||
|  | @ -1577,8 +1566,7 @@ type ServerStream interface { | |||
| // serverStream implements a server side Stream. | ||||
| type serverStream struct { | ||||
| 	ctx   context.Context | ||||
| 	t     transport.ServerTransport | ||||
| 	s     *transport.Stream | ||||
| 	s     *transport.ServerStream | ||||
| 	p     *parser | ||||
| 	codec baseCodec | ||||
| 
 | ||||
|  | @ -1628,7 +1616,7 @@ func (ss *serverStream) SendHeader(md metadata.MD) error { | |||
| 		return status.Error(codes.Internal, err.Error()) | ||||
| 	} | ||||
| 
 | ||||
| 	err = ss.t.WriteHeader(ss.s, md) | ||||
| 	err = ss.s.SendHeader(md) | ||||
| 	if len(ss.binlogs) != 0 && !ss.serverHeaderBinlogged { | ||||
| 		h, _ := ss.s.Header() | ||||
| 		sh := &binarylog.ServerHeader{ | ||||
|  | @ -1668,7 +1656,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { | |||
| 		} | ||||
| 		if err != nil && err != io.EOF { | ||||
| 			st, _ := status.FromError(toRPCErr(err)) | ||||
| 			ss.t.WriteStatus(ss.s, st) | ||||
| 			ss.s.WriteStatus(st) | ||||
| 			// Non-user specified status was sent out. This should be an error | ||||
| 			// case (as a server side Cancel maybe). | ||||
| 			// | ||||
|  | @ -1676,9 +1664,6 @@ func (ss *serverStream) SendMsg(m any) (err error) { | |||
| 			// status from the service handler, we will log that error instead. | ||||
| 			// This behavior is similar to an interceptor. | ||||
| 		} | ||||
| 		if channelz.IsOn() && err == nil { | ||||
| 			ss.t.IncrMsgSent() | ||||
| 		} | ||||
| 	}() | ||||
| 
 | ||||
| 	// Server handler could have set new compressor by calling SetSendCompressor. | ||||
|  | @ -1710,7 +1695,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { | |||
| 	if payloadLen > ss.maxSendMessageSize { | ||||
| 		return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payloadLen, ss.maxSendMessageSize) | ||||
| 	} | ||||
| 	if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { | ||||
| 	if err := ss.s.Write(hdr, payload, &transport.WriteOptions{Last: false}); err != nil { | ||||
| 		return toRPCErr(err) | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1756,7 +1741,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) { | |||
| 		} | ||||
| 		if err != nil && err != io.EOF { | ||||
| 			st, _ := status.FromError(toRPCErr(err)) | ||||
| 			ss.t.WriteStatus(ss.s, st) | ||||
| 			ss.s.WriteStatus(st) | ||||
| 			// Non-user specified status was sent out. This should be an error | ||||
| 			// case (as a server side Cancel maybe). | ||||
| 			// | ||||
|  | @ -1764,9 +1749,6 @@ func (ss *serverStream) RecvMsg(m any) (err error) { | |||
| 			// status from the service handler, we will log that error instead. | ||||
| 			// This behavior is similar to an interceptor. | ||||
| 		} | ||||
| 		if channelz.IsOn() && err == nil { | ||||
| 			ss.t.IncrMsgRecv() | ||||
| 		} | ||||
| 	}() | ||||
| 	var payInfo *payloadInfo | ||||
| 	if len(ss.statsHandler) != 0 || len(ss.binlogs) != 0 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue