# File lib/new_relic/agent/transaction/abstract_segment.rb, line 23
        def finish
          @end_time = Time.now
          @duration = end_time.to_f - start_time.to_f
          @exclusive_duration = duration - children_time
          if transaction
            record_metrics if record_metrics?
            segment_complete
            transaction.segment_complete self
          end
        rescue => e
          # This rescue block was added for the benefit of this test:
          # test/multiverse/suites/bare/standalone_instrumentation_test.rb
          # See the top of the test for details.
          NewRelic::Agent.logger.error "Exception finishing segment: #{name}", e
        end