public virtual Response <ConfigurationSetting> Add(ConfigurationSetting setting, CancellationToken cancellationToken = default)
        {
            using ActivityScope scope = new ActivityScope(s_configClientAdd);
            scope.AddTag("key", setting?.Key);

            try
            {
                using Request request = CreateAddRequest(setting);
                Response response = _pipeline.SendRequest(request, cancellationToken);

                switch (response.Status)

                {
                case 200:
                case 201:
                    return(CreateResponse(response));

                default:
                    throw response.CreateRequestFailedException();
                }
            }
            catch (Exception e)
            {
                scope.SetStatus(e);
                throw;
            }
        }
Example #2
0
 public static void DoMagic(Request r)
 {
     using (var scope = new ActivityScope(s_requestActivity, ParseRequestFunc, r))
     {
         try
         {
             // do some work
         }
         catch (Exception e) // hopefully this is a more specific exception type related to the work being done
         {
             scope.SetStatus(e);
         }
     }
 }