Copyright 2017, OpenCensus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

package ocgrpc

import (
	

	

	
	
	
)
statsTagRPC gets the metadata from gRPC context, extracts the encoded tags from it and creates a new tag.Map and puts them into the returned context.
func ( *ServerHandler) ( context.Context,  *stats.RPCTagInfo) context.Context {
	 := time.Now()
	if  == nil {
		if grpclog.V(2) {
			grpclog.Infof("opencensus: TagRPC called with nil info.")
		}
		return 
	}
	 := &rpcData{
		startTime: ,
		method:    .FullMethodName,
	}
	 := .extractPropagatedTags()
	 = tag.NewContext(, )
	, _ = tag.New(, tag.Upsert(KeyServerMethod, methodName(.FullMethodName)))
	return context.WithValue(, rpcDataKey, )
}
extractPropagatedTags creates a new tag map containing the tags extracted from the gRPC metadata.
func ( *ServerHandler) ( context.Context) *tag.Map {
	 := stats.Tags()
	if  == nil {
		return nil
	}
	,  := tag.Decode()
	if  != nil {
		if grpclog.V(2) {
			grpclog.Warningf("opencensus: Failed to decode tags from gRPC metadata failed to decode: %v", )
		}
		return nil
	}
	return