in prod/native/libphpbridge/code/OtlpExporter/LogsConverter.h [108:140]
void convertLogRecord(AutoZval const &log, opentelemetry::proto::logs::v1::LogRecord *out) {
using namespace std::string_view_literals;
auto body = log.callMethod("getBody"sv);
if (!body.isNull() && !body.isUndef()) {
auto value = AttributesConverter::convertAnyValue(body);
*out->mutable_body() = std::move(value);
}
out->set_time_unix_nano(log.callMethod("getTimestamp"sv).getOptLong().value_or(0));
out->set_observed_time_unix_nano(log.callMethod("getObservedTimestamp"sv).getOptLong().value_or(0));
auto spanContext = log.callMethod("getSpanContext"sv);
if (!spanContext.isNull() && spanContext.callMethod("isValid"sv).getBoolean()) {
out->set_trace_id(spanContext.callMethod("getTraceIdBinary"sv).getStringView());
out->set_span_id(spanContext.callMethod("getSpanIdBinary"sv).getStringView());
out->set_flags(spanContext.callMethod("getTraceFlags"sv).getLong());
}
auto severityNumber = log.callMethod("getSeverityNumber"sv);
if (severityNumber.isLong()) {
out->set_severity_number(static_cast<opentelemetry::proto::logs::v1::SeverityNumber>(severityNumber.getLong()));
}
auto severityText = log.callMethod("getSeverityText"sv);
if (severityText.isString()) {
out->set_severity_text(severityText.getStringView());
}
auto attributes = log.callMethod("getAttributes"sv);
AttributesConverter::convertAttributes(attributes, out->mutable_attributes());
out->set_dropped_attributes_count(attributes.callMethod("getDroppedAttributesCount"sv).getLong());
}