Remove stats collection code measuring how often Tweets from specific user groups are served

This commit is contained in:
twitter-team 2023-03-31 13:39:57 -07:00
parent 64e754887b
commit ec83d01dca
5 changed files with 3 additions and 66 deletions

View file

@ -220,30 +220,7 @@ object HomeTweetTypePredicates {
_.getOrElse(ConversationModule2DisplayedTweetsFeature, false)), _.getOrElse(ConversationModule2DisplayedTweetsFeature, false)),
("conversation_module_has_gap", _.getOrElse(ConversationModuleHasGapFeature, false)), ("conversation_module_has_gap", _.getOrElse(ConversationModuleHasGapFeature, false)),
("served_in_recap_tweet_candidate_module_injection", _ => false), ("served_in_recap_tweet_candidate_module_injection", _ => false),
("served_in_threaded_conversation_module", _ => false), ("served_in_threaded_conversation_module", _ => false)
(
"author_is_elon",
candidate =>
candidate
.getOrElse(AuthorIdFeature, None).contains(candidate.getOrElse(DDGStatsElonFeature, 0L))),
(
"author_is_power_user",
candidate =>
candidate
.getOrElse(AuthorIdFeature, None)
.exists(candidate.getOrElse(DDGStatsVitsFeature, Set.empty[Long]).contains)),
(
"author_is_democrat",
candidate =>
candidate
.getOrElse(AuthorIdFeature, None)
.exists(candidate.getOrElse(DDGStatsDemocratsFeature, Set.empty[Long]).contains)),
(
"author_is_republican",
candidate =>
candidate
.getOrElse(AuthorIdFeature, None)
.exists(candidate.getOrElse(DDGStatsRepublicansFeature, Set.empty[Long]).contains)),
) )
val PredicateMap = CandidatePredicates.toMap val PredicateMap = CandidatePredicates.toMap

View file

