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);
    }