Class TimelineCollector
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.yarn.server.timelineservice.collector.TimelineCollector
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
- Direct Known Subclasses:
AppLevelTimelineCollector
@Private
@Unstable
public abstract class TimelineCollector
extends org.apache.hadoop.service.CompositeService
Service that handles writes to the timeline service and writes them to the
backing storage.
Classes that extend this can add their own lifecycle management or
customization of request handling.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService
org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHookNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsFields inherited from class org.apache.hadoop.service.CompositeService
STOP_ONLY_STARTED_SERVICES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityaggregateEntities(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, String resultEntityId, String resultEntityType, boolean needsGroupIdInResult) Aggregate all metrics in given timeline entities with no predefined states.protected Map<String,TimelineCollector.AggregationStatusTable> Method to decide the set of timeline entity types the collector should skip on aggregations.abstract TimelineCollectorContextprotected booleanorg.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponseputDomain(org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain domain, org.apache.hadoop.security.UserGroupInformation callerUgi) Add or update an domain.org.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponseputEntities(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, org.apache.hadoop.security.UserGroupInformation callerUgi) Handles entity writes.voidputEntitiesAsync(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, org.apache.hadoop.security.UserGroupInformation callerUgi) Handles entity writes in an asynchronous manner.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidprotected voidprotected voidMethods inherited from class org.apache.hadoop.service.CompositeService
addIfService, addService, getServices, removeServiceMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
SEPARATOR
- See Also:
-
-
Constructor Details
-
TimelineCollector
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
setWriter
-
getAggregationGroups
-
setReadyToAggregate
protected void setReadyToAggregate() -
isReadyToAggregate
protected boolean isReadyToAggregate() -
getEntityTypesSkipAggregation
Method to decide the set of timeline entity types the collector should skip on aggregations. Subclasses may want to override this method to customize their own behaviors.- Returns:
- A set of strings consists of all types the collector should skip.
-
getTimelineEntityContext
-
putEntities
public org.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponse putEntities(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, org.apache.hadoop.security.UserGroupInformation callerUgi) throws IOException Handles entity writes. These writes are synchronous and are written to the backing storage without buffering/batching. If any entity already exists, it results in an update of the entity. This method should be reserved for selected critical entities and events. For normal voluminous writes one should use the async methodputEntitiesAsync(TimelineEntities, UserGroupInformation).- Parameters:
entities- entities to postcallerUgi- the caller UGI- Returns:
- the response that contains the result of the post.
- Throws:
IOException- if there is any exception encountered while putting entities.
-
putDomain
public org.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponse putDomain(org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain domain, org.apache.hadoop.security.UserGroupInformation callerUgi) throws IOException Add or update an domain. If the domain already exists, only the owner and the admin can update it.- Parameters:
domain- domain to postcallerUgi- the caller UGI- Returns:
- the response that contains the result of the post.
- Throws:
IOException- if there is any exception encountered while putting domain.
-
putEntitiesAsync
public void putEntitiesAsync(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, org.apache.hadoop.security.UserGroupInformation callerUgi) throws IOException Handles entity writes in an asynchronous manner. The method returns as soon as validation is done. No promises are made on how quickly it will be written to the backing storage or if it will always be written to the backing storage. Multiple writes to the same entities may be batched and appropriate values updated and result in fewer writes to the backing storage.- Parameters:
entities- entities to postcallerUgi- the caller UGI- Throws:
IOException- if there is any exception encounted while putting entities.
-
aggregateEntities
public static org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity aggregateEntities(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities entities, String resultEntityId, String resultEntityType, boolean needsGroupIdInResult) Aggregate all metrics in given timeline entities with no predefined states.- Parameters:
entities- Entities to aggregateresultEntityId- Id of the result entityresultEntityType- Type of the result entityneedsGroupIdInResult- Marks if we want the aggregation group id in each aggregated metrics.- Returns:
- A timeline entity that contains all aggregated TimelineMetric.
-