@sentio/sdk 1.31.0 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/meter.js +5 -2
- package/lib/core/meter.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +1 -1
- package/lib/gen/processor/protos/processor.js +24 -10
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/package.json +1 -1
- package/src/core/meter.ts +5 -2
- package/src/gen/processor/protos/processor.ts +25 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.31.
|
|
4
|
+
"version": "1.31.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
7
7
|
"compile": "tsc -p . && cp src/cli/webpack.config.js lib/cli && cp src/utils/*.csv lib/utils",
|
package/src/core/meter.ts
CHANGED
|
@@ -54,8 +54,11 @@ export class Metric extends NamedResultDescriptor {
|
|
|
54
54
|
this.type = type
|
|
55
55
|
this.descriptor = MetricConfig.fromPartial({ name: this.name, ...option })
|
|
56
56
|
const aggregationConfig = this.descriptor.aggregationConfig
|
|
57
|
-
if (aggregationConfig) {
|
|
58
|
-
if (aggregationConfig.intervalInMinutes >
|
|
57
|
+
if (aggregationConfig && aggregationConfig.intervalInMinutes && aggregationConfig.intervalInMinutes.length) {
|
|
58
|
+
if (aggregationConfig.intervalInMinutes.length > 1) {
|
|
59
|
+
console.error('current only support one intervalInMinutes, only first interval will be used for', name)
|
|
60
|
+
}
|
|
61
|
+
if (aggregationConfig.intervalInMinutes[0] > 0 && !aggregationConfig.types) {
|
|
59
62
|
aggregationConfig.types = [AggregationType.SUM, AggregationType.COUNT]
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -301,7 +301,7 @@ export interface MetricConfig {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
export interface AggregationConfig {
|
|
304
|
-
intervalInMinutes: number;
|
|
304
|
+
intervalInMinutes: number[];
|
|
305
305
|
types: AggregationType[];
|
|
306
306
|
discardOrigin: boolean;
|
|
307
307
|
}
|
|
@@ -1552,7 +1552,7 @@ export const MetricConfig = {
|
|
|
1552
1552
|
};
|
|
1553
1553
|
|
|
1554
1554
|
function createBaseAggregationConfig(): AggregationConfig {
|
|
1555
|
-
return { intervalInMinutes:
|
|
1555
|
+
return { intervalInMinutes: [], types: [], discardOrigin: false };
|
|
1556
1556
|
}
|
|
1557
1557
|
|
|
1558
1558
|
export const AggregationConfig = {
|
|
@@ -1560,9 +1560,11 @@ export const AggregationConfig = {
|
|
|
1560
1560
|
message: AggregationConfig,
|
|
1561
1561
|
writer: _m0.Writer = _m0.Writer.create()
|
|
1562
1562
|
): _m0.Writer {
|
|
1563
|
-
|
|
1564
|
-
|
|
1563
|
+
writer.uint32(10).fork();
|
|
1564
|
+
for (const v of message.intervalInMinutes) {
|
|
1565
|
+
writer.int32(v);
|
|
1565
1566
|
}
|
|
1567
|
+
writer.ldelim();
|
|
1566
1568
|
writer.uint32(18).fork();
|
|
1567
1569
|
for (const v of message.types) {
|
|
1568
1570
|
writer.int32(v);
|
|
@@ -1582,7 +1584,14 @@ export const AggregationConfig = {
|
|
|
1582
1584
|
const tag = reader.uint32();
|
|
1583
1585
|
switch (tag >>> 3) {
|
|
1584
1586
|
case 1:
|
|
1585
|
-
|
|
1587
|
+
if ((tag & 7) === 2) {
|
|
1588
|
+
const end2 = reader.uint32() + reader.pos;
|
|
1589
|
+
while (reader.pos < end2) {
|
|
1590
|
+
message.intervalInMinutes.push(reader.int32());
|
|
1591
|
+
}
|
|
1592
|
+
} else {
|
|
1593
|
+
message.intervalInMinutes.push(reader.int32());
|
|
1594
|
+
}
|
|
1586
1595
|
break;
|
|
1587
1596
|
case 2:
|
|
1588
1597
|
if ((tag & 7) === 2) {
|
|
@@ -1607,9 +1616,9 @@ export const AggregationConfig = {
|
|
|
1607
1616
|
|
|
1608
1617
|
fromJSON(object: any): AggregationConfig {
|
|
1609
1618
|
return {
|
|
1610
|
-
intervalInMinutes:
|
|
1611
|
-
?
|
|
1612
|
-
:
|
|
1619
|
+
intervalInMinutes: Array.isArray(object?.intervalInMinutes)
|
|
1620
|
+
? object.intervalInMinutes.map((e: any) => Number(e))
|
|
1621
|
+
: [],
|
|
1613
1622
|
types: Array.isArray(object?.types)
|
|
1614
1623
|
? object.types.map((e: any) => aggregationTypeFromJSON(e))
|
|
1615
1624
|
: [],
|
|
@@ -1621,8 +1630,13 @@ export const AggregationConfig = {
|
|
|
1621
1630
|
|
|
1622
1631
|
toJSON(message: AggregationConfig): unknown {
|
|
1623
1632
|
const obj: any = {};
|
|
1624
|
-
message.intervalInMinutes
|
|
1625
|
-
|
|
1633
|
+
if (message.intervalInMinutes) {
|
|
1634
|
+
obj.intervalInMinutes = message.intervalInMinutes.map((e) =>
|
|
1635
|
+
Math.round(e)
|
|
1636
|
+
);
|
|
1637
|
+
} else {
|
|
1638
|
+
obj.intervalInMinutes = [];
|
|
1639
|
+
}
|
|
1626
1640
|
if (message.types) {
|
|
1627
1641
|
obj.types = message.types.map((e) => aggregationTypeToJSON(e));
|
|
1628
1642
|
} else {
|
|
@@ -1635,7 +1649,7 @@ export const AggregationConfig = {
|
|
|
1635
1649
|
|
|
1636
1650
|
fromPartial(object: DeepPartial<AggregationConfig>): AggregationConfig {
|
|
1637
1651
|
const message = createBaseAggregationConfig();
|
|
1638
|
-
message.intervalInMinutes = object.intervalInMinutes
|
|
1652
|
+
message.intervalInMinutes = object.intervalInMinutes?.map((e) => e) || [];
|
|
1639
1653
|
message.types = object.types?.map((e) => e) || [];
|
|
1640
1654
|
message.discardOrigin = object.discardOrigin ?? false;
|
|
1641
1655
|
return message;
|