MCPcopy
hub / github.com/grpc/grpc-go / Get

Method Get

stats/opentelemetry/internal/tracing/carrier.go:52–58  ·  view source on GitHub ↗

Get returns the string value associated with the passed key from the carrier's incoming context metadata. It returns an empty string if the key is not present in the carrier's context or if the value associated with the key is empty. If multiple values are present for a key, it returns the last on

(key string)

Source from the content-addressed store, hash-verified

50//
51// If multiple values are present for a key, it returns the last one.
52func (c *IncomingCarrier) Get(key string) string {
53 values := metadata.ValueFromIncomingContext(c.ctx, key)
54 if len(values) == 0 {
55 return ""
56 }
57 return values[len(values)-1]
58}
59
60// Set just logs an error. It implements the `TextMapCarrier` interface but
61// should not be used with `IncomingCarrier`.

Callers 1

TestIncomingCarrierMethod · 0.95

Calls 1

ValueFromIncomingContextFunction · 0.92

Tested by 1

TestIncomingCarrierMethod · 0.76