private void MergeComponentProperties(LdValue.ObjectBuilder builder, object component,
                                              string defaultPropertyName)
        {
            if (!(component is IDiagnosticDescription))
            {
                if (!string.IsNullOrEmpty(defaultPropertyName))
                {
                    builder.Add(defaultPropertyName, "custom");
                }
                return;
            }
            var componentDesc = (component as IDiagnosticDescription).DescribeConfiguration(BasicConfig);

            if (!string.IsNullOrEmpty(defaultPropertyName))
            {
                builder.Add(defaultPropertyName, componentDesc.IsString ? componentDesc : LdValue.Of("custom"));
            }
            else if (componentDesc.Type == LdValueType.Object)
            {
                foreach (KeyValuePair <string, LdValue> prop in componentDesc.AsDictionary(LdValue.Convert.Json))
                {
                    builder.Add(prop.Key, prop.Value); // TODO: filter allowable properties
                }
            }
        }
예제 #2
0
 public static LdValue.ObjectBuilder WithEventsDefaults(this LdValue.ObjectBuilder b) =>
 b.Add("allAttributesPrivate", false)
 .Add("customEventsURI", false)
 .Add("diagnosticRecordingIntervalMillis", EventProcessorBuilder.DefaultDiagnosticRecordingInterval.TotalMilliseconds)
 .Add("eventsCapacity", EventProcessorBuilder.DefaultCapacity)
 .Add("eventsFlushIntervalMillis", EventProcessorBuilder.DefaultFlushInterval.TotalMilliseconds)
 .Add("inlineUsersInEvents", false)
 .Add("samplingInterval", 0)
 .Add("userKeysCapacity", EventProcessorBuilder.DefaultUserKeysCapacity)
 .Add("userKeysFlushIntervalMillis", EventProcessorBuilder.DefaultUserKeysFlushInterval.TotalMilliseconds);
 private void AddDiagnosticCommonFields(LdValue.ObjectBuilder fieldsBuilder, string kind, DateTime creationDate)
 {
     fieldsBuilder.Add("kind", kind);
     fieldsBuilder.Add("id", EncodeDiagnosticId(DiagnosticId));
     fieldsBuilder.Add("creationDate", UnixMillisecondTime.FromDateTime(creationDate).Value);
 }
예제 #4
0
 public static LdValue.ObjectBuilder WithStreamingDefaults(this LdValue.ObjectBuilder b) =>
 b.Add("customBaseURI", false)
 .Add("customStreamURI", false)
 .Add("streamingDisabled", false)
 .Add("reconnectTimeMillis", StreamingDataSourceBuilder.DefaultInitialReconnectDelay.TotalMilliseconds)
 .Add("usingRelayDaemon", false);
예제 #5
0
 public static LdValue.ObjectBuilder WithStoreDefaults(this LdValue.ObjectBuilder b) =>
 b.Add("dataStoreType", "memory");