Package nablarch.integration.micrometer
Class MeterRegistryFactory<T extends io.micrometer.core.instrument.MeterRegistry>
java.lang.Object
nablarch.integration.micrometer.MeterRegistryFactory<T>
- Type Parameters:
T- サブクラスで生成する具体的なMeterRegistryの型
- All Implemented Interfaces:
ComponentFactory<T>
- Direct Known Subclasses:
CloudWatchMeterRegistryFactory,DatadogMeterRegistryFactory,GlobalMeterRegistryFactory,LoggingMeterRegistryFactory,SimpleMeterRegistryFactory,StatsdMeterRegistryFactory
public abstract class MeterRegistryFactory<T extends io.micrometer.core.instrument.MeterRegistry>
extends Object
implements ComponentFactory<T>
MeterRegistryのコンポーネント生成に共通する処理をまとめた抽象クラス。-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ApplicationDisposer廃棄処理を行うインタフェース。protected MeterBinderListProvider生成したMeterRegistryに適用するMeterBinderリストのプロバイダ。protected String設定値のプレフィックス。すべてのメトリクスに共通で設定するタグ。protected String設定ファイルのパス。 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TcreateMeterRegistry(MicrometerConfiguration micrometerConfiguration) MeterRegistryのインスタンスを生成する。protected TComponentFactory.createObject()の実処理を行うメソッド。voidsetApplicationDisposer(ApplicationDisposer applicationDisposer) ApplicationDisposerを設定する。voidsetMeterBinderListProvider(MeterBinderListProvider meterBinderListProvider) MeterBinderListProviderを設定する。voidプレフィックスを設定する。voidすべてのメトリクスに共通で設定するタグを指定する。voidsetXmlConfigPath(String xmlConfigPath) XML設定ファイルのパスを設定する。Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nablarch.core.repository.di.ComponentFactory
createObject
-
Field Details
-
prefix
設定値のプレフィックス。 -
xmlConfigPath
設定ファイルのパス。未設定の場合に読み込まれるデフォルトのパスについては
MicrometerConfigurationを参照。 -
meterBinderListProvider
生成したMeterRegistryに適用するMeterBinderリストのプロバイダ。 -
tags
すべてのメトリクスに共通で設定するタグ。 -
applicationDisposer
廃棄処理を行うインタフェース。
-
-
Constructor Details
-
MeterRegistryFactory
public MeterRegistryFactory()
-
-
Method Details
-
doCreateObject
ComponentFactory.createObject()の実処理を行うメソッド。サブクラスは、本メソッドを使って
createObject()を次のように実装する。@Override public SimpleMeterRegistry createObject() { return doCreateObject(); }これは、
createObject()の戻り値の型が総称型だった場合、 DIコンテナがコンポーネントの具象型を特定できないことに起因する。
この問題は、上述のようにサブクラスでcreateObject()の戻り値の型を具象型として宣言することで回避できる。
一方で、コンポーネントを作成するロジック自体はどのMeterRegistryでも共通なので、 コンポーネント作成処理を共通化するために、このメソッドが用意されている。- Returns:
- 作成された
MeterRegistryオブジェクト
-
createMeterRegistry
MeterRegistryのインスタンスを生成する。- Parameters:
micrometerConfiguration- Micrometerの設定- Returns:
- 生成した
MeterRegistryのインスタンス
-
setPrefix
プレフィックスを設定する。- Parameters:
prefix- プレフィックス
-
setXmlConfigPath
XML設定ファイルのパスを設定する。- Parameters:
xmlConfigPath- XML設定ファイルのパス
-
setMeterBinderListProvider
MeterBinderListProviderを設定する。- Parameters:
meterBinderListProvider-MeterBinderListProvider
-
setTags
すべてのメトリクスに共通で設定するタグを指定する。- Parameters:
tags- すべてのメトリクスに共通で設定するタグ
-
setApplicationDisposer
ApplicationDisposerを設定する。- Parameters:
applicationDisposer-ApplicationDisposer
-