Skip to content

Commit 23f4909

Browse files
Impression properties in consumer mode
1 parent 491ed34 commit 23f4909

File tree

3 files changed

+25
-36
lines changed

3 files changed

+25
-36
lines changed

src/storages/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function impressionsToJSON(impressions: SplitIO.ImpressionDTO[], metadata
3030
c: impression.changeNumber,
3131
m: impression.time,
3232
pt: impression.pt,
33+
properties: impression.properties
3334
}
3435
};
3536

src/sync/submitters/impressionsSubmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function fromImpressionsCollector(sendLabels: boolean, data: SplitIO.Impr
2727
r: sendLabels ? entry.label : undefined, // Rule
2828
b: entry.bucketingKey, // Bucketing Key
2929
pt: entry.pt, // Previous time
30-
properties: entry.properties && JSON.stringify(entry.properties) // Properties
30+
properties: entry.properties // Properties
3131
};
3232

3333
return keyImpression;

src/sync/submitters/types.ts

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@ import { IMetadata } from '../../dtos/types';
33
import SplitIO from '../../../types/splitio';
44
import { ISyncTask } from '../types';
55

6+
type ImpressionPayload = {
7+
/** Matching Key */
8+
k: string;
9+
/** Bucketing Key */
10+
b?: string;
11+
/** Treatment */
12+
t: string;
13+
/** Timestamp */
14+
m: number;
15+
/** Change number */
16+
c: number;
17+
/** Rule label */
18+
r?: string;
19+
/** Previous time */
20+
pt?: number;
21+
/** Stringified JSON object with properties */
22+
properties?: string;
23+
};
24+
625
export type ImpressionsPayload = {
726
/** Split name */
827
f: string,
928
/** Key Impressions */
10-
i: {
11-
/** User Key */
12-
k: string;
13-
/** Treatment */
14-
t: string;
15-
/** Timestamp */
16-
m: number;
17-
/** ChangeNumber */
18-
c: number;
19-
/** Rule label */
20-
r?: string;
21-
/** Bucketing Key */
22-
b?: string;
23-
/** Previous time */
24-
pt?: number;
25-
/** Stringified JSON object with properties */
26-
properties?: string;
27-
}[]
29+
i: ImpressionPayload[]
2830
}[]
2931

3032
export type ImpressionCountsPayload = {
@@ -62,23 +64,9 @@ export type StoredImpressionWithMetadata = {
6264
/** Metadata */
6365
m: IMetadata,
6466
/** Stored impression */
65-
i: {
66-
/** keyName */
67-
k: string,
68-
/** bucketingKey */
69-
b?: string,
70-
/** Split name */
71-
f: string,
72-
/** treatment */
73-
t: string,
74-
/** label */
75-
r: string,
76-
/** changeNumber */
77-
c: number,
78-
/** time */
79-
m: number
80-
/** previous time */
81-
pt?: number
67+
i: ImpressionPayload & {
68+
/** Feature flag name */
69+
f: string
8270
}
8371
}
8472

0 commit comments

Comments
 (0)