New OAP annotations, they are friendly for streaming loader.#2670
Merged
Conversation
- Inventory annotation example: @stream(name = ServiceInventory.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE_INVENTORY, storage = @Storage(builder = ServiceInventory.Builder.class, deleteHistory = false), kind = StreamKind.Inventory) - Metrics annotation example: @stream(name = ServiceRelationClientSideMetrics.INDEX_NAME, scopeId = DefaultScopeDefine.SERVICE_RELATION, storage = @Storage(builder = ServiceRelationClientSideMetrics.Builder.class), kind = StreamKind.Metrics) - Record annotation example: @stream(name = SegmentRecord.INDEX_NAME, scopeId = DefaultScopeDefine.SEGMENT, storage = @Storage(builder = SegmentRecord.Builder.class), kind = StreamKind.Record) - TopN annotation example: @stream(name = TopNDatabaseStatement.INDEX_NAME, scopeId = DefaultScopeDefine.DATABASE_SLOW_STATEMENT, storage = @Storage(builder = TopNDatabaseStatement.Builder.class), kind = StreamKind.TopN)
wu-sheng
reviewed
May 15, 2019
Member
wu-sheng
left a comment
There was a problem hiding this comment.
The only concern is rename of MODEL_NAME to INDEX_NAME. This is used in different storage implementations. I suggest we don't change that.
Member
Author
This name in inventory entity is different from metrics entity, record entity, topn entity. |
wu-sheng
approved these changes
May 15, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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), processor = MetricsStreamProcessor.class)
public class ServiceRelationClientSideMetrics extends Metrics {
Make those processors connect with the stream annotation directly.