public function record(Context $ctx = null, TagContext $tags = null): bool
    {
        // without measurements we can bail out immediately
        if (count($this->measurements) === 0) {
            return true;
        }

        if ($ctx === null) {
            $ctx = Context::current();
        }
        // clone TagContext as found in Context so it isn't mutated by us adding
        // the record time only Tags as found in the provided $tags.
        $recordTags = clone TagContext::fromContext($ctx);
        if ($tags !== null) {
            foreach ($tags->tags() as &$tag) {
                $recordTags->upsert($tag->getKey(), $tag->getValue());
            }
        }

        return Stats::getExporter()->recordStats($recordTags, $this->attachments, ...$this->measurements);
    }
public function record(Context $ctx = null, TagContext $tags = null): bool
    {
        // without measurements we can bail out immediately
        if (count($this->measurements) === 0) {
            return true;
        }

        if ($ctx === null) {
            $ctx = Context::current();
        }
        // clone TagContext as found in Context so it isn't mutated by us adding
        // the record time only Tags as found in the provided $tags.
        $recordTags = clone TagContext::fromContext($ctx);
        if ($tags !== null) {
            foreach ($tags->tags() as &$tag) {
                $recordTags->upsert($tag->getKey(), $tag->getValue());
            }
        }

        return Stats::getExporter()->recordStats($recordTags, $this->attachments, ...$this->measurements);
    }
public function record ( Context $ ctx = null , TagContext $ tags = null ) : bool { // without measurements we can bail out immediately if ( count ( $ this -> measurements ) === 0 ) { return true ; } if ( $ ctx === null ) { $ ctx = Context :: current ( ) ; } // clone TagContext as found in Context so it isn't mutated by us adding // the record time only Tags as found in the provided $tags. $ recordTags = clone TagContext :: fromContext ( $ ctx ) ; if ( $ tags !== null ) { foreach ( $ tags -> tags ( ) as & $ tag ) { $ recordTags -> upsert ( $ tag -> getKey ( ) , $ tag -> getValue ( ) ) ; } } return Stats :: getExporter ( ) -> recordStats ( $ recordTags , $ this -> attachments , ... $ this -> measurements ) ; }
Record the Measurements, Attachments and Tags found in the map.
If Context is not explicitly provided, the current Context is used.
If a TagContext object is explicitly provided, all tags found are
inserted into the TagContext object found in Context. If a Tag with the
same key already exists in the implicit TagContext object, the explicit
Tag key value pair is used.

@param Context $ctx The Explicit Context object to use. Defaults to current Context.
@param TagContext $tags The TagContext of Tags to add to the recorded Measurements.
@return bool Returns true on success.
Record the Measurements Attachments and Tags found in the map . If Context is not explicitly provided the current Context is used . If a TagContext object is explicitly provided all tags found are inserted into the TagContext object found in Context . If a Tag with the same key already exists in the implicit TagContext object the explicit Tag key value pair is used .