user_properties from ExperimentUser are not forwarded to exposure/assignment events
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Individua la costruzione dell’evento di esposizione e la logica corrispondente in assignment-service.ts. Verifica come vengono assemblati ExperimentUser.user_properties e i campi $set generati, quindi verifica che sia gli eventi di esposizione sia quelli di assegnazione conservino le proprietà personalizzate insieme alle assegnazioni dei flag. Il lavoro è completato quando gli eventi includono le user_properties fornite per le chiamate a evaluateV2() con tracksExposure abilitato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
When calling evaluateV2() with tracksExposure: true, the custom user_properties passed in ExperimentUser should be included in the [Experiment] Exposure event's user_properties.$set, so they are associated with the user profile in Amplitude.
const user: ExperimentUser = {
user_id: 'user-123',
device_id: 'device-456',
user_properties: { anonymous: true, plan: 'premium' },
};
const variants = client.evaluateV2(user, ['my-flag'], { tracksExposure: true });
// Expected: Exposure event should include user_properties in $set
// {
// event_type: '[Experiment] Exposure',
// user_id: 'user-123',
// device_id: 'device-456',
// user_properties: {
// $set: {
// anonymous: true, // <-- from ExperimentUser.user_properties
// plan: 'premium', // <-- from ExperimentUser.user_properties
// '[Experiment] my-flag': 'treatment'
// },
// $unset: {}
// }
// }
Possible Solution
Merge exposure.user.user_properties into the $set object when building the event:
user_properties: {
$set: { ...exposure.user.user_properties, ...set },
$unset: unset,
},
Current Behavior
The user_properties from ExperimentUser are only used for local evaluation targeting and are not forwarded to exposure events.
The same issue exists in assignment-service.ts.
Steps to Reproduce
- Initialize local evaluation client with exposureConfig
- Create an ExperimentUser with custom user_properties
- Call evaluateV2() with tracksExposure: true
- Check the exposure event in Amplitude - custom user_properties are missing
import { Experiment } from '@amplitude/experiment-node-server';
const client = Experiment.initializeLocal('DEPLOYMENT_KEY', {
exposureConfig: { apiKey: 'API_KEY' },
});
await client.start();
const user = {
user_id: 'user-123',
device_id: 'device-456',
user_properties: { anonymous: true },
};
// user_properties is used for targeting but NOT sent to Amplitude
const variants = client.evaluateV2(user, ['my-flag'], { tracksExposure: true });
Environment
JS Server SDK Version: 1.13.2
Installation Method: yarn
Runtime: Node.js
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 9
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di amplitude/experiment-node-server
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
amplitude/experiment-node-server#69 · 1 commento ·
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
amplitude/experiment-node-server#38 · 2 commenti · 3 reazioni ·
-
ssr-demo needs react 18Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
Tutte le issue di amplitude/experiment-node-server
Issue simili
-
freshness freshness:observed-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
thoroc/context-radar#282 ·
-
bug P2 rust
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area: web
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
gabe-santana/arkdraw#25 ·
-
bug require-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
expressjs/expressjs.com#2549 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/discord-bot#101 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno