This is the most common metrics entity definition with the stream annotations.
@MetricsType @StreamData @StorageEntity(name = ServiceRelationClientSideMetrics.INDEX_NAME, builder = ServiceRelationClientSideMetrics.Builder.class, sourceScopeId = DefaultScopeDefine.SERVICE_RELATION) @MetricsType: What model is streaming processing use? Other types are @RecordType, @InventoryType, @TopNType. @StreamData: Register this entity class into the remote module that makes this entity could transfer between OAP server's nodes. @StorageEntity: Identify the storage entity name, builder class for serialization or deserialization this entity between memory and database. Those three annotations look like having clear responsibilities, but if you spend time to reflect on them, you will find that the @XXType's level is higher than others. - @MetricsType and @InventoryType are must include @StreamData and @StorageEntity. - @RecordType and @TopNType are must exclude @StreamData. So, I suggest that let the @StreamData and @StorageEntity to be the parameter of the @XXType. For example: @Stream(name = ServiceRelationClientSideMetrics.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE_RELATION, storage = @Storage(builder = ServiceRelationClientSideMetrics.Builder.class), kind = StreamKind.Metrics) public class ServiceRelationClientSideMetrics extends Metrics {