|
5 | 5 |
|
6 | 6 | import * as yaml from 'yaml'; |
7 | 7 | import { getStringFromEnv } from '@opentelemetry/core'; |
8 | | -import type { ConfigurationModel, GrpcTls, HttpTls } from './generated/types'; |
9 | 8 |
|
10 | 9 | /** |
11 | 10 | * Handle (Environment) variable substitution per |
@@ -105,100 +104,3 @@ function yamlScalarCoerce(value: string): string | null | number | boolean { |
105 | 104 | return value; |
106 | 105 | } |
107 | 106 | } |
108 | | - |
109 | | -export function getGrpcTlsConfig( |
110 | | - certificateFile?: string, |
111 | | - clientKeyFile?: string, |
112 | | - clientCertificateFile?: string, |
113 | | - insecure?: boolean |
114 | | -): GrpcTls | undefined { |
115 | | - if (certificateFile || clientKeyFile || clientCertificateFile) { |
116 | | - const tls: GrpcTls = {}; |
117 | | - if (certificateFile) { |
118 | | - tls.ca_file = certificateFile; |
119 | | - } |
120 | | - if (clientKeyFile) { |
121 | | - tls.key_file = clientKeyFile; |
122 | | - } |
123 | | - if (clientCertificateFile) { |
124 | | - tls.cert_file = clientCertificateFile; |
125 | | - } |
126 | | - if (insecure !== undefined) { |
127 | | - tls.insecure = insecure; |
128 | | - } |
129 | | - return tls; |
130 | | - } |
131 | | - return undefined; |
132 | | -} |
133 | | - |
134 | | -export function initializeDefaultConfiguration(): ConfigurationModel { |
135 | | - return { |
136 | | - disabled: false, |
137 | | - log_level: 'info', |
138 | | - resource: {}, |
139 | | - attribute_limits: { |
140 | | - attribute_count_limit: 128, |
141 | | - }, |
142 | | - }; |
143 | | -} |
144 | | - |
145 | | -export function initializeDefaultTracerProviderConfiguration(): NonNullable< |
146 | | - ConfigurationModel['tracer_provider'] |
147 | | -> { |
148 | | - return { |
149 | | - processors: [], |
150 | | - limits: { |
151 | | - attribute_count_limit: 128, |
152 | | - event_count_limit: 128, |
153 | | - link_count_limit: 128, |
154 | | - event_attribute_count_limit: 128, |
155 | | - link_attribute_count_limit: 128, |
156 | | - }, |
157 | | - sampler: { |
158 | | - parent_based: { |
159 | | - root: { always_on: null }, |
160 | | - }, |
161 | | - }, |
162 | | - }; |
163 | | -} |
164 | | - |
165 | | -export function initializeDefaultMeterProviderConfiguration(): NonNullable< |
166 | | - ConfigurationModel['meter_provider'] |
167 | | -> { |
168 | | - return { |
169 | | - readers: [], |
170 | | - views: [], |
171 | | - exemplar_filter: 'trace_based', |
172 | | - }; |
173 | | -} |
174 | | - |
175 | | -export function initializeDefaultLoggerProviderConfiguration(): NonNullable< |
176 | | - ConfigurationModel['logger_provider'] |
177 | | -> { |
178 | | - return { |
179 | | - processors: [], |
180 | | - limits: { attribute_count_limit: 128 }, |
181 | | - 'logger_configurator/development': {}, |
182 | | - }; |
183 | | -} |
184 | | - |
185 | | -export function getHttpTlsConfig( |
186 | | - certificateFile?: string, |
187 | | - clientKeyFile?: string, |
188 | | - clientCertificateFile?: string |
189 | | -): HttpTls | undefined { |
190 | | - if (certificateFile || clientKeyFile || clientCertificateFile) { |
191 | | - const tls: HttpTls = {}; |
192 | | - if (certificateFile) { |
193 | | - tls.ca_file = certificateFile; |
194 | | - } |
195 | | - if (clientKeyFile) { |
196 | | - tls.key_file = clientKeyFile; |
197 | | - } |
198 | | - if (clientCertificateFile) { |
199 | | - tls.cert_file = clientCertificateFile; |
200 | | - } |
201 | | - return tls; |
202 | | - } |
203 | | - return undefined; |
204 | | -} |
0 commit comments