<commit_before>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Thrift;

namespace Medidata.ZipkinTracer.Core.Collector
{
    public class SpanCollector
    {
        private const int MAX_QUEUE_SIZE = 100;
        internal static BlockingCollection<Span> spanQueue;

        internal SpanProcessor spanProcessor;
        internal IClientProvider clientProvider;

        public SpanCollector(IClientProvider clientProvider, int maxProcessorBatchSize)
        {
            if ( spanQueue == null)
            {
                spanQueue = new BlockingCollection<Span>(MAX_QUEUE_SIZE);
            }

            this.clientProvider = clientProvider;

            try
            {
                clientProvider.Setup();
            }
            catch (TException tEx)
            {
                clientProvider.Close();
                throw tEx;
            }
            
            spanProcessor = new SpanProcessor(spanQueue, clientProvider, maxProcessorBatchSize);
        }

        public virtual void Collect(Span span)
        {
            spanQueue.Add(span);
        }

        public virtual void Start()
        {
            spanProcessor.Start();
        }

        public virtual void Stop()
        {
            spanProcessor.Stop();
            clientProvider.Close();
        }
    }
}<commit_msg>remove call out of collector ctor<commit_after>﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Thrift;

namespace Medidata.ZipkinTracer.Core.Collector
{
    public class SpanCollector
    {
        private const int MAX_QUEUE_SIZE = 100;
        internal static BlockingCollection<Span> spanQueue;

        internal SpanProcessor spanProcessor;
        internal IClientProvider clientProvider;

        public SpanCollector(IClientProvider clientProvider, int maxProcessorBatchSize)
        {
            if ( spanQueue == null)
            {
                spanQueue = new BlockingCollection<Span>(MAX_QUEUE_SIZE);
            }

            this.clientProvider = clientProvider;
            
            spanProcessor = new SpanProcessor(spanQueue, clientProvider, maxProcessorBatchSize);
        }

        public virtual void Collect(Span span)
        {
            spanQueue.Add(span);
        }

        public virtual void Start()
        {
            spanProcessor.Start();
        }

        public virtual void Stop()
        {
            spanProcessor.Stop();
            clientProvider.Close();
        }
    }
}
{'fraction_non_alphanumeric': 0.07065420560747664, 'fraction_numerical': 0.0022429906542056075, 'mean_word_length': 1.9182115594329334, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1369029', 'n_tokens_mistral': 666, 'n_tokens_neox': 651, 'n_words': 151}