Skip to content

Commit

Permalink
lint: align structs for pointer bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
kruskall committed Aug 2, 2023
1 parent 1aecc3e commit ba130c9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions input/elasticapm/internal/modeldecoder/rumv3/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ type contextServiceRuntime struct {

type errorEvent struct {
_ struct{} `validate:"requiredAnyOf=ex;log"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch.
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
// Log holds additional information added when the error is logged.
Log errorLog `json:"log"`
// Culprit identifies the function call which was the primary perpetrator
Expand All @@ -184,6 +181,9 @@ type errorEvent struct {
Transaction errorTransactionRef `json:"x"`
// Context holds arbitrary contextual information for the event.
Context context `json:"c"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch.
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
}

type errorException struct {
Expand Down
30 changes: 15 additions & 15 deletions input/elasticapm/internal/modeldecoder/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ type contextServiceRuntime struct {
// captured by an APM agent in a monitored service.
type errorEvent struct {
_ struct{} `validate:"requiredAnyOf=exception;log"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch.
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
// Log holds additional information added when the error is logged.
Log errorLog `json:"log"`
// Culprit identifies the function call which was the primary perpetrator
Expand All @@ -371,6 +368,9 @@ type errorEvent struct {
Transaction errorTransactionRef `json:"transaction"`
// Context holds arbitrary contextual information for the event.
Context context `json:"context"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch.
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
}

type errorException struct {
Expand Down Expand Up @@ -631,9 +631,6 @@ type networkConnection struct {
}

type metricset struct {
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
// Samples hold application metrics collected from the agent.
Samples map[string]metricsetSampleValue `json:"samples" validate:"required,patternKeys=patternNoAsteriskQuote"`
// Span holds selected information about the correlated transaction.
Expand All @@ -648,6 +645,9 @@ type metricset struct {
Service metricsetServiceRef `json:"service"`
// FAAS holds fields related to Function as a Service events.
FAAS faas `json:"faas"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
}

type metricsetSampleValue struct {
Expand Down Expand Up @@ -710,9 +710,6 @@ type metricsetServiceRef struct {

type span struct {
_ struct{} `validate:"requiredAnyOf=start;timestamp"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
// OTel contains unmapped OpenTelemetry attributes.
OTel otel `json:"otel"`
// ID holds the hex encoded 64 random bits ID of the event.
Expand Down Expand Up @@ -760,6 +757,9 @@ type span struct {
Duration nullable.Float64 `json:"duration" validate:"required,min=0"`
// Sync indicates whether the span was executed synchronously or asynchronously.
Sync nullable.Bool `json:"sync"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
}

type spanContext struct {
Expand Down Expand Up @@ -905,9 +905,6 @@ type transaction struct {
// a transaction. Marks are organized into groups and can be set by the
// user or the agent. Marks are only reported by RUM agents.
Marks transactionMarks `json:"marks"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
// OTel contains unmapped OpenTelemetry attributes.
OTel otel `json:"otel"`
// Links holds links to other spans, potentially in other traces.
Expand Down Expand Up @@ -958,14 +955,14 @@ type transaction struct {
// is captured. If a transaction is unsampled no spans and less context
// information will be reported.
Sampled nullable.Bool `json:"sampled"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"timestamp"`
}

type log struct {
// Labels are a flat mapping of user-defined key-value pairs.
Labels map[string]any `json:"labels" validate:"inputTypesVals=string;bool;number,maxLengthVals=1024"`
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"@timestamp"`
// Below embedded fields are added to enable supporting both nested and flat JSON.
// This is achieved by generating code using static analysis of these structs.
// The logic parses JSON tag of each struct field to produce a code which, at runtime,
Expand All @@ -992,6 +989,9 @@ type log struct {
// The logic parses JSON tag of each struct field to produce a code which, at runtime,
// checks the nested map to retrieve the required value for each field.
EcsLogLogFields
// Timestamp holds the recorded time of the event, UTC based and formatted
// as microseconds since Unix epoch
Timestamp nullable.TimeMicrosUnix `json:"@timestamp"`
}

// EcsLogEventFields holds event.* fields for supporting ECS logging format and enables
Expand Down
2 changes: 1 addition & 1 deletion input/otlp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ func histogramSample(bucketCounts pcommon.UInt64Slice, explicitBounds pcommon.Fl
type metricsets map[metricsetKey]metricset

type metricsetKey struct {
timestamp uint64
signature string // combination of all attributes
timestamp uint64
}

type metricset struct {
Expand Down
2 changes: 1 addition & 1 deletion model/modeljson/internal/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ type Document struct {
Process *Process `json:"process,omitempty"`
Event *Event `json:"event,omitempty"`

Timestamp Time `json:"@timestamp"`
DataStream *DataStream `json:"data_stream,omitempty"`
Message string `json:"message,omitempty"`
DocCount uint64 `json:"_doc_count,omitempty"`
Timestamp Time `json:"@timestamp"`
}

type Time uint64
Expand Down
2 changes: 1 addition & 1 deletion model/modeljson/internal/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ type Event struct {
Dataset string `json:"dataset,omitempty"`
Kind string `json:"kind,omitempty"`
Category string `json:"category,omitempty"`
Received Time `json:"received,omitempty"`
Type string `json:"type,omitempty"`
SuccessCount SummaryMetric `json:"success_count,omitempty"`
Duration int64 `json:"duration,omitempty"`
Severity uint64 `json:"severity,omitempty"`
Received Time `json:"received,omitempty"`
}

0 comments on commit ba130c9

Please sign in to comment.