Copy as Markdown
Other Tools
// -*- mode: C++ -*-
// AUTOGENERATED BY glean_parser. DO NOT EDIT.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
#ifndef mozilla_GleanGeckoTraceGeneratedMetrics_h
#define mozilla_GleanGeckoTraceGeneratedMetrics_h
#include "mozilla/JSONStringWriteFuncs.h"
#include "mozilla/glean/bindings/MetricTypes.h"
namespace mozilla::glean {
namespace gecko_trace {
/**
* generated from gecko_trace.traces
*/
struct TracesObjectResourceSpansItemResourceAttributes {
Maybe<int64_t> gecko.process.id;
Maybe<nsCString> gecko.process.type;
Maybe<nsCString> service.name;
Maybe<nsCString> telemetry.sdk.language;
Maybe<nsCString> telemetry.sdk.name;
Maybe<nsCString> telemetry.sdk.version;
};
struct TracesObjectResourceSpansItemResource {
Maybe<TracesObjectResourceSpansItemResourceAttributes> attributes;
Maybe<int64_t> dropped_attributes_count;
};
struct TracesObjectResourceSpansItemScopeSpansItemScope {
Maybe<nsCString> name;
};
struct TracesObjectResourceSpansItemScopeSpansItemSpansItemEventsItemAttributes {
Maybe<nsCString> source.file;
Maybe<int64_t> source.line;
};
struct TracesObjectResourceSpansItemScopeSpansItemSpansItemEventsItem {
Maybe<nsCString> name;
Maybe<int64_t> time_unix_nano;
Maybe<TracesObjectResourceSpansItemScopeSpansItemSpansItemEventsItemAttributes> attributes;
Maybe<int64_t> dropped_attributes_count;
};
using TracesObjectResourceSpansItemScopeSpansItemSpansItemEvents = nsTArray<TracesObjectResourceSpansItemScopeSpansItemSpansItemEventsItem>;
struct TracesObjectResourceSpansItemScopeSpansItemSpansItem {
Maybe<nsCString> trace_id;
Maybe<nsCString> span_id;
Maybe<nsCString> parent_span_id;
Maybe<nsCString> name;
Maybe<int64_t> start_time_unix_nano;
Maybe<int64_t> end_time_unix_nano;
Maybe<TracesObjectResourceSpansItemScopeSpansItemSpansItemEvents> events;
Maybe<int64_t> dropped_events_count;
};
using TracesObjectResourceSpansItemScopeSpansItemSpans = nsTArray<TracesObjectResourceSpansItemScopeSpansItemSpansItem>;
struct TracesObjectResourceSpansItemScopeSpansItem {
Maybe<TracesObjectResourceSpansItemScopeSpansItemScope> scope;
Maybe<TracesObjectResourceSpansItemScopeSpansItemSpans> spans;
};
using TracesObjectResourceSpansItemScopeSpans = nsTArray<TracesObjectResourceSpansItemScopeSpansItem>;
struct TracesObjectResourceSpansItem {
Maybe<TracesObjectResourceSpansItemResource> resource;
Maybe<TracesObjectResourceSpansItemScopeSpans> scope_spans;
};
using TracesObjectResourceSpans = nsTArray<TracesObjectResourceSpansItem>;
struct TracesObject {
Maybe<TracesObjectResourceSpans> resource_spans;
};
/**
* Represents the telemetry traces data collected during browser operation. This data provides insights into errors that occur in Firefox during runtime.
* Based on the [TracesData OTLP](1) protobuf definition which provides a standardized format for collecting and transmitting trace information.
*/
constexpr impl::ObjectMetric<TracesObject, struct TracesObjectTag> traces(4846);
}
template <>
inline void impl::ObjectMetric<gecko_trace::TracesObject, gecko_trace::TracesObjectTag>::Set(const gecko_trace::TracesObject& aObj) const {
nsCString json;
JSONStringRefWriteFunc writeFunc(json);
JSONWriter writer(writeFunc, JSONWriter::CollectionStyle::SingleLineStyle);
writer.StartObjectElement();
{
if (aObj.resource_spans.isSome()) {
writer.StartArrayProperty("resource_spans");
for (const auto& aobjResourceSpansItem: *aObj.resource_spans) {
writer.StartObjectElement();
{
if (aobjResourceSpansItem.resource.isSome()) {
writer.StartObjectProperty("resource");
if (aobjResourceSpansItem.resource->attributes.isSome()) {
writer.StartObjectProperty("attributes");
if (aobjResourceSpansItem.resource->attributes->gecko.process.id.isSome()) {
writer.IntProperty("gecko.process.id", *(aobjResourceSpansItem.resource->attributes->gecko.process.id));
}
if (aobjResourceSpansItem.resource->attributes->gecko.process.type.isSome()) {
writer.StringProperty("gecko.process.type", *(aobjResourceSpansItem.resource->attributes->gecko.process.type));
}
if (aobjResourceSpansItem.resource->attributes->service.name.isSome()) {
writer.StringProperty("service.name", *(aobjResourceSpansItem.resource->attributes->service.name));
}
if (aobjResourceSpansItem.resource->attributes->telemetry.sdk.language.isSome()) {
writer.StringProperty("telemetry.sdk.language", *(aobjResourceSpansItem.resource->attributes->telemetry.sdk.language));
}
if (aobjResourceSpansItem.resource->attributes->telemetry.sdk.name.isSome()) {
writer.StringProperty("telemetry.sdk.name", *(aobjResourceSpansItem.resource->attributes->telemetry.sdk.name));
}
if (aobjResourceSpansItem.resource->attributes->telemetry.sdk.version.isSome()) {
writer.StringProperty("telemetry.sdk.version", *(aobjResourceSpansItem.resource->attributes->telemetry.sdk.version));
}
writer.EndObject();
}
if (aobjResourceSpansItem.resource->dropped_attributes_count.isSome()) {
writer.IntProperty("dropped_attributes_count", *(aobjResourceSpansItem.resource->dropped_attributes_count));
}
writer.EndObject();
}
if (aobjResourceSpansItem.scope_spans.isSome()) {
writer.StartArrayProperty("scope_spans");
for (const auto& aobjresourcespansitemScopeSpansItem: *aobjResourceSpansItem.scope_spans) {
writer.StartObjectElement();
{
if (aobjresourcespansitemScopeSpansItem.scope.isSome()) {
writer.StartObjectProperty("scope");
if (aobjresourcespansitemScopeSpansItem.scope->name.isSome()) {
writer.StringProperty("name", *(aobjresourcespansitemScopeSpansItem.scope->name));
}
writer.EndObject();
}
if (aobjresourcespansitemScopeSpansItem.spans.isSome()) {
writer.StartArrayProperty("spans");
for (const auto& aobjresourcespansitemscopespansitemSpansItem: *aobjresourcespansitemScopeSpansItem.spans) {
writer.StartObjectElement();
{
if (aobjresourcespansitemscopespansitemSpansItem.trace_id.isSome()) {
writer.StringProperty("trace_id", *(aobjresourcespansitemscopespansitemSpansItem.trace_id));
}
if (aobjresourcespansitemscopespansitemSpansItem.span_id.isSome()) {
writer.StringProperty("span_id", *(aobjresourcespansitemscopespansitemSpansItem.span_id));
}
if (aobjresourcespansitemscopespansitemSpansItem.parent_span_id.isSome()) {
writer.StringProperty("parent_span_id", *(aobjresourcespansitemscopespansitemSpansItem.parent_span_id));
}
if (aobjresourcespansitemscopespansitemSpansItem.name.isSome()) {
writer.StringProperty("name", *(aobjresourcespansitemscopespansitemSpansItem.name));
}
if (aobjresourcespansitemscopespansitemSpansItem.start_time_unix_nano.isSome()) {
writer.IntProperty("start_time_unix_nano", *(aobjresourcespansitemscopespansitemSpansItem.start_time_unix_nano));
}
if (aobjresourcespansitemscopespansitemSpansItem.end_time_unix_nano.isSome()) {
writer.IntProperty("end_time_unix_nano", *(aobjresourcespansitemscopespansitemSpansItem.end_time_unix_nano));
}
if (aobjresourcespansitemscopespansitemSpansItem.events.isSome()) {
writer.StartArrayProperty("events");
for (const auto& aobjresourcespansitemscopespansitemspansitemEventsItem: *aobjresourcespansitemscopespansitemSpansItem.events) {
writer.StartObjectElement();
{
if (aobjresourcespansitemscopespansitemspansitemEventsItem.name.isSome()) {
writer.StringProperty("name", *(aobjresourcespansitemscopespansitemspansitemEventsItem.name));
}
if (aobjresourcespansitemscopespansitemspansitemEventsItem.time_unix_nano.isSome()) {
writer.IntProperty("time_unix_nano", *(aobjresourcespansitemscopespansitemspansitemEventsItem.time_unix_nano));
}
if (aobjresourcespansitemscopespansitemspansitemEventsItem.attributes.isSome()) {
writer.StartObjectProperty("attributes");
if (aobjresourcespansitemscopespansitemspansitemEventsItem.attributes->source.file.isSome()) {
writer.StringProperty("source.file", *(aobjresourcespansitemscopespansitemspansitemEventsItem.attributes->source.file));
}
if (aobjresourcespansitemscopespansitemspansitemEventsItem.attributes->source.line.isSome()) {
writer.IntProperty("source.line", *(aobjresourcespansitemscopespansitemspansitemEventsItem.attributes->source.line));
}
writer.EndObject();
}
if (aobjresourcespansitemscopespansitemspansitemEventsItem.dropped_attributes_count.isSome()) {
writer.IntProperty("dropped_attributes_count", *(aobjresourcespansitemscopespansitemspansitemEventsItem.dropped_attributes_count));
}
}
writer.EndObject();
}
writer.EndArray();
}
if (aobjresourcespansitemscopespansitemSpansItem.dropped_events_count.isSome()) {
writer.IntProperty("dropped_events_count", *(aobjresourcespansitemscopespansitemSpansItem.dropped_events_count));
}
}
writer.EndObject();
}
writer.EndArray();
}
}
writer.EndObject();
}
writer.EndArray();
}
}
writer.EndObject();
}
writer.EndArray();
}
}
writer.EndObject();
SetStr(json);
}
} // namespace mozilla::glean
#endif // mozilla_GleanGeckoTraceGeneratedMetrics_h