@ -1,12 +1,10 @@
package com.twitter.home_mixer.functional_component.feature_hydrator package com.twitter.home_mixer.functional_component.feature_hydrator
import com.twitter.config.yaml.YamlMap
import com.twitter.finagle.tracing.Annotation.BinaryAnnotation import com.twitter.finagle.tracing.Annotation.BinaryAnnotation
import com.twitter.finagle.tracing.ForwardAnnotation import com.twitter.finagle.tracing.ForwardAnnotation
import com.twitter.home_mixer.model.HomeFeatures._ import com.twitter.home_mixer.model.HomeFeatures._
import com.twitter.home_mixer.model.request.DeviceContext.RequestContext import com.twitter.home_mixer.model.request.DeviceContext.RequestContext
import com.twitter.home_mixer.model.request.HasDeviceContext import com.twitter.home_mixer.model.request.HasDeviceContext
import com.twitter.home_mixer.param.HomeMixerInjectionNames.DDGStatsAuthors
import com.twitter.joinkey.context.RequestJoinKeyContext import com.twitter.joinkey.context.RequestJoinKeyContext
import com.twitter.product_mixer.component_library.model.cursor.UrtOrderedCursor import com.twitter.product_mixer.component_library.model.cursor.UrtOrderedCursor
import com.twitter.product_mixer.core.feature.Feature import com.twitter.product_mixer.core.feature.Feature
@ -24,22 +22,16 @@ import com.twitter.snowflake.id.SnowflakeId
import com.twitter.stitch.Stitch import com.twitter.stitch.Stitch
import java.util.UUID import java.util.UUID
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Named
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
class RequestQueryFeatureHydrator[ class RequestQueryFeatureHydrator[
Query <: PipelineQuery with HasPipelineCursor[UrtOrderedCursor] with HasDeviceContext] @Inject() ( Query <: PipelineQuery with HasPipelineCursor[UrtOrderedCursor] with HasDeviceContext] @Inject() (
@Named(DDGStatsAuthors) ddgStatsAuthors: YamlMap) ) extends QueryFeatureHydrator[Query] {
extends QueryFeatureHydrator[Query] {
override val features: Set[Feature[_, _]] = Set( override val features: Set[Feature[_, _]] = Set(
AccountAgeFeature, AccountAgeFeature,
ClientIdFeature, ClientIdFeature,
DDGStatsDemocratsFeature,
DDGStatsRepublicansFeature,
DDGStatsElonFeature,
DDGStatsVitsFeature,
DeviceLanguageFeature, DeviceLanguageFeature,
GetInitialFeature, GetInitialFeature,
GetMiddleFeature, GetMiddleFeature,
@ -59,10 +51,6 @@ class RequestQueryFeatureHydrator[
override val identifier: FeatureHydratorIdentifier = FeatureHydratorIdentifier("Request") override val identifier: FeatureHydratorIdentifier = FeatureHydratorIdentifier("Request")
private val DarkRequestAnnotation = "clnt/has_dark_request" private val DarkRequestAnnotation = "clnt/has_dark_request"
private val Democrats = "democrats"
private val Republicans = "republicans"
private val Elon = "elon"
private val Vits = "vits"
// Convert Language code to ISO 639-3 format // Convert Language code to ISO 639-3 format
private def getLanguageISOFormatByCode(languageCode: String): String = private def getLanguageISOFormatByCode(languageCode: String): String =
@ -83,16 +71,6 @@ class RequestQueryFeatureHydrator[
val featureMap = FeatureMapBuilder() val featureMap = FeatureMapBuilder()
.add(AccountAgeFeature, query.getOptionalUserId.flatMap(SnowflakeId.timeFromIdOpt)) .add(AccountAgeFeature, query.getOptionalUserId.flatMap(SnowflakeId.timeFromIdOpt))
.add(ClientIdFeature, query.clientContext.appId) .add(ClientIdFeature, query.clientContext.appId)
/**
* These author ID lists are used purely for metrics collection. We track how often we are
* serving Tweets from these authors and how often their tweets are being impressed by users.
* This helps us validate in our A/B experimentation platform that we do not ship changes
* that negatively impacts one group over others.
*/
.add(DDGStatsDemocratsFeature, ddgStatsAuthors.longSeq(Democrats).toSet)
.add(DDGStatsRepublicansFeature, ddgStatsAuthors.longSeq(Republicans).toSet)
.add(DDGStatsVitsFeature, ddgStatsAuthors.longSeq(Vits).toSet)
.add(DDGStatsElonFeature, ddgStatsAuthors.longValue(Elon))
.add(DeviceLanguageFeature, query.getLanguageCode.map(getLanguageISOFormatByCode)) .add(DeviceLanguageFeature, query.getLanguageCode.map(getLanguageISOFormatByCode))
.add( .add(
GetInitialFeature, GetInitialFeature,

View file

@ -176,10 +176,6 @@ object HomeFeatures {
override def personalDataTypes: Set[pd.PersonalDataType] = Set(pd.PersonalDataType.ClientType) override def personalDataTypes: Set[pd.PersonalDataType] = Set(pd.PersonalDataType.ClientType)
} }
object CachedScoredTweetsFeature extends Feature[PipelineQuery, Seq[hmt.CachedScoredTweet]] object CachedScoredTweetsFeature extends Feature[PipelineQuery, Seq[hmt.CachedScoredTweet]]
object DDGStatsElonFeature extends Feature[PipelineQuery, Long]
object DDGStatsVitsFeature extends Feature[PipelineQuery, Set[Long]]
object DDGStatsDemocratsFeature extends Feature[PipelineQuery, Set[Long]]
object DDGStatsRepublicansFeature extends Feature[PipelineQuery, Set[Long]]
object DeviceLanguageFeature extends Feature[PipelineQuery, Option[String]] object DeviceLanguageFeature extends Feature[PipelineQuery, Option[String]]
object DismissInfoFeature object DismissInfoFeature
extends FeatureWithDefaultOnFailure[PipelineQuery, Map[st.SuggestType, Option[DismissInfo]]] { extends FeatureWithDefaultOnFailure[PipelineQuery, Map[st.SuggestType, Option[DismissInfo]]] {

View file

@ -1,18 +1,5 @@
package com.twitter.home_mixer.module package com.twitter.home_mixer.module
import com.google.inject.Provides
import com.twitter.config.yaml.YamlMap
import com.twitter.home_mixer.param.HomeMixerInjectionNames.DDGStatsAuthors
import com.twitter.inject.TwitterModule import com.twitter.inject.TwitterModule
import javax.inject.Named
import javax.inject.Singleton
object HomeMixerResourcesModule extends TwitterModule { object HomeMixerResourcesModule extends TwitterModule {}
private val AuthorsFile = "/config/authors.yml"
@Provides
@Singleton
@Named(DDGStatsAuthors)
def providesDDGStatsAuthors(): YamlMap = YamlMap.load(AuthorsFile)
}

View file

@ -4,7 +4,6 @@ object HomeMixerInjectionNames {
final val AuthorFeatureRepository = "AuthorFeatureRepository" final val AuthorFeatureRepository = "AuthorFeatureRepository"
final val CandidateFeaturesScribeEventPublisher = "CandidateFeaturesScribeEventPublisher" final val CandidateFeaturesScribeEventPublisher = "CandidateFeaturesScribeEventPublisher"
final val CommonFeaturesScribeEventPublisher = "CommonFeaturesScribeEventPublisher" final val CommonFeaturesScribeEventPublisher = "CommonFeaturesScribeEventPublisher"
final val DDGStatsAuthors = "DDGStatsAuthors"
final val EarlybirdRepository = "EarlybirdRepository" final val EarlybirdRepository = "EarlybirdRepository"
final val EngagementsReceivedByAuthorCache = "EngagementsReceivedByAuthorCache" final val EngagementsReceivedByAuthorCache = "EngagementsReceivedByAuthorCache"
final val GraphTwoHopRepository = "GraphTwoHopRepository" final val GraphTwoHopRepository = "GraphTwoHopRepository"