src/Orleans.Core/Configuration/TelemetryConfiguration.cs
/// <summary>
/// Adds a new telemetry consumer configuration.
/// </summary>
/// <param name="typeName">The consumer type name.</param>
/// <param name="assemblyName">The consumer assembly name.</param>
/// <param name="properties">The key-value pair configuration properties for the consumer.</param>
/// <exception cref="TypeLoadException">The specified type could not be loaded.</exception>
/// <exception cref="InvalidOperationException">The telemetry consumer type does not implement <see cref="ITelemetryConsumer"/>.</exception>
Adds a new telemetry consumer configuration.
Adds a new telemetry consumer configuration .
public void Add(string typeName, string assemblyName, IEnumerable<KeyValuePair<string, object>> properties)
        {
            Assembly assembly = null;
            try
            {
                var assemblyRef = new AssemblyName(assemblyName);
                assembly = Assembly.Load(assemblyRef);
            }
            catch (Exception exc)
            {
                throw new TypeLoadException($"Cannot load TelemetryConsumer class {typeName} from assembly {assembly?.FullName ?? assemblyName} - Error={exc}");
            }
            var pluginType = assembly.GetType(typeName);
            if (pluginType == null) throw new TypeLoadException($"Cannot locate plugin class {typeName} in assembly {assembly.FullName}");
            if (!typeof(ITelemetryConsumer).IsAssignableFrom(pluginType)) throw new InvalidOperationException($"Telemetry consumer class {typeName} must implement one of {nameof(ITelemetryConsumer)} based interfaces");
            var extendedProperties = properties?.ToDictionary(x => x.Key, x => x.Value);
            Consumers.Add(new ConsumerConfiguration { ConsumerType = pluginType, Properties = extendedProperties });
        }
public void Add ( string typeName , string assemblyName , IEnumerable < KeyValuePair < string , object > > properties ) { Assembly assembly = null ; try { var assemblyRef = new AssemblyName ( assemblyName ) ; assembly = Assembly . Load ( assemblyRef ) ; } catch ( Exception exc ) { throw new TypeLoadException ( $" Cannot load TelemetryConsumer class  { typeName }  from assembly  { assembly ? . FullName ?? assemblyName }  - Error= { exc } " ) ; } var pluginType = assembly . GetType ( typeName ) ; if ( pluginType == null ) throw new TypeLoadException ( $" Cannot locate plugin class  { typeName }  in assembly  { assembly . FullName } " ) ; if ( ! typeof ( ITelemetryConsumer ) . IsAssignableFrom ( pluginType ) ) throw new InvalidOperationException ( $" Telemetry consumer class  { typeName }  must implement one of  { nameof ( ITelemetryConsumer ) }  based interfaces " ) ; var extendedProperties = properties ? . ToDictionary ( x => x . Key , x => x . Value ) ; Consumers . Add ( new ConsumerConfiguration { ConsumerType = pluginType , Properties = extendedProperties } ) ; }
Adds a new telemetry consumer configuration.
Adds a new telemetry consumer configuration .
The specified type could not be loaded.
The specified type could not be loaded .
The telemetry consumer type does not implement .
The telemetry consumer type does not implement .
typeName
string
The consumer type name.
The consumer type name .
assemblyName
string
The consumer assembly name.
The consumer assembly name .
properties
IEnumerable<KeyValuePair<string, object>>
The key-value pair configuration properties for the consumer.
The key - value pair configuration properties for the consumer .