1
0
mirror of https://github.com/golang/go synced 2024-11-19 16:14:49 -07:00
go/internal/telemetry/export/ocagent/wire/common.go
Ian Cottrell 5b08f89bfc internal/telemetry: clean up the exporter api
this shuffles things so there a single exporter API rather than an observer
It also removes most of the globals.
per telemetry type.

Change-Id: Iaa82abe2ded1fff9df8e067ed4a55bcbd9d9591f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/190405
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-08-15 23:56:12 +00:00

102 lines
3.0 KiB
Go

// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package wire
// This file holds common ocagent types
type Node struct {
Identifier *ProcessIdentifier `json:"identifier,omitempty"`
LibraryInfo *LibraryInfo `json:"library_info,omitempty"`
ServiceInfo *ServiceInfo `json:"service_info,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
type Resource struct {
Type string `json:"type,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
type TruncatableString struct {
Value string `json:"value,omitempty"`
TruncatedByteCount int32 `json:"truncated_byte_count,omitempty"`
}
type Attributes struct {
AttributeMap map[string]Attribute `json:"attributeMap,omitempty"`
DroppedAttributesCount int32 `json:"dropped_attributes_count,omitempty"`
}
type StringAttribute struct {
StringValue *TruncatableString `json:"stringValue,omitempty"`
}
type IntAttribute struct {
IntValue int64 `json:"intValue,omitempty"`
}
type BoolAttribute struct {
BoolValue bool `json:"boolValue,omitempty"`
}
type DoubleAttribute struct {
DoubleValue float64 `json:"doubleValue,omitempty"`
}
type Attribute interface {
tagAttribute()
}
func (StringAttribute) tagAttribute() {}
func (IntAttribute) tagAttribute() {}
func (BoolAttribute) tagAttribute() {}
func (DoubleAttribute) tagAttribute() {}
type StackTrace struct {
StackFrames *StackFrames `json:"stack_frames,omitempty"`
StackTraceHashId uint64 `json:"stack_trace_hash_id,omitempty"`
}
type StackFrames struct {
Frame []*StackFrame `json:"frame,omitempty"`
DroppedFramesCount int32 `json:"dropped_frames_count,omitempty"`
}
type StackFrame struct {
FunctionName *TruncatableString `json:"function_name,omitempty"`
OriginalFunctionName *TruncatableString `json:"original_function_name,omitempty"`
FileName *TruncatableString `json:"file_name,omitempty"`
LineNumber int64 `json:"line_number,omitempty"`
ColumnNumber int64 `json:"column_number,omitempty"`
LoadModule *Module `json:"load_module,omitempty"`
SourceVersion *TruncatableString `json:"source_version,omitempty"`
}
type Module struct {
Module *TruncatableString `json:"module,omitempty"`
BuildId *TruncatableString `json:"build_id,omitempty"`
}
type ProcessIdentifier struct {
HostName string `json:"host_name,omitempty"`
Pid uint32 `json:"pid,omitempty"`
StartTimestamp Timestamp `json:"start_timestamp,omitempty"`
}
type LibraryInfo struct {
Language Language `json:"language,omitempty"`
ExporterVersion string `json:"exporter_version,omitempty"`
CoreLibraryVersion string `json:"core_library_version,omitempty"`
}
type Language int32
const (
LanguageGo Language = 4
)
type ServiceInfo struct {
Name string `json:"name,omitempty"`
}