private String getIndexName(InternalEvent ievent) { if (this.dtFormat == null) { return this.index; } String index = this.index + this.dtFormat.print(ievent.getEventTime()); return index; } }
private String getIndexName(InternalEvent ievent) { if (this.dtFormat == null) { return this.index; } String index = this.index + this.dtFormat.print(ievent.getEventTime()); return index; } }
@Override public byte[] serialize(InternalEvent ievent) { /* * Create a JSON line that describes the record for Splunk. */ StringBuilder payload = new StringBuilder(); payload.append("{"); if (this.index != null) { payload.append("\"index\":\""+ this.index +"\","); } payload.append("\"event\":"); payload.append(ievent.getSerialized()); payload.append(",\"time\": "); payload.append(String.format(Locale.US, "%.3f", ievent.getEventTime()/1000.0)); payload.append("}"); return payload.toString().getBytes(); } }
@Override public byte[] serialize(InternalEvent ievent) { /* * Create a JSON line that describes the record for Splunk. */ StringBuilder payload = new StringBuilder(); payload.append("{"); if (this.index != null) { payload.append("\"index\":\""+ this.index +"\","); } payload.append("\"event\":"); payload.append(ievent.getSerialized()); payload.append(",\"time\": "); payload.append(String.format(Locale.US, "%.3f", ievent.getEventTime()/1000.0)); payload.append("}"); return payload.toString().getBytes(); } }
public void setEventTime(long eventTime) { this.eventTime = eventTime; this.addMetadata("eventEpochMs", new Long(eventTime)); this.addMetadata("sourceLagMs", new Long(System.currentTimeMillis() - this.getEventTime())); }
public void setEventTime(long eventTime) { this.eventTime = eventTime; this.addMetadata("eventEpochMs", new Long(eventTime)); this.addMetadata("sourceLagMs", new Long(System.currentTimeMillis() - this.getEventTime())); }
if (ievent.getEventTime() > 1) { timestamp = ievent.getEventTime() / 1000.0; } else { return ievent;
if (ievent.getEventTime() > 1) { timestamp = ievent.getEventTime() / 1000.0; } else { return ievent;
private BasicWrapper(final InternalEvent internal) { this.sha1Hash = internal.getEventSha1Hash(); this.timestamp = internal.getEventTime(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
private BasicWrapper(final InternalEvent internal) { this.sha1Hash = internal.getEventSha1Hash(); this.timestamp = internal.getEventTime(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
DeserializedEvent newDeserEvent = new GenericJsonEvent(elm.getAsJsonObject()); newEvent.setEventObj(newDeserEvent); newEvent.setEventTime(ievent.getEventTime());
DeserializedEvent newDeserEvent = new GenericJsonEvent(elm.getAsJsonObject()); newEvent.setEventObj(newDeserEvent); newEvent.setEventTime(ievent.getEventTime());
/** * Makes a new event by copying properties from another event. * * @param other event to copy */ private InternalEvent(InternalEvent other) { this.eventString = new String(other.getEventString()); this.context = other.context; this.eventSha1Hash = other.getEventSha1Hash(); this.arrivalTime = other.getArrivalTime(); this.eventTime = other.getEventTime(); this.serialized = other.getSerialized(); if (other.getPartitions() == null) { this.partitions = null; } else { this.partitions = new LinkedHashMap<String, String>(other.getPartitions()); } /* * We rely on the implementation to provide a deep copy here. */ if (other.getEventObj() != null) { this.eventObj = other.getEventObj().copy(); } /* * Note that this is a shallow copy of the metadata. Some metadata elements are reused across * multiple events within a function invocation. */ this.metadata.putAll(other.metadata); }
/** * Makes a new event by copying properties from another event. * * @param other event to copy */ private InternalEvent(InternalEvent other) { this.eventString = new String(other.getEventString()); this.context = other.context; this.eventSha1Hash = other.getEventSha1Hash(); this.arrivalTime = other.getArrivalTime(); this.eventTime = other.getEventTime(); this.serialized = other.getSerialized(); if (other.getPartitions() == null) { this.partitions = null; } else { this.partitions = new LinkedHashMap<String, String>(other.getPartitions()); } /* * We rely on the implementation to provide a deep copy here. */ if (other.getEventObj() != null) { this.eventObj = other.getEventObj().copy(); } /* * Note that this is a shallow copy of the metadata. Some metadata elements are reused across * multiple events within a function invocation. */ this.metadata.putAll(other.metadata); }
@Test public void testValidTime() throws FieldNotFoundException { InternalEvent ievent = new InternalEvent("foo", null, 1); DummyStringEvent devent = spy(new DummyStringEvent("")); ievent.setEventObj(devent); doReturn("1504728473").when(devent).getFieldAsString("foo"); TimeOperation op = new TimeOperation("foo", TimeFieldType.SECONDS); op.perform(ievent); assertEquals(1504728473000l, ievent.getEventTime()); }
updateOldest(oldestOccurrenceTime, ievent.getEventTime());
private KinesisWrapper(final InternalEvent internal) { KinesisEventRecord eventRecord = ((KinesisInternalEvent) internal).getRecord(); Record record = eventRecord.getKinesis(); this.partitionKey = record.getPartitionKey(); this.sequenceNumber = record.getSequenceNumber(); this.eventSource = eventRecord.getEventSource(); this.sourceArn = eventRecord.getEventSourceARN(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.arrivalTime = record.getApproximateArrivalTimestamp().getTime(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
private S3Wrapper(final InternalEvent internal) { S3InternalEvent s3Event = ((S3InternalEvent) internal); this.s3Key = s3Event.getS3Key(); this.s3Bucket = s3Event.getS3Bucket(); this.s3KeyVersion = s3Event.getS3KeyVersion(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; this.sha1Hash = internal.getEventSha1Hash(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
private KinesisWrapper(final InternalEvent internal) { KinesisEventRecord eventRecord = ((KinesisInternalEvent) internal).getRecord(); Record record = eventRecord.getKinesis(); this.partitionKey = record.getPartitionKey(); this.sequenceNumber = record.getSequenceNumber(); this.eventSource = eventRecord.getEventSource(); this.sourceArn = eventRecord.getEventSourceARN(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.arrivalTime = record.getApproximateArrivalTimestamp().getTime(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }
private S3Wrapper(final InternalEvent internal) { S3InternalEvent s3Event = ((S3InternalEvent) internal); this.s3Key = s3Event.getS3Key(); this.s3Bucket = s3Event.getS3Bucket(); this.s3KeyVersion = s3Event.getS3KeyVersion(); this.functionName = internal.getCtx().getContext().getFunctionName(); this.functionVersion = internal.getCtx().getContext().getFunctionVersion(); this.processingTime = System.currentTimeMillis(); this.timestamp = internal.getEventTime(); this.processingDelay = processingTime - timestamp; this.sha1Hash = internal.getEventSha1Hash(); if (internal.getEventObj() != null) { this.payload = internal.getEventObj().getPayload(); } else { this.payload = null; } }