@@ -78,13 +78,88 @@ func TestNewSDK(t *testing.T) {
78
78
}
79
79
}
80
80
81
- var v02OpenTelemetryConfig = OpenTelemetryConfiguration {
81
+ var v03OpenTelemetryConfig = OpenTelemetryConfiguration {
82
82
Disabled : ptr (false ),
83
- FileFormat : "0.2" ,
83
+ FileFormat : ptr ( "0.3" ) ,
84
84
AttributeLimits : & AttributeLimits {
85
85
AttributeCountLimit : ptr (128 ),
86
86
AttributeValueLengthLimit : ptr (4096 ),
87
87
},
88
+ Instrumentation : & Instrumentation {
89
+ Cpp : LanguageSpecificInstrumentation {
90
+ "example" : map [string ]interface {}{
91
+ "property" : "value" ,
92
+ },
93
+ },
94
+ Dotnet : LanguageSpecificInstrumentation {
95
+ "example" : map [string ]interface {}{
96
+ "property" : "value" ,
97
+ },
98
+ },
99
+ Erlang : LanguageSpecificInstrumentation {
100
+ "example" : map [string ]interface {}{
101
+ "property" : "value" ,
102
+ },
103
+ },
104
+ General : & GeneralInstrumentation {
105
+ Http : & GeneralInstrumentationHttp {
106
+ Client : & GeneralInstrumentationHttpClient {
107
+ RequestCapturedHeaders : []string {"Content-Type" , "Accept" },
108
+ ResponseCapturedHeaders : []string {"Content-Type" , "Content-Encoding" },
109
+ },
110
+ Server : & GeneralInstrumentationHttpServer {
111
+ RequestCapturedHeaders : []string {"Content-Type" , "Accept" },
112
+ ResponseCapturedHeaders : []string {"Content-Type" , "Content-Encoding" },
113
+ },
114
+ },
115
+ Peer : & GeneralInstrumentationPeer {
116
+ ServiceMapping : []GeneralInstrumentationPeerServiceMappingElem {
117
+ {Peer : "1.2.3.4" , Service : "FooService" },
118
+ {Peer : "2.3.4.5" , Service : "BarService" },
119
+ },
120
+ },
121
+ },
122
+ Go : LanguageSpecificInstrumentation {
123
+ "example" : map [string ]interface {}{
124
+ "property" : "value" ,
125
+ },
126
+ },
127
+ Java : LanguageSpecificInstrumentation {
128
+ "example" : map [string ]interface {}{
129
+ "property" : "value" ,
130
+ },
131
+ },
132
+ Js : LanguageSpecificInstrumentation {
133
+ "example" : map [string ]interface {}{
134
+ "property" : "value" ,
135
+ },
136
+ },
137
+ Php : LanguageSpecificInstrumentation {
138
+ "example" : map [string ]interface {}{
139
+ "property" : "value" ,
140
+ },
141
+ },
142
+ Python : LanguageSpecificInstrumentation {
143
+ "example" : map [string ]interface {}{
144
+ "property" : "value" ,
145
+ },
146
+ },
147
+ Ruby : LanguageSpecificInstrumentation {
148
+ "example" : map [string ]interface {}{
149
+ "property" : "value" ,
150
+ },
151
+ },
152
+ Rust : LanguageSpecificInstrumentation {
153
+ "example" : map [string ]interface {}{
154
+ "property" : "value" ,
155
+ },
156
+ },
157
+ Swift : LanguageSpecificInstrumentation {
158
+ "example" : map [string ]interface {}{
159
+ "property" : "value" ,
160
+ },
161
+ },
162
+ },
88
163
LoggerProvider : & LoggerProvider {
89
164
Limits : & LogRecordLimits {
90
165
AttributeCountLimit : ptr (128 ),
@@ -100,13 +175,14 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
100
175
ClientCertificate : ptr ("/app/cert.pem" ),
101
176
ClientKey : ptr ("/app/cert.pem" ),
102
177
Compression : ptr ("gzip" ),
103
- Endpoint : "http://localhost:4318" ,
104
- Headers : Headers {
105
- "api-key" : "1234" ,
178
+ Endpoint : ptr ( "http://localhost:4318/v1/logs" ) ,
179
+ Headers : [] NameStringValuePair {
180
+ { Name : "api-key" , Value : ptr ( "1234" )} ,
106
181
},
107
- Insecure : ptr (false ),
108
- Protocol : "http/protobuf" ,
109
- Timeout : ptr (10000 ),
182
+ HeadersList : ptr ("api-key=1234" ),
183
+ Insecure : ptr (false ),
184
+ Protocol : ptr ("http/protobuf" ),
185
+ Timeout : ptr (10000 ),
110
186
},
111
187
},
112
188
MaxExportBatchSize : ptr (512 ),
@@ -126,8 +202,11 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
126
202
MeterProvider : & MeterProvider {
127
203
Readers : []MetricReader {
128
204
{
205
+ Producers : []MetricProducer {
206
+ {Opencensus : MetricProducerOpencensus {}},
207
+ },
129
208
Pull : & PullMetricReader {
130
- Exporter : MetricExporter {
209
+ Exporter : PullMetricExporter {
131
210
Prometheus : & Prometheus {
132
211
Host : ptr ("localhost" ),
133
212
Port : ptr (9464 ),
@@ -143,20 +222,24 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
143
222
},
144
223
},
145
224
{
225
+ Producers : []MetricProducer {
226
+ {},
227
+ },
146
228
Periodic : & PeriodicMetricReader {
147
- Exporter : MetricExporter {
229
+ Exporter : PushMetricExporter {
148
230
OTLP : & OTLPMetric {
149
231
Certificate : ptr ("/app/cert.pem" ),
150
232
ClientCertificate : ptr ("/app/cert.pem" ),
151
233
ClientKey : ptr ("/app/cert.pem" ),
152
234
Compression : ptr ("gzip" ),
153
235
DefaultHistogramAggregation : ptr (OTLPMetricDefaultHistogramAggregationBase2ExponentialBucketHistogram ),
154
- Endpoint : "http://localhost:4318" ,
155
- Headers : Headers {
156
- "api-key" : "1234" ,
236
+ Endpoint : ptr ( "http://localhost:4318/v1/metrics" ) ,
237
+ Headers : [] NameStringValuePair {
238
+ { Name : "api-key" , Value : ptr ( "1234" )} ,
157
239
},
240
+ HeadersList : ptr ("api-key=1234" ),
158
241
Insecure : ptr (false ),
159
- Protocol : "http/protobuf" ,
242
+ Protocol : ptr ( "http/protobuf" ) ,
160
243
TemporalityPreference : ptr ("delta" ),
161
244
Timeout : ptr (10000 ),
162
245
},
@@ -167,7 +250,7 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
167
250
},
168
251
{
169
252
Periodic : & PeriodicMetricReader {
170
- Exporter : MetricExporter {
253
+ Exporter : PushMetricExporter {
171
254
Console : Console {},
172
255
},
173
256
},
@@ -190,20 +273,32 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
190
273
RecordMinMax : ptr (true ),
191
274
},
192
275
},
193
- AttributeKeys : []string {"key1" , "key2" },
194
- Description : ptr ("new_description" ),
195
- Name : ptr ("new_instrument_name" ),
276
+ AttributeKeys : & IncludeExclude {
277
+ Included : []string {"key1" , "key2" },
278
+ Excluded : []string {"key3" },
279
+ },
280
+ Description : ptr ("new_description" ),
281
+ Name : ptr ("new_instrument_name" ),
196
282
},
197
283
},
198
284
},
199
285
},
200
286
Propagator : & Propagator {
201
- Composite : []string {"tracecontext" , "baggage" , "b3" , "b3multi" , "jaeger" , "xray" , "ottrace" },
287
+ Composite : []* string {ptr ( "tracecontext" ), ptr ( "baggage" ), ptr ( "b3" ), ptr ( "b3multi" ), ptr ( "jaeger" ), ptr ( "xray" ), ptr ( "ottrace" ) },
202
288
},
203
289
Resource : & Resource {
204
- Attributes : Attributes {
205
- "service.name" : "unknown_service" ,
290
+ Attributes : []AttributeNameValue {
291
+ {Name : "service.name" , Value : "unknown_service" },
292
+ {Name : "string_key" , Type : & AttributeNameValueType {Value : "string" }, Value : "value" },
293
+ {Name : "bool_key" , Type : & AttributeNameValueType {Value : "bool" }, Value : true },
294
+ {Name : "int_key" , Type : & AttributeNameValueType {Value : "int" }, Value : float64 (1 )},
295
+ {Name : "double_key" , Type : & AttributeNameValueType {Value : "double" }, Value : 1.1 },
296
+ {Name : "string_array_key" , Type : & AttributeNameValueType {Value : "string_array" }, Value : []interface {}{"value1" , "value2" }},
297
+ {Name : "bool_array_key" , Type : & AttributeNameValueType {Value : "bool_array" }, Value : []interface {}{true , false }},
298
+ {Name : "int_array_key" , Type : & AttributeNameValueType {Value : "int_array" }, Value : []interface {}{float64 (1 ), float64 (2 )}},
299
+ {Name : "double_array_key" , Type : & AttributeNameValueType {Value : "double_array" }, Value : []interface {}{1.1 , 2.2 }},
206
300
},
301
+ AttributesList : ptr ("service.namespace=my-namespace,service.version=1.0.0" ),
207
302
Detectors : & Detectors {
208
303
Attributes : & DetectorsAttributes {
209
304
Excluded : []string {"process.command_args" },
@@ -231,13 +326,14 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
231
326
ClientCertificate : ptr ("/app/cert.pem" ),
232
327
ClientKey : ptr ("/app/cert.pem" ),
233
328
Compression : ptr ("gzip" ),
234
- Endpoint : "http://localhost:4318" ,
235
- Headers : Headers {
236
- "api-key" : "1234" ,
329
+ Endpoint : ptr ( "http://localhost:4318/v1/traces" ) ,
330
+ Headers : [] NameStringValuePair {
331
+ { Name : "api-key" , Value : ptr ( "1234" )} ,
237
332
},
238
- Insecure : ptr (false ),
239
- Protocol : "http/protobuf" ,
240
- Timeout : ptr (10000 ),
333
+ HeadersList : ptr ("api-key=1234" ),
334
+ Insecure : ptr (false ),
335
+ Protocol : ptr ("http/protobuf" ),
336
+ Timeout : ptr (10000 ),
241
337
},
242
338
},
243
339
MaxExportBatchSize : ptr (512 ),
@@ -249,7 +345,7 @@ var v02OpenTelemetryConfig = OpenTelemetryConfiguration{
249
345
Batch : & BatchSpanProcessor {
250
346
Exporter : SpanExporter {
251
347
Zipkin : & Zipkin {
252
- Endpoint : "http://localhost:9411/api/v2/spans" ,
348
+ Endpoint : ptr ( "http://localhost:9411/api/v2/spans" ) ,
253
349
Timeout : ptr (10000 ),
254
350
},
255
351
},
@@ -300,7 +396,7 @@ func TestParseYAML(t *testing.T) {
300
396
wantErr : nil ,
301
397
wantType : & OpenTelemetryConfiguration {
302
398
Disabled : ptr (false ),
303
- FileFormat : "0.1" ,
399
+ FileFormat : ptr ( "0.1" ) ,
304
400
},
305
401
},
306
402
{
@@ -310,9 +406,19 @@ func TestParseYAML(t *testing.T) {
310
406
line 2: cannot unmarshal !!str ` + "`notabool`" + ` into bool` ),
311
407
},
312
408
{
313
- name : "valid v0.2 config" ,
314
- input : "v0.2.yaml" ,
315
- wantType : & v02OpenTelemetryConfig ,
409
+ name : "valid v0.2 config" ,
410
+ input : "v0.2.yaml" ,
411
+ wantErr : errors .New (`yaml: unmarshal errors:
412
+ line 81: cannot unmarshal !!map into []config.NameStringValuePair
413
+ line 185: cannot unmarshal !!map into []config.NameStringValuePair
414
+ line 244: cannot unmarshal !!seq into config.IncludeExclude
415
+ line 305: cannot unmarshal !!map into []config.NameStringValuePair
416
+ line 408: cannot unmarshal !!map into []config.AttributeNameValue` ),
417
+ },
418
+ {
419
+ name : "valid v0.3 config" ,
420
+ input : "v0.3.yaml" ,
421
+ wantType : & v03OpenTelemetryConfig ,
316
422
},
317
423
}
318
424
@@ -345,7 +451,7 @@ func TestSerializeJSON(t *testing.T) {
345
451
wantErr : nil ,
346
452
wantType : OpenTelemetryConfiguration {
347
453
Disabled : ptr (false ),
348
- FileFormat : "0.1" ,
454
+ FileFormat : ptr ( "0.1" ) ,
349
455
},
350
456
},
351
457
{
@@ -354,9 +460,14 @@ func TestSerializeJSON(t *testing.T) {
354
460
wantErr : errors .New (`json: cannot unmarshal string into Go struct field Plain.disabled of type bool` ),
355
461
},
356
462
{
357
- name : "valid v0.2 config" ,
358
- input : "v0.2.json" ,
359
- wantType : v02OpenTelemetryConfig ,
463
+ name : "valid v0.2 config" ,
464
+ input : "v0.2.json" ,
465
+ wantErr : errors .New (`json: cannot unmarshal object into Go struct field LogRecordProcessor.logger_provider.processors.batch of type []config.NameStringValuePair` ),
466
+ },
467
+ {
468
+ name : "valid v0.3 config" ,
469
+ input : "v0.3.json" ,
470
+ wantType : v03OpenTelemetryConfig ,
360
471
},
361
472
}
362
473
0 commit comments