public class CsmBidLifecycleListener extends java.lang.Object implements BidLifecycleListener
This follows specifications given by Client Side Metrics.
| Constructor and Description |
|---|
CsmBidLifecycleListener(MetricRepository repository,
MetricSendingQueueProducer sendingQueueProducer,
Clock clock,
Config config,
java.util.concurrent.Executor executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
onBidCached(com.criteo.publisher.model.CdbResponseSlot bidCached)
Callback invoked when a bid is cached.
|
void |
onBidConsumed(com.criteo.publisher.model.CacheAdUnit adUnit,
com.criteo.publisher.model.CdbResponseSlot consumedBid)
On bid consumption, the metric associated to the bid is updated.
|
void |
onCdbCallFailed(CdbRequest request,
java.lang.Exception exception)
On CDB call failed, metrics corresponding to the requested slots are updated.
|
void |
onCdbCallFinished(CdbRequest request,
CdbResponse response)
When the CDB call ends successfully, metrics corresponding to requested slots are updated
accordingly to the response.
|
void |
onCdbCallStarted(CdbRequest request)
On CDB call start, each requested slot is tracked by a new metric.
|
void |
onSdkInitialized()
SDK initialization is caused either by a fresh or restart of the application.
|
public CsmBidLifecycleListener(@NonNull
MetricRepository repository,
@NonNull
MetricSendingQueueProducer sendingQueueProducer,
@NonNull
Clock clock,
@NonNull
Config config,
@NonNull
java.util.concurrent.Executor executor)
public void onSdkInitialized()
onSdkInitialized in interface BidLifecycleListenerpublic void onCdbCallStarted(@NonNull
CdbRequest request)
onCdbCallStarted in interface BidLifecycleListenerrequest - Request sent to CDBpublic void onCdbCallFinished(@NonNull
CdbRequest request,
@NonNull
CdbResponse response)
If there is no response for a slot, then it is a no bid. The metric marks the timestamp of this event and, as no consumption of this no-bid is expected, the metric is tagged as finished and ready to send.
If there is a matching invalid slot, then it is considered as an error. The metric is not longer updated and is flagged as ready to send.
If there is a matching valid slot, then it is a consumable bid. The metric marks the timestamp of this event, and waits for further updates (via consumption).
onCdbCallFinished in interface BidLifecycleListenerrequest - Request that was sent to CDBresponse - Response coming from CDBpublic void onCdbCallFailed(@NonNull
CdbRequest request,
@NonNull
java.lang.Exception exception)
If the failure is a timeout, then all metrics are flagged as having a timeout.
Then, since no further updates are expected, all metrics are flagged as ready to send.
onCdbCallFailed in interface BidLifecycleListenerrequest - Request that was sent to CDBexception - Exception representing the failure of the callpublic void onBidConsumed(@NonNull
com.criteo.publisher.model.CacheAdUnit adUnit,
@NonNull
com.criteo.publisher.model.CdbResponseSlot consumedBid)
If the bid has not expired, then the bid managed to go from CDB to the user. The metric marks the timestamp of this event.
Since this is the end of the bid lifecycle, the metric does not expect further updates and is flagged as ready to send.
onBidConsumed in interface BidLifecycleListeneradUnit - ad unit representing the bidconsumedBid - bid that was consumedpublic void onBidCached(@NonNull
com.criteo.publisher.model.CdbResponseSlot bidCached)
BidLifecycleListeneronBidCached in interface BidLifecycleListenerbidCached - bid that was cached