|
15 | 15 | package v1alpha1 |
16 | 16 |
|
17 | 17 | import ( |
| 18 | + "time" |
| 19 | + |
| 20 | + "go.opentelemetry.io/collector/component" |
18 | 21 | corev1 "k8s.io/api/core/v1" |
19 | 22 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
20 | 23 |
|
@@ -66,6 +69,7 @@ type OutputSpec struct { |
66 | 69 | OTLPGRPC *OTLPGRPC `json:"otlp,omitempty"` |
67 | 70 | Fluentforward *Fluentforward `json:"fluentforward,omitempty"` |
68 | 71 | OTLPHTTP *OTLPHTTP `json:"otlphttp,omitempty"` |
| 72 | + File *File `json:"file,omitempty"` |
69 | 73 | Authentication *OutputAuth `json:"authentication,omitempty"` |
70 | 74 | Batch *Batch `json:"batch,omitempty"` |
71 | 75 | } |
@@ -110,6 +114,99 @@ type OTLPHTTP struct { |
110 | 114 | Encoding *string `json:"encoding,omitempty"` |
111 | 115 | } |
112 | 116 |
|
| 117 | +type formatType string |
| 118 | + |
| 119 | +const ( |
| 120 | + FormatTypeJSON formatType = "json" |
| 121 | + FormatTypeProto formatType = "proto" |
| 122 | +) |
| 123 | + |
| 124 | +type compression string |
| 125 | + |
| 126 | +const ( |
| 127 | + CompressionZstd compression = "zstd" |
| 128 | +) |
| 129 | + |
| 130 | +// File defines configuration for the file exporter. |
| 131 | +type File struct { |
| 132 | + // Path of the file to write to. Path is relative to current directory. |
| 133 | + Path string `json:"path,omitempty"` |
| 134 | + |
| 135 | + // Mode defines whether the exporter should append to the file. |
| 136 | + // Options: |
| 137 | + // - false[default]: truncates the file |
| 138 | + // - true: appends to the file. |
| 139 | + Append bool `json:"append,omitempty"` |
| 140 | + |
| 141 | + // Rotation defines an option about rotation of telemetry files. Ignored |
| 142 | + // when GroupByAttribute is used. |
| 143 | + Rotation *Rotation `json:"rotation,omitempty"` |
| 144 | + |
| 145 | + // +kubebuilder:validation:Enum:=proto;json |
| 146 | + |
| 147 | + // FormatType define the data format of encoded telemetry data |
| 148 | + // Options: |
| 149 | + // - json[default]: OTLP json bytes. |
| 150 | + // - proto: OTLP binary protobuf bytes. |
| 151 | + |
| 152 | + FormatType formatType `json:"format,omitempty"` |
| 153 | + |
| 154 | + // Encoding defines the encoding of the telemetry data. |
| 155 | + // If specified, it overrides `FormatType` and applies an encoding extension. |
| 156 | + Encoding *component.ID `json:"encoding,omitempty"` |
| 157 | + |
| 158 | + // +kubebuilder:validation:Enum:=zstd |
| 159 | + |
| 160 | + // Compression Codec used to export telemetry data |
| 161 | + // Supported compression algorithms:`zstd` |
| 162 | + Compression compression `json:"compression,omitempty"` |
| 163 | + |
| 164 | + // FlushInterval is the duration between flushes. |
| 165 | + // See time.ParseDuration for valid values. |
| 166 | + FlushInterval time.Duration `json:"flush_interval,omitempty"` |
| 167 | + |
| 168 | + // GroupBy enables writing to separate files based on a resource attribute. |
| 169 | + GroupBy *GroupBy `json:"group_by,omitempty"` |
| 170 | +} |
| 171 | + |
| 172 | +// Rotation an option to rolling log files |
| 173 | +type Rotation struct { |
| 174 | + // MaxMegabytes is the maximum size in megabytes of the file before it gets |
| 175 | + // rotated. It defaults to 100 megabytes. |
| 176 | + MaxMegabytes int `json:"max_megabytes,omitempty"` |
| 177 | + |
| 178 | + // MaxDays is the maximum number of days to retain old log files based on the |
| 179 | + // timestamp encoded in their filename. Note that a day is defined as 24 |
| 180 | + // hours and may not exactly correspond to calendar days due to daylight |
| 181 | + // savings, leap seconds, etc. The default is not to remove old log files |
| 182 | + // based on age. |
| 183 | + MaxDays int `json:"max_days,omitempty"` |
| 184 | + |
| 185 | + // MaxBackups is the maximum number of old log files to retain. The default |
| 186 | + // is to 100 files. |
| 187 | + MaxBackups int `json:"max_backups,omitempty"` |
| 188 | + |
| 189 | + // LocalTime determines if the time used for formatting the timestamps in |
| 190 | + // backup files is the computer's local time. The default is to use UTC |
| 191 | + // time. |
| 192 | + LocalTime *bool `json:"localtime,omitempty"` |
| 193 | +} |
| 194 | + |
| 195 | +type GroupBy struct { |
| 196 | + // Enables group_by. When group_by is enabled, rotation setting is ignored. Default is false. |
| 197 | + Enabled bool `json:"enabled,omitempty"` |
| 198 | + |
| 199 | + // ResourceAttribute specifies the name of the resource attribute that |
| 200 | + // contains the path segment of the file to write to. The final path will be |
| 201 | + // the Path config value, with the * replaced with the value of this resource |
| 202 | + // attribute. Default is "fileexporter.path_segment". |
| 203 | + ResourceAttribute string `json:"resource_attribute,omitempty"` |
| 204 | + |
| 205 | + // MaxOpenFiles specifies the maximum number of open file descriptors for the output files. |
| 206 | + // The default is 100. |
| 207 | + MaxOpenFiles int `json:"max_open_files,omitempty"` |
| 208 | +} |
| 209 | + |
113 | 210 | type Endpoint struct { |
114 | 211 | // TCPAddr is the address of the server to connect to. |
115 | 212 | TCPAddr *string `json:"tcp_addr"` |
|
0 commit comments