Branch data Line data Source code
1 : : // Copyright 2026 HPActor Contributors
2 : : // Licensed under the Apache License, Version 2.0
3 : : #pragma once
4 : :
5 : : #include <chrono>
6 : : #include <cstdint>
7 : : #include <string>
8 : :
9 : : namespace hpactor::tracing {
10 : :
11 : : enum class TraceExporterKind : uint8_t {
12 : : kNoop,
13 : : kMemory,
14 : : kJsonFile,
15 : : kOtlpHttp,
16 : : };
17 : :
18 : : enum class SamplerKind : uint8_t {
19 : : kAlwaysOff,
20 : : kAlwaysOn,
21 : : kTraceIdRatio,
22 : : kParentBasedTraceIdRatio,
23 : : };
24 : :
25 : : struct TraceConfig {
26 : : bool enabled{false};
27 : : bool propagate_unsampled{true};
28 : : uint32_t ring_buffer_capacity{65536};
29 : : std::string service_name{"hpactor"};
30 : : SamplerKind sampler{SamplerKind::kParentBasedTraceIdRatio};
31 : : double sample_ratio{0.01};
32 : : TraceExporterKind exporter{TraceExporterKind::kOtlpHttp};
33 : : std::string otlp_endpoint{"http://127.0.0.1:4318/v1/traces"};
34 : : std::string json_file_path;
35 : 12 : std::chrono::milliseconds export_interval{500};
36 : : uint32_t max_export_batch_size{512};
37 : : uint16_t max_tracestate_len{256};
38 : : bool record_actor_receive_spans{true};
39 : : bool record_remote_producer_spans{true};
40 : : bool record_local_producer_spans{false};
41 : : bool record_payload_size{true};
42 : : bool create_roots_for_actor_context_sends{false};
43 : : bool create_roots_for_rpc{true};
44 : : bool create_roots_for_http_ingress{true};
45 : : };
46 : :
47 : : } // namespace hpactor::tracing
|