github.com/v2fly/tools@v0.100.0/internal/event/export/ocagent/wire/common.go (about) 1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package wire 6 7 // This file holds common ocagent types 8 9 type Node struct { 10 Identifier *ProcessIdentifier `json:"identifier,omitempty"` 11 LibraryInfo *LibraryInfo `json:"library_info,omitempty"` 12 ServiceInfo *ServiceInfo `json:"service_info,omitempty"` 13 Attributes map[string]string `json:"attributes,omitempty"` 14 } 15 16 type Resource struct { 17 Type string `json:"type,omitempty"` 18 Labels map[string]string `json:"labels,omitempty"` 19 } 20 21 type TruncatableString struct { 22 Value string `json:"value,omitempty"` 23 TruncatedByteCount int32 `json:"truncated_byte_count,omitempty"` 24 } 25 26 type Attributes struct { 27 AttributeMap map[string]Attribute `json:"attributeMap,omitempty"` 28 DroppedAttributesCount int32 `json:"dropped_attributes_count,omitempty"` 29 } 30 31 type StringAttribute struct { 32 StringValue *TruncatableString `json:"stringValue,omitempty"` 33 } 34 35 type IntAttribute struct { 36 IntValue int64 `json:"intValue,omitempty"` 37 } 38 39 type BoolAttribute struct { 40 BoolValue bool `json:"boolValue,omitempty"` 41 } 42 43 type DoubleAttribute struct { 44 DoubleValue float64 `json:"doubleValue,omitempty"` 45 } 46 47 type Attribute interface { 48 labelAttribute() 49 } 50 51 func (StringAttribute) labelAttribute() {} 52 func (IntAttribute) labelAttribute() {} 53 func (BoolAttribute) labelAttribute() {} 54 func (DoubleAttribute) labelAttribute() {} 55 56 type StackTrace struct { 57 StackFrames *StackFrames `json:"stack_frames,omitempty"` 58 StackTraceHashID uint64 `json:"stack_trace_hash_id,omitempty"` 59 } 60 61 type StackFrames struct { 62 Frame []*StackFrame `json:"frame,omitempty"` 63 DroppedFramesCount int32 `json:"dropped_frames_count,omitempty"` 64 } 65 66 type StackFrame struct { 67 FunctionName *TruncatableString `json:"function_name,omitempty"` 68 OriginalFunctionName *TruncatableString `json:"original_function_name,omitempty"` 69 FileName *TruncatableString `json:"file_name,omitempty"` 70 LineNumber int64 `json:"line_number,omitempty"` 71 ColumnNumber int64 `json:"column_number,omitempty"` 72 LoadModule *Module `json:"load_module,omitempty"` 73 SourceVersion *TruncatableString `json:"source_version,omitempty"` 74 } 75 76 type Module struct { 77 Module *TruncatableString `json:"module,omitempty"` 78 BuildID *TruncatableString `json:"build_id,omitempty"` 79 } 80 81 type ProcessIdentifier struct { 82 HostName string `json:"host_name,omitempty"` 83 Pid uint32 `json:"pid,omitempty"` 84 StartTimestamp Timestamp `json:"start_timestamp,omitempty"` 85 } 86 87 type LibraryInfo struct { 88 Language Language `json:"language,omitempty"` 89 ExporterVersion string `json:"exporter_version,omitempty"` 90 CoreLibraryVersion string `json:"core_library_version,omitempty"` 91 } 92 93 type Language int32 94 95 const ( 96 LanguageGo Language = 4 97 ) 98 99 type ServiceInfo struct { 100 Name string `json:"name,omitempty"` 101 }