Something went wrong. Try again.
xburner is an experimental HTTP and gRPC load generator written in Zig.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103const std = @import("std");const config_assemble = @import("config/assemble.zig");const config_errors = @import("config/errors.zig");const config_parser = @import("config/parser.zig");const preprocess = @import("config/preprocess.zig");const types = @import("config/types.zig");
pub const ParseError = config_errors.ParseError;pub const SchemaError = config_errors.SchemaError;pub const LoadError = config_errors.LoadError;
pub const Duration = types.Duration;pub const ByteSize = types.ByteSize;
pub const ScenarioConfig = struct { arena: std.heap.ArenaAllocator, scenario: Scenario, recovery: RecoveryPolicy = .{}, execution: Execution, plugins: PluginsConfig = .{}, setup: SetupConfig, http: HttpConfig, exporters: ExportersConfig = .{}, thresholds: []const Threshold,
pub fn parse(allocator: std.mem.Allocator, source: []const u8) LoadError!ScenarioConfig { return parseExpandedSourceWithEnv(allocator, source, null); }
pub fn parseExpandedSourceWithEnv( allocator: std.mem.Allocator, source: []const u8, env_lookup: ?*const std.StringHashMapUnmanaged([]const u8), ) LoadError!ScenarioConfig { var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit();
var parser = Parser{ .allocator = arena.allocator(), .env_lookup = env_lookup, }; try parser.parse(source); return config_assemble.assembleScenarioConfig(&arena, &parser); }
pub fn parseFile(allocator: std.mem.Allocator, path: []const u8, max_bytes: usize) !ScenarioConfig { var load_result = try preprocess.loadExpandedConfigSource(allocator, path, max_bytes); defer load_result.deinit(allocator);
return parseExpandedSourceWithEnv(allocator, load_result.source, &load_result.env_lookup); }
pub fn deinit(self: *ScenarioConfig) void { self.arena.deinit(); self.* = undefined; }
pub fn findRequestById(self: *const ScenarioConfig, request_id: u32) ?*const HttpRequestTemplate { for (self.http.requests) |*request| { if (request.id == request_id) return request; } return null; }};
pub const Scenario = types.Scenario;pub const RecoveryPolicy = types.RecoveryPolicy;pub const RampStage = types.RampStage;pub const ScenarioMode = types.ScenarioMode;pub const Protocol = types.Protocol;pub const WasmBackend = types.WasmBackend;pub const Execution = types.Execution;pub const SetupConfig = types.SetupConfig;pub const HttpConfig = types.HttpConfig;pub const HttpVersion = types.HttpVersion;pub const OtlpExporter = types.OtlpExporter;pub const PluginExporter = types.PluginExporter;pub const ExportersConfig = types.ExportersConfig;pub const PluginsConfig = types.PluginsConfig;pub const HttpDefaults = types.HttpDefaults;pub const CookieJarScope = types.CookieJarScope;pub const TlsConfig = types.TlsConfig;pub const HttpMethod = types.HttpMethod;pub const HeaderTemplate = types.HeaderTemplate;pub const SetupRequest = types.SetupRequest;pub const HttpRequestTemplate = types.HttpRequestTemplate;pub const ThresholdMetric = types.ThresholdMetric;pub const ThresholdOperator = types.ThresholdOperator;pub const ThresholdScope = types.ThresholdScope;pub const ThresholdValue = types.ThresholdValue;pub const ThresholdClause = types.ThresholdClause;pub const ThresholdExpressionMode = types.ThresholdExpressionMode;pub const Threshold = types.Threshold;
const Parser = config_parser.Parser;
pub const FileLoadResult = preprocess.FileLoadResult;pub const loadExpandedConfigSource = preprocess.loadExpandedConfigSource;
pub const isParseError = config_errors.isParseError;pub const isSchemaError = config_errors.isSchemaError;pub const errorCategory = config_errors.errorCategory;