blob: 611abd5b316a739ede8ec602f8f06930def246bf [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
using Org.Apache.REEF.Common.Metrics.Api;
using Org.Apache.REEF.Tang.Formats;
using Org.Apache.REEF.Tang.Util;
using Org.Apache.REEF.Utilities.Attributes;
namespace Org.Apache.REEF.Common.Metrics.MutableMetricsLayer
{
/// <summary>
/// This configuration module defines configuration for <see cref="DefaultMetricsSourceImpl"/>.
/// </summary>
[Unstable("0.16", "Contract may change.")]
public sealed class DefaultMetricsSourceConfiguration : ConfigurationModuleBuilder
{
/// <summary>
/// Id of task or context the source is part of.
/// </summary>
public static readonly RequiredParameter<string> TaskOrContextId = new RequiredParameter<string>();
/// <summary>
/// Id of the evaluator.
/// </summary>
public static readonly RequiredParameter<string> EvaluatorId = new RequiredParameter<string>();
/// <summary>
/// Context of the source (for example VM, ML etc.).
/// </summary>
public static readonly RequiredParameter<string> SourceContext = new RequiredParameter<string>();
/// <summary>
/// Id of the records generated by source.
/// </summary>
public static readonly RequiredParameter<string> RecordId = new RequiredParameter<string>();
/// <summary>
/// This configuration module set see<see cref="IMetricsSource"/> as <see cref="DefaultMetricsSourceImpl"/>
/// </summary>
public static ConfigurationModule ConfigurationModule = new DefaultMetricsSourceConfiguration()
.BindImplementation(GenericType<IMetricsSource>.Class, GenericType<DefaultMetricsSourceImpl>.Class)
.BindNamedParameter(GenericType<DefaultMetricsSourceParameters.ContextOrTaskName>.Class, TaskOrContextId)
.BindNamedParameter(GenericType<DefaultMetricsSourceParameters.EvaluatorId>.Class, EvaluatorId)
.BindNamedParameter(GenericType<DefaultMetricsSourceParameters.SourceContext>.Class, SourceContext)
.BindNamedParameter(GenericType<DefaultMetricsSourceParameters.RecordName>.Class, RecordId)
.Build();
}
}