<commit_before>// Copyright 2012 Rackspace Hosting, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

(function () {
  var tracers, formatters, zipkinCore_types;
  var Trace, Annotation, Endpoint, Int64;
  var forEach, has, getUniqueId, getNowMicros, getHex64;

  forEach = function(obj, f){
    Array.prototype.forEach.call(obj, f);
  };

  has = function(obj, val){
    return Object.hasOwnProperty.call(obj, val);
  };

	getUniqueId = function () {
		var random = new Int64(Math.random() * 0x80000000, Math.random() * 0x100000000);
		return random.toOctetString();
	};

	/**
	 * Get a hex representation of provided value
	 *
	 * @param {String|number} hex Ex: "0xffffeeeeffefefef", "ffffeeeeffefefef", 12342344543543
	 * NOTE: 0x12342344543543 is NOT a valid input
	 *
	 * @returns {Int64|undefined}
	 */
	getHex64 = function (hex) {
		try {
			return new Int64(hex).toOctetString();
		} catch (e) {
			return undefined;
		}
	};

	/**
	 * Return the current unix epoch timestamp in microseconds
	 * @return {number}
	 */
  getNowMicros = function() {
      return Date.now() * 1000;
  };

  /**
   * A Trace encapsulates information about the current span of this trace
   * and provides a mechanism for creating new child spans and recording
   * annotations for this span. It delegates to zero or more {Tracers} and
   * allows setting a default {Endpoint} to associate with {Annotation}s
   *
   * @param {String} name A string describing this span
   * @param {Hash} options A hash any or all or none of the following
   *    params, for which values will be generated if not provided:
   *
   * @param {Number} options.traceId 64-bit integer identifying this trace
   * @param {Number} options.spanId 64-bit integer identifying this span
   * @param {Number} options.parentSpanId 64-bit integer identifying this trace's
   *     parent span, or undefined.
   * @param {Array} options._tracers Zero or more {Tracers}
   */
  Trace = function(name, options) {
    var self = this;
    self.name = name;

    options = options || {};

    if (options.debug === true) {
      this.debug = true
    }

    ['traceId', 'spanId', 'parentSpanId'].forEach(function(idName) {
      if (has(options, idName) && options[idName] !== null &&
        options[idName] !== undefined) {
        self[idName] = getHex64(options[idName]);
      } else if (idName !== 'parentSpanId') {
        self[idName] = getUniqueId();
      }
    });

    if (has(options, 'tracers') && options.tracers){
      self._tracers = options.tracers;
    } else {
      self._tracers = tracers.getTracers();
    }
  };<commit_msg>fix missing semi-colon<commit_after>// Copyright 2012 Rackspace Hosting, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

(function () {
  var tracers, formatters, zipkinCore_types;
  var Trace, Annotation, Endpoint, Int64;
  var forEach, has, getUniqueId, getNowMicros, getHex64;

  forEach = function(obj, f){
    Array.prototype.forEach.call(obj, f);
  };

  has = function(obj, val){
    return Object.hasOwnProperty.call(obj, val);
  };

	getUniqueId = function () {
		var random = new Int64(Math.random() * 0x80000000, Math.random() * 0x100000000);
		return random.toOctetString();
	};

	/**
	 * Get a hex representation of provided value
	 *
	 * @param {String|number} hex Ex: "0xffffeeeeffefefef", "ffffeeeeffefefef", 12342344543543
	 * NOTE: 0x12342344543543 is NOT a valid input
	 *
	 * @returns {Int64|undefined}
	 */
	getHex64 = function (hex) {
		try {
			return new Int64(hex).toOctetString();
		} catch (e) {
			return undefined;
		}
	};

	/**
	 * Return the current unix epoch timestamp in microseconds
	 * @return {number}
	 */
  getNowMicros = function() {
      return Date.now() * 1000;
  };

  /**
   * A Trace encapsulates information about the current span of this trace
   * and provides a mechanism for creating new child spans and recording
   * annotations for this span. It delegates to zero or more {Tracers} and
   * allows setting a default {Endpoint} to associate with {Annotation}s
   *
   * @param {String} name A string describing this span
   * @param {Hash} options A hash any or all or none of the following
   *    params, for which values will be generated if not provided:
   *
   * @param {Number} options.traceId 64-bit integer identifying this trace
   * @param {Number} options.spanId 64-bit integer identifying this span
   * @param {Number} options.parentSpanId 64-bit integer identifying this trace's
   *     parent span, or undefined.
   * @param {Array} options._tracers Zero or more {Tracers}
   */
  Trace = function(name, options) {
    var self = this;
    self.name = name;

    options = options || {};

    if (options.debug === true) {
      this.debug = true;
    }

    ['traceId', 'spanId', 'parentSpanId'].forEach(function(idName) {
      if (has(options, idName) && options[idName] !== null &&
        options[idName] !== undefined) {
        self[idName] = getHex64(options[idName]);
      } else if (idName !== 'parentSpanId') {
        self[idName] = getUniqueId();
      }
    });

    if (has(options, 'tracers') && options.tracers){
      self._tracers = options.tracers;
    } else {
      self._tracers = tracers.getTracers();
    }
  };
{'fraction_non_alphanumeric': 0.11574222507213851, 'fraction_numerical': 0.025969862135299775, 'mean_word_length': 3.2269647696476964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5163237', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1849, 'n_words': 646}