def put_metadata(self, key, value, namespace='default'):
        """
        Add metadata to segment or subsegment. Metadata is not indexed
        but can be later retrieved by BatchGetTraces API.

        :param str namespace: optional. Default namespace is `default`.
            It must be a string and prefix `AWS.` is reserved.
        :param str key: metadata key under specified namespace
        :param object value: any object that can be serialized into JSON string
        """
        self._check_ended()

        if not isinstance(namespace, string_types):
            log.warning("ignoring non string type metadata namespace")
            return

        if namespace.startswith('AWS.'):
            log.warning("Prefix 'AWS.' is reserved, drop metadata with namespace %s", namespace)
            return

        if self.metadata.get(namespace, None):
            self.metadata[namespace][key] = value
        else:
            self.metadata[namespace] = {key: value}
def put_metadata ( self , key , value , namespace = 'default' ) : self . _check_ended ( ) if not isinstance ( namespace , string_types ) : log . warning ( "ignoring non string type metadata namespace" ) return if namespace . startswith ( 'AWS.' ) : log . warning ( "Prefix 'AWS.' is reserved, drop metadata with namespace %s" , namespace ) return if self . metadata . get ( namespace , None ) : self . metadata [ namespace ] [ key ] = value else : self . metadata [ namespace ] = { key : value }
Add metadata to segment or subsegment. Metadata is not indexed
        but can be later retrieved by BatchGetTraces API.

        :param str namespace: optional. Default namespace is `default`.
            It must be a string and prefix `AWS.` is reserved.
        :param str key: metadata key under specified namespace
        :param object value: any object that can be serialized into JSON string