-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GG-37994 Task event can record attributes. #2994
Open
antkr
wants to merge
14
commits into
master
Choose a base branch
from
GG-37994
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2032557
GG-37994 Task event can record attributes.
antkr 682c675
GG-37994 added test.
antkr e64cdd9
GG-37994 compilation fix.
antkr 35533a2
GG-37794 checkstyle.
antkr c3b68eb
GG-37994 review fixes.
antkr a0878fe
GG-37994 fixed test.
antkr 924e7af
GG-37994 wip
tkalkirill 148b598
GG-37994 reworked event to use IgniteFeature to avoid serialization i…
antkr 069aaab
Revert file remove
antkr d37b2f2
GG-37994 fixed.
antkr ce52bae
GG-37994 fix call to attributes if full support is not enabled.
antkr 579189f
GG-37994 missed unused import.
antkr b5c05bb
GG-37994 javadoc fixed.
antkr 427a57f
GG-37994 javadoc removed.
antkr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
103 changes: 103 additions & 0 deletions
103
modules/core/src/main/java/org/apache/ignite/events/TaskEventV2.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright 2019 GridGain Systems, Inc. and Contributors. | ||
* | ||
* Licensed under the GridGain Community Edition License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license | ||
* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.ignite.events; | ||
|
||
import org.apache.ignite.cluster.ClusterNode; | ||
import org.apache.ignite.internal.util.typedef.internal.S; | ||
import org.apache.ignite.internal.util.typedef.internal.U; | ||
import org.apache.ignite.lang.IgniteUuid; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
/** | ||
* Grid task event. | ||
* <p> | ||
* Grid events are used for notification about what happens within the grid. Note that by | ||
* design Ignite keeps all events generated on the local node locally and it provides | ||
* APIs for performing a distributed queries across multiple nodes: | ||
* <ul> | ||
* <li> | ||
* {@link org.apache.ignite.IgniteEvents#remoteQuery(org.apache.ignite.lang.IgnitePredicate, long, int...)} - | ||
* asynchronously querying events occurred on the nodes specified, including remote nodes. | ||
* </li> | ||
* <li> | ||
* {@link org.apache.ignite.IgniteEvents#localQuery(org.apache.ignite.lang.IgnitePredicate, int...)} - | ||
* querying only local events stored on this local node. | ||
* </li> | ||
* <li> | ||
* {@link org.apache.ignite.IgniteEvents#localListen(org.apache.ignite.lang.IgnitePredicate, int...)} - | ||
* listening to local grid events (events from remote nodes not included). | ||
* </li> | ||
* </ul> | ||
* User can also wait for events using method {@link org.apache.ignite.IgniteEvents#waitForLocal(org.apache.ignite.lang.IgnitePredicate, int...)}. | ||
* <h1 class="header">Events and Performance</h1> | ||
* Note that by default all events in Ignite are enabled and therefore generated and stored | ||
* by whatever event storage SPI is configured. Ignite can and often does generate thousands events per seconds | ||
* under the load and therefore it creates a significant additional load on the system. If these events are | ||
* not needed by the application this load is unnecessary and leads to significant performance degradation. | ||
* <p> | ||
* It is <b>highly recommended</b> to enable only those events that your application logic requires | ||
* by using {@link org.apache.ignite.configuration.IgniteConfiguration#getIncludeEventTypes()} method in Ignite configuration. Note that certain | ||
* events are required for Ignite's internal operations and such events will still be generated but not stored by | ||
* event storage SPI if they are disabled in Ignite configuration. | ||
* @see EventType#EVT_TASK_FAILED | ||
* @see EventType#EVT_TASK_FINISHED | ||
* @see EventType#EVT_TASK_REDUCED | ||
* @see EventType#EVT_TASK_STARTED | ||
* @see EventType#EVT_TASK_SESSION_ATTR_SET | ||
* @see EventType#EVT_TASK_TIMEDOUT | ||
* @see EventType#EVTS_TASK_EXECUTION | ||
*/ | ||
public class TaskEventV2 extends TaskEvent { | ||
/** */ | ||
private static final long serialVersionUID = 0L; | ||
|
||
/** */ | ||
private Map<Object, Object> attributes; | ||
|
||
/** | ||
* Creates task event with given parameters. | ||
* | ||
* @param node Node. | ||
* @param msg Optional message. | ||
* @param type Event type. | ||
* @param sesId Task session ID. | ||
* @param taskName Task name. | ||
* @param subjId Subject ID. | ||
*/ | ||
ashapkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
public TaskEventV2(ClusterNode node, String msg, int type, IgniteUuid sesId, String taskName, String taskClsName, | ||
boolean internal, @Nullable UUID subjId, Map<Object, Object> attributes) { | ||
super(node, msg, type, sesId, taskName, taskClsName, internal, subjId); | ||
this.attributes = attributes; | ||
} | ||
|
||
public Map<Object, Object> attributes() { | ||
ashapkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return attributes; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override public String toString() { | ||
return S.toString(TaskEventV2.class, this, | ||
"nodeId8", U.id8(node().id()), | ||
"msg", message(), | ||
"type", name(), | ||
"attributes", attributes(), | ||
"tstamp", timestamp()); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2023