You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: identity.rb
    path of file: ./repos/dd-trace-rb/lib/datadog/core/environment
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'securerandom'

require_relative 'ext'
require_relative '../utils/forking'

module Datadog
  module Core
    module Environment
      # For runtime i
    
        def tracer_version_semver2
          major, minor, patch, rest = tracer_version.split('.', 4)

          semver = "#{major}.#{minor}.#{patch}"

          return semver unless rest

          pre = ''
          build = ''

          rest.split('.').tap do |segments|
            if segments.length >= 4
              pre   = "-#{segments.shift}"
              build = "+#{segments.join('.')}"
            elsif segments.length == 1
              pre = "-#{segments.shift}"
            else
              build = "+#{segments.join('.')}"
            end
          end