@@ -14,13 +14,13 @@ namespace Datadog.Tracer
 
         public UInt64 SpanId { get; }
 
-        // TODO:bertrand do we really want ServiceName to be mutable?
-        public string ServiceName { get; set; }
+        public string ServiceName { get; }
 
         public ITraceContext TraceContext { get; }
 
-        public SpanContext(ITraceContext traceContext)
+        public SpanContext(ITraceContext traceContext, string serviceName)
         {
+            ServiceName = serviceName;
             // TODO:bertrand pool the random objects
             Random r = new Random();
             var parent = traceContext.GetCurrentSpanContext();
﻿using OpenTracing;
using System;
using System.Collections.Generic;

namespace Datadog.Tracer
{
    internal class SpanContext : ISpanContext
    {
        public SpanContext Parent { get; }

        public UInt64 TraceId { get; }

        public UInt64? ParentId { get { return Parent?.SpanId; } }

        public UInt64 SpanId { get; }

        // TODO:bertrand do we really want ServiceName to be mutable?
        public string ServiceName { get; set; }

        public ITraceContext TraceContext { get; }

        public SpanContext(ITraceContext traceContext)
        {
            // TODO:bertrand pool the random objects
            Random r = new Random();
            var parent = traceContext.GetCurrentSpanContext();
            if (parent != null)
            {
                Parent = parent;
                TraceId = parent.TraceId;
                ServiceName = parent.ServiceName;
                TraceContext = parent.TraceContext;
                SpanId = r.NextUInt64();
        }
            else
            {
                TraceId = r.NextUInt64();
                SpanId = r.NextUInt64();
                TraceContext = traceContext;
            }
        }

        public IEnumerable<KeyValuePair<string, string>> GetBaggageItems()
        {
            throw new NotImplementedException();
        }
    }
}

is `serviceName` required if users are going to do distributed tracing? let's say you retrieve values from a gRPC call and then you want to create a `SpanContext`; do you need to provide the service name? If yes, it could be an issue since in OpenTracing there is no concept of service at the moment and users can't compile their already instrumented app without making changes.