|
59 | 59 | %% <li>`OTEL_EXPORTER_OTLP_TRACES_HEADERS': Additional headers to add to only trace export requests.</li> |
60 | 60 | %% <li>`OTEL_EXPORTER_OTLP_PROTOCOL': The transport protocol to use, supported values: `grpc' and `http_protobuf'. Defaults to `http_protobuf'.</li> |
61 | 61 | %% <li>`OTEL_EXPORTER_OTLP_TRACES_PROTOCOL': The transport protocol to use for exporting traces, supported values: `grpc' and `http_protobuf'. Defaults to `http_protobuf'.</li> |
62 | | -%% <li>`OTEL_EXPORTER_OTLP_COMPRESSION': Compression to use, supported value: gzip. Defaults to no compression./li> |
| 62 | +%% <li>`OTEL_EXPORTER_OTLP_COMPRESSION': Compression to use, supported value: gzip. Defaults to no compression.</li> |
63 | 63 | %% <li>`OTEL_EXPORTER_OTLP_TRACES_COMPRESSION': Compression to use when exporting traces, supported value: gzip. Defaults to no compression.</li> |
64 | 64 | %% </ul> |
65 | 65 | %% |
|
79 | 79 | merge_with_environment/1]). |
80 | 80 | -endif. |
81 | 81 |
|
82 | | -%% dialyzer will warn about having catch all clauses on these |
83 | | -%% functions because previous clauses cover all cases. But |
84 | | -%% we want to not crash if something incorrect is passed |
85 | | -%% through so we ignore those warnings. |
86 | | --dialyzer({nowarn_function, to_events/2}). |
87 | | --dialyzer({nowarn_function, to_links/2}). |
88 | | --dialyzer({nowarn_function, to_tracestate_string/1}). |
89 | | - |
90 | 82 | -include_lib("kernel/include/logger.hrl"). |
91 | 83 | -include_lib("opentelemetry_api/include/opentelemetry.hrl"). |
92 | 84 | -include_lib("opentelemetry/include/otel_span.hrl"). |
@@ -576,41 +568,28 @@ to_status(_) -> |
576 | 568 |
|
577 | 569 | -spec to_events([#event{}]) -> [opentelemetry_exporter_trace_service_pb:event()]. |
578 | 570 | to_events(Events) -> |
579 | | - to_events(Events, []). |
580 | | - |
581 | | -to_events([], Acc)-> |
582 | | - Acc; |
583 | | -to_events([#event{system_time_nano=Timestamp, |
584 | | - name=Name, |
585 | | - attributes=Attributes} | Rest], Acc) -> |
586 | | - to_events(Rest, [#{time_unix_nano => to_unixnano(Timestamp), |
587 | | - name => to_binary(Name), |
588 | | - attributes => to_attributes(otel_attributes:map(Attributes))} | Acc]); |
589 | | -to_events([_ | Rest], Acc) -> |
590 | | - to_events(Rest, Acc). |
| 571 | + [#{time_unix_nano => to_unixnano(Timestamp), |
| 572 | + name => to_binary(Name), |
| 573 | + attributes => to_attributes(otel_attributes:map(Attributes))} |
| 574 | + || #event{system_time_nano=Timestamp, |
| 575 | + name=Name, |
| 576 | + attributes=Attributes} <- Events]. |
591 | 577 |
|
592 | 578 | -spec to_links([#link{}]) -> [opentelemetry_exporter_trace_service_pb:link()]. |
593 | 579 | to_links(Links) -> |
594 | | - to_links(Links, []). |
| 580 | + [#{trace_id => <<TraceId:128>>, |
| 581 | + span_id => <<SpanId:64>>, |
| 582 | + trace_state => to_tracestate_string(TraceState), |
| 583 | + attributes => to_attributes(otel_attributes:map(Attributes)), |
| 584 | + dropped_attributes_count => 0} || #link{trace_id=TraceId, |
| 585 | + span_id=SpanId, |
| 586 | + attributes=Attributes, |
| 587 | + tracestate=TraceState} <- Links]. |
| 588 | + |
| 589 | +-spec to_tracestate_string(opentelemetry:tracestate()) -> string(). |
| 590 | +to_tracestate_string(List) -> |
| 591 | + lists:join($,, [[Key, $=, Value] || {Key, Value} <- List]). |
595 | 592 |
|
596 | | -to_links([], Acc)-> |
597 | | - Acc; |
598 | | -to_links([#link{trace_id=TraceId, |
599 | | - span_id=SpanId, |
600 | | - attributes=Attributes, |
601 | | - tracestate=TraceState} | Rest], Acc) -> |
602 | | - to_links(Rest, [#{trace_id => <<TraceId:128>>, |
603 | | - span_id => <<SpanId:64>>, |
604 | | - trace_state => to_tracestate_string(TraceState), |
605 | | - attributes => to_attributes(otel_attributes:map(Attributes)), |
606 | | - dropped_attributes_count => 0} | Acc]); |
607 | | -to_links([_ | Rest], Acc) -> |
608 | | - to_links(Rest, Acc). |
609 | | - |
610 | | -to_tracestate_string(List) when is_list(List) -> |
611 | | - lists:join($,, [[Key, $=, Value] || {Key, Value} <- List]); |
612 | | -to_tracestate_string(_) -> |
613 | | - []. |
614 | 593 |
|
615 | 594 | -spec to_otlp_kind(atom()) -> opentelemetry_exporter_trace_service_pb:'span.SpanKind'(). |
616 | 595 | to_otlp_kind(?SPAN_KIND_INTERNAL) -> |
|
0 commit comments