@loadstrike/loadstrike-sdk 1.0.27101 → 1.0.27301
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/README.md +3 -3
- package/dist/cjs/index.js +27 -2
- package/dist/cjs/local.js +71 -1
- package/dist/cjs/runtime.js +314 -2
- package/dist/cjs/sinks.js +262 -1
- package/dist/cjs/transports.js +326 -13
- package/dist/esm/index.js +3 -3
- package/dist/esm/local.js +71 -1
- package/dist/esm/runtime.js +308 -1
- package/dist/esm/sinks.js +249 -0
- package/dist/esm/transports.js +319 -12
- package/dist/types/contracts.d.ts +12 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/runtime.d.ts +67 -0
- package/dist/types/sinks.d.ts +136 -0
- package/dist/types/transports.d.ts +114 -0
- package/package.json +1 -1
package/dist/types/sinks.d.ts
CHANGED
|
@@ -642,6 +642,142 @@ export declare class OtelCollectorReportingSink implements LoadStrikeReportingSi
|
|
|
642
642
|
private getSession;
|
|
643
643
|
private persistEvents;
|
|
644
644
|
}
|
|
645
|
+
export interface ExpandedSinkOptionsInput {
|
|
646
|
+
BaseUrl?: string;
|
|
647
|
+
baseUrl?: string;
|
|
648
|
+
EndpointPath?: string;
|
|
649
|
+
endpointPath?: string;
|
|
650
|
+
Headers?: Record<string, string>;
|
|
651
|
+
headers?: Record<string, string>;
|
|
652
|
+
StaticTags?: Record<string, string>;
|
|
653
|
+
staticTags?: Record<string, string>;
|
|
654
|
+
TimeoutSeconds?: number;
|
|
655
|
+
timeoutSeconds?: number;
|
|
656
|
+
TimeoutMs?: number;
|
|
657
|
+
timeoutMs?: number;
|
|
658
|
+
FetchImpl?: SinkFetch;
|
|
659
|
+
fetchImpl?: SinkFetch;
|
|
660
|
+
}
|
|
661
|
+
declare abstract class ExpandedEventReportingSink implements LoadStrikeReportingSink {
|
|
662
|
+
readonly SinkName: string;
|
|
663
|
+
readonly sinkName: string;
|
|
664
|
+
readonly LicenseFeature: string;
|
|
665
|
+
readonly licenseFeature: string;
|
|
666
|
+
protected baseContext: LoadStrikeBaseContext | null;
|
|
667
|
+
protected session: SinkSessionMetadata | null;
|
|
668
|
+
protected constructor(sinkName: string, licenseFeature: string);
|
|
669
|
+
init(context: LoadStrikeBaseContext, _infraConfig: Record<string, unknown>): void;
|
|
670
|
+
Init(context: LoadStrikeBaseContext, infraConfig: Record<string, unknown>): void;
|
|
671
|
+
start(session: LoadStrikeSessionStartInfo): void;
|
|
672
|
+
Start(session: LoadStrikeSessionStartInfo): void;
|
|
673
|
+
saveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
674
|
+
SaveRealtimeStats(scenarioStats: LoadStrikeScenarioStats[]): Promise<void>;
|
|
675
|
+
saveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
676
|
+
SaveRealtimeMetrics(metrics: LoadStrikeMetricStats): Promise<void>;
|
|
677
|
+
saveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
678
|
+
SaveRunResult(result: LoadStrikeRunResult): Promise<void>;
|
|
679
|
+
stop(): void;
|
|
680
|
+
Stop(): void;
|
|
681
|
+
Dispose(): void;
|
|
682
|
+
protected getBaseContext(): LoadStrikeBaseContext;
|
|
683
|
+
protected getSession(): SinkSessionMetadata;
|
|
684
|
+
protected buildPayload(events: ReportingSinkEvent[], staticTags?: Record<string, string>): Record<string, unknown>;
|
|
685
|
+
protected abstract persistEvents(events: ReportingSinkEvent[]): Promise<void>;
|
|
686
|
+
}
|
|
687
|
+
declare class ExpandedHttpJsonReportingSink extends ExpandedEventReportingSink {
|
|
688
|
+
private readonly fetchImpl;
|
|
689
|
+
private readonly baseUrl;
|
|
690
|
+
private readonly endpointPath;
|
|
691
|
+
private readonly headers;
|
|
692
|
+
private readonly staticTags;
|
|
693
|
+
private readonly timeoutMs;
|
|
694
|
+
constructor(sinkName: string, licenseFeature: string, defaultEndpointPath: string, options?: ExpandedSinkOptionsInput);
|
|
695
|
+
init(context: LoadStrikeBaseContext, infraConfig: Record<string, unknown>): void;
|
|
696
|
+
protected persistEvents(events: ReportingSinkEvent[]): Promise<void>;
|
|
697
|
+
}
|
|
698
|
+
export declare class PrometheusRemoteWriteReportingSink extends ExpandedHttpJsonReportingSink {
|
|
699
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
700
|
+
}
|
|
701
|
+
export declare class CloudWatchReportingSink extends ExpandedHttpJsonReportingSink {
|
|
702
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
703
|
+
}
|
|
704
|
+
export declare class DynatraceReportingSink extends ExpandedHttpJsonReportingSink {
|
|
705
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
706
|
+
}
|
|
707
|
+
export declare class ElasticsearchReportingSink extends ExpandedHttpJsonReportingSink {
|
|
708
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
709
|
+
}
|
|
710
|
+
export declare class OpenSearchReportingSink extends ExpandedHttpJsonReportingSink {
|
|
711
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
712
|
+
}
|
|
713
|
+
export declare class NewRelicReportingSink extends ExpandedHttpJsonReportingSink {
|
|
714
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
715
|
+
}
|
|
716
|
+
export declare class GenericWebhookReportingSink extends ExpandedHttpJsonReportingSink {
|
|
717
|
+
constructor(options?: ExpandedSinkOptionsInput);
|
|
718
|
+
}
|
|
719
|
+
export interface KafkaReportingSinkOptionsInput {
|
|
720
|
+
Topic?: string;
|
|
721
|
+
topic?: string;
|
|
722
|
+
BootstrapServers?: string;
|
|
723
|
+
bootstrapServers?: string;
|
|
724
|
+
StaticTags?: Record<string, string>;
|
|
725
|
+
staticTags?: Record<string, string>;
|
|
726
|
+
PublishAsync?: (topic: string, payload: string) => Promise<void> | void;
|
|
727
|
+
publishAsync?: (topic: string, payload: string) => Promise<void> | void;
|
|
728
|
+
}
|
|
729
|
+
export declare class KafkaReportingSink extends ExpandedEventReportingSink {
|
|
730
|
+
private readonly topic;
|
|
731
|
+
private readonly staticTags;
|
|
732
|
+
private readonly publishAsync?;
|
|
733
|
+
constructor(options?: KafkaReportingSinkOptionsInput);
|
|
734
|
+
protected persistEvents(events: ReportingSinkEvent[]): Promise<void>;
|
|
735
|
+
}
|
|
736
|
+
export interface StatsDReportingSinkOptionsInput {
|
|
737
|
+
Prefix?: string;
|
|
738
|
+
prefix?: string;
|
|
739
|
+
Host?: string;
|
|
740
|
+
host?: string;
|
|
741
|
+
Port?: number;
|
|
742
|
+
port?: number;
|
|
743
|
+
Tags?: Record<string, string>;
|
|
744
|
+
tags?: Record<string, string>;
|
|
745
|
+
SendLineAsync?: (line: string) => Promise<void> | void;
|
|
746
|
+
sendLineAsync?: (line: string) => Promise<void> | void;
|
|
747
|
+
}
|
|
748
|
+
declare class StatsDReportingSinkBase extends ExpandedEventReportingSink {
|
|
749
|
+
private readonly prefix;
|
|
750
|
+
private readonly host;
|
|
751
|
+
private readonly port;
|
|
752
|
+
private readonly tags;
|
|
753
|
+
private readonly sendLineAsync?;
|
|
754
|
+
private readonly dogStatsD;
|
|
755
|
+
constructor(sinkName: string, licenseFeature: string, options?: StatsDReportingSinkOptionsInput, dogStatsD?: boolean);
|
|
756
|
+
protected persistEvents(events: ReportingSinkEvent[]): Promise<void>;
|
|
757
|
+
private formatPoint;
|
|
758
|
+
private sendLine;
|
|
759
|
+
}
|
|
760
|
+
export declare class StatsDReportingSink extends StatsDReportingSinkBase {
|
|
761
|
+
constructor(options?: StatsDReportingSinkOptionsInput);
|
|
762
|
+
}
|
|
763
|
+
export declare class DogStatsDReportingSink extends StatsDReportingSinkBase {
|
|
764
|
+
constructor(options?: StatsDReportingSinkOptionsInput);
|
|
765
|
+
}
|
|
766
|
+
export declare class NetdataStatsDReportingSink extends StatsDReportingSinkBase {
|
|
767
|
+
constructor(options?: StatsDReportingSinkOptionsInput);
|
|
768
|
+
}
|
|
769
|
+
export interface JsonlFileReportingSinkOptionsInput {
|
|
770
|
+
FilePath?: string;
|
|
771
|
+
filePath?: string;
|
|
772
|
+
StaticTags?: Record<string, string>;
|
|
773
|
+
staticTags?: Record<string, string>;
|
|
774
|
+
}
|
|
775
|
+
export declare class JsonlFileReportingSink extends ExpandedEventReportingSink {
|
|
776
|
+
private readonly filePath;
|
|
777
|
+
private readonly staticTags;
|
|
778
|
+
constructor(options?: JsonlFileReportingSinkOptionsInput);
|
|
779
|
+
protected persistEvents(events: ReportingSinkEvent[]): Promise<void>;
|
|
780
|
+
}
|
|
645
781
|
declare function createRealtimeStatsEvents(session: SinkSessionMetadata, scenarios: LoadStrikeScenarioStats[]): ReportingSinkEvent[];
|
|
646
782
|
declare function createFinalStatsEvents(session: SinkSessionMetadata, stats: LoadStrikeNodeStats): ReportingSinkEvent[];
|
|
647
783
|
declare function createRunResultEvents(session: SinkSessionMetadata, result: LoadStrikeRunResult): ReportingSinkEvent[];
|
|
@@ -631,6 +631,8 @@ export interface GrpcEndpointOptions extends DelegateEndpointOptions {
|
|
|
631
631
|
deadlineMs?: number;
|
|
632
632
|
Metadata?: Record<string, string>;
|
|
633
633
|
metadata?: Record<string, string>;
|
|
634
|
+
NativeClient?: GrpcNativeClientOptions;
|
|
635
|
+
nativeClient?: GrpcNativeClientOptions | Record<string, unknown>;
|
|
634
636
|
}
|
|
635
637
|
export interface GrpcEndpointDefinition extends TrafficEndpointDefinition, GrpcEndpointOptions {
|
|
636
638
|
Kind?: "Grpc";
|
|
@@ -649,6 +651,8 @@ export interface WebSocketEndpointOptions extends DelegateEndpointOptions {
|
|
|
649
651
|
closeTimeoutSeconds?: number;
|
|
650
652
|
CloseTimeoutMs?: number;
|
|
651
653
|
closeTimeoutMs?: number;
|
|
654
|
+
NativeClient?: WebSocketNativeClientOptions;
|
|
655
|
+
nativeClient?: WebSocketNativeClientOptions | Record<string, unknown>;
|
|
652
656
|
}
|
|
653
657
|
export interface WebSocketEndpointDefinition extends TrafficEndpointDefinition, WebSocketEndpointOptions {
|
|
654
658
|
Kind?: "WebSocket";
|
|
@@ -845,6 +849,64 @@ declare class PushDiffusionEndpointDefinitionModel extends TrafficEndpointDefini
|
|
|
845
849
|
constructor(initial?: PushDiffusionEndpointDefinitionInit);
|
|
846
850
|
Validate(): void;
|
|
847
851
|
}
|
|
852
|
+
export declare const GrpcMethodTypes: {
|
|
853
|
+
readonly Unary: "Unary";
|
|
854
|
+
readonly ServerStreaming: "ServerStreaming";
|
|
855
|
+
readonly ClientStreaming: "ClientStreaming";
|
|
856
|
+
readonly BidirectionalStreaming: "BidirectionalStreaming";
|
|
857
|
+
};
|
|
858
|
+
export type GrpcMethodTypes = typeof GrpcMethodTypes[keyof typeof GrpcMethodTypes];
|
|
859
|
+
export declare class GrpcNativeClientOptions {
|
|
860
|
+
ProtoFilePath?: string;
|
|
861
|
+
DescriptorSetPath?: string;
|
|
862
|
+
UseReflection: boolean;
|
|
863
|
+
UseTls: boolean;
|
|
864
|
+
AllowUntrustedCertificates: boolean;
|
|
865
|
+
DeadlineSeconds: number;
|
|
866
|
+
Metadata: Record<string, string>;
|
|
867
|
+
RequestPayloadJson?: string;
|
|
868
|
+
RequestPayloadJsonStream: string[];
|
|
869
|
+
constructor(initial?: Record<string, unknown>);
|
|
870
|
+
Validate(): void;
|
|
871
|
+
validate(): void;
|
|
872
|
+
}
|
|
873
|
+
export interface GrpcStatusMapping {
|
|
874
|
+
statusCode: number;
|
|
875
|
+
StatusCode: number;
|
|
876
|
+
statusName: string;
|
|
877
|
+
StatusName: string;
|
|
878
|
+
isSuccess: boolean;
|
|
879
|
+
IsSuccess: boolean;
|
|
880
|
+
}
|
|
881
|
+
export declare const GrpcStatusMapper: {
|
|
882
|
+
readonly fromStatusCode: (statusCode: number) => GrpcStatusMapping;
|
|
883
|
+
readonly FromStatusCode: (statusCode: number) => GrpcStatusMapping;
|
|
884
|
+
};
|
|
885
|
+
export declare class ProtocolMetricSnapshot {
|
|
886
|
+
protocol: string;
|
|
887
|
+
Protocol: string;
|
|
888
|
+
requests: number;
|
|
889
|
+
Requests: number;
|
|
890
|
+
messagesSent: number;
|
|
891
|
+
MessagesSent: number;
|
|
892
|
+
messagesReceived: number;
|
|
893
|
+
MessagesReceived: number;
|
|
894
|
+
latencyMs: number;
|
|
895
|
+
LatencyMs: number;
|
|
896
|
+
streamDurationMs: number;
|
|
897
|
+
StreamDurationMs: number;
|
|
898
|
+
bytesSent: number;
|
|
899
|
+
BytesSent: number;
|
|
900
|
+
bytesReceived: number;
|
|
901
|
+
BytesReceived: number;
|
|
902
|
+
reconnects: number;
|
|
903
|
+
Reconnects: number;
|
|
904
|
+
errors: number;
|
|
905
|
+
Errors: number;
|
|
906
|
+
status: string;
|
|
907
|
+
Status: string;
|
|
908
|
+
constructor(initial?: Record<string, unknown>);
|
|
909
|
+
}
|
|
848
910
|
declare class GrpcEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
|
|
849
911
|
readonly Kind: "Grpc";
|
|
850
912
|
Target: string;
|
|
@@ -858,9 +920,60 @@ declare class GrpcEndpointDefinitionModel extends TrafficEndpointDefinitionModel
|
|
|
858
920
|
ConsumeAsync?: DelegateConsumeAsync;
|
|
859
921
|
ConnectionMetadata: Record<string, string>;
|
|
860
922
|
Metadata: Record<string, string>;
|
|
923
|
+
NativeClient?: GrpcNativeClientOptions;
|
|
861
924
|
constructor(initial?: GrpcEndpointDefinitionInit);
|
|
862
925
|
Validate(): void;
|
|
863
926
|
}
|
|
927
|
+
export declare class WebSocketReconnectPolicy {
|
|
928
|
+
MaxAttempts: number;
|
|
929
|
+
maxAttempts: number;
|
|
930
|
+
DelaySeconds: number;
|
|
931
|
+
delaySeconds: number;
|
|
932
|
+
constructor(initial?: Record<string, unknown>);
|
|
933
|
+
Validate(): void;
|
|
934
|
+
validate(): void;
|
|
935
|
+
}
|
|
936
|
+
export declare class WebSocketMessageSpec {
|
|
937
|
+
Kind: string;
|
|
938
|
+
kind: string;
|
|
939
|
+
TextPayload?: string;
|
|
940
|
+
textPayload?: string;
|
|
941
|
+
BinaryPayload?: Uint8Array;
|
|
942
|
+
binaryPayload?: Uint8Array;
|
|
943
|
+
constructor(initial?: Record<string, unknown>);
|
|
944
|
+
static Text(payload: string): WebSocketMessageSpec;
|
|
945
|
+
static Binary(payload: Uint8Array | number[]): WebSocketMessageSpec;
|
|
946
|
+
Validate(): void;
|
|
947
|
+
validate(): void;
|
|
948
|
+
}
|
|
949
|
+
export declare class WebSocketExpectedMessage {
|
|
950
|
+
ContainsText?: string;
|
|
951
|
+
containsText?: string;
|
|
952
|
+
ContainsBytes?: Uint8Array;
|
|
953
|
+
containsBytes?: Uint8Array;
|
|
954
|
+
TimeoutSeconds: number;
|
|
955
|
+
timeoutSeconds: number;
|
|
956
|
+
constructor(initial?: Record<string, unknown>);
|
|
957
|
+
Validate(): void;
|
|
958
|
+
validate(): void;
|
|
959
|
+
}
|
|
960
|
+
export declare class WebSocketNativeClientOptions {
|
|
961
|
+
Headers: Record<string, string>;
|
|
962
|
+
headers: Record<string, string>;
|
|
963
|
+
Cookies: string[];
|
|
964
|
+
cookies: string[];
|
|
965
|
+
PingIntervalSeconds?: number;
|
|
966
|
+
pingIntervalSeconds?: number;
|
|
967
|
+
Reconnect: WebSocketReconnectPolicy;
|
|
968
|
+
reconnect: WebSocketReconnectPolicy;
|
|
969
|
+
Messages: WebSocketMessageSpec[];
|
|
970
|
+
messages: WebSocketMessageSpec[];
|
|
971
|
+
ExpectedMessages: WebSocketExpectedMessage[];
|
|
972
|
+
expectedMessages: WebSocketExpectedMessage[];
|
|
973
|
+
constructor(initial?: Record<string, unknown>);
|
|
974
|
+
Validate(): void;
|
|
975
|
+
validate(): void;
|
|
976
|
+
}
|
|
864
977
|
declare class WebSocketEndpointDefinitionModel extends TrafficEndpointDefinitionModel {
|
|
865
978
|
readonly Kind: "WebSocket";
|
|
866
979
|
Url: string;
|
|
@@ -872,6 +985,7 @@ declare class WebSocketEndpointDefinitionModel extends TrafficEndpointDefinition
|
|
|
872
985
|
ProduceAsync?: (request: ProducedMessageRequest) => Promise<ProducedMessageResult | TrackingPayload | null> | ProducedMessageResult | TrackingPayload | null;
|
|
873
986
|
ConsumeAsync?: DelegateConsumeAsync;
|
|
874
987
|
ConnectionMetadata: Record<string, string>;
|
|
988
|
+
NativeClient?: WebSocketNativeClientOptions;
|
|
875
989
|
constructor(initial?: WebSocketEndpointDefinitionInit);
|
|
876
990
|
Validate(): void;
|
|
877
991
|
}
|
package/package.json
CHANGED