info

package
v1.7.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package info provides build-time info

Copyright (C) 2019-2025 vdaas.org vald team <vald@vdaas.org>

Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Version represent Vald version.
	Version = "v0.0.1"
	// GitCommit represent the Vald GitCommit.
	GitCommit = "main"
	// BuildTime represent the Vald Build time.
	BuildTime = ""
	// GoVersion represent the golang version to build Vald.
	GoVersion string
	// GoOS represent the OS version of golang to build Vald.
	GoOS string
	// GoArch represent the architecture target to build Vald.
	GoArch string
	// GoRoot represent the root of the Go tree.
	GoRoot string
	// CGOEnabled represent the cgo is enable or not to build Vald.
	CGOEnabled string
	// AlgorithmInfo represent the NGT version in Vald.
	AlgorithmInfo string
	// BuildCPUInfoFlags represent the CPU info flags to build Vald.
	BuildCPUInfoFlags string

	// Organization represent the organization of Vald.
	Organization = "vdaas"
	// Repository represent the repository of Vald.
	Repository = "vald"
)

Functions

func Init

func Init(name string)

Init initializes Detail object only once.

func String

func String() string

String calls String method of global detail object.

Types

type Detail

type Detail struct {
	AlgorithmInfo     string       `json:"algorithm_info,omitempty"       yaml:"algorithm_info,omitempty"`
	BuildTime         string       `json:"build_time,omitempty"           yaml:"build_time,omitempty"`
	CGOCall           string       `json:"cgo_call,omitempty"             yaml:"cgo_call"`
	CGOEnabled        string       `json:"cgo_enabled,omitempty"          yaml:"cgo_enabled,omitempty"`
	GitCommit         string       `json:"git_commit,omitempty"           yaml:"git_commit,omitempty"`
	GoArch            string       `json:"go_arch,omitempty"              yaml:"go_arch,omitempty"`
	GoMaxProcs        string       `json:"go_max_procs,omitempty"         yaml:"go_max_procs,omitempty"`
	GoOS              string       `json:"go_os,omitempty"                yaml:"go_os,omitempty"`
	GoRoot            string       `json:"go_root,omitempty"              yaml:"go_root,omitempty"`
	GoVersion         string       `json:"go_version,omitempty"           yaml:"go_version,omitempty"`
	GoroutineCount    string       `json:"goroutine_count,omitempty"      yaml:"goroutine_count"`
	RuntimeCPUCores   string       `json:"runtime_cpu_cores,omitempty"    yaml:"runtime_cpu_cores,omitempty"`
	ServerName        string       `json:"server_name,omitempty"          yaml:"server_name,omitempty"`
	Version           string       `json:"vald_version,omitempty"         yaml:"vald_version,omitempty"`
	BuildCPUInfoFlags []string     `json:"build_cpu_info_flags,omitempty" yaml:"build_cpu_info_flags,omitempty"`
	StackTrace        []StackTrace `json:"stack_trace,omitempty"          yaml:"stack_trace,omitempty"`
}

Detail represents environment information of system and stacktrace information.

func Get

func Get() Detail

Get calls Get method of global detail object.

func (Detail) String

func (d Detail) String() string

String returns summary of Detail object. skipcq: RVV-B0006

type Info added in v1.0.3

type Info interface {
	String() string
	Get() Detail
}

Info represents an interface to get the runtime information.

func New added in v1.0.3

func New(opts ...Option) (Info, error)

New initializes and returns the info object or any error occurred.

type Option added in v1.0.3

type Option func(i *info) error

Option represent the functional option for info.

func WithRuntimeCaller added in v1.0.3

func WithRuntimeCaller(f func(skip int) (pc uintptr, file string, line int, ok bool)) Option

WithRuntimeCaller returns the option to set the runtime Caller function.

func WithRuntimeFuncForPC added in v1.0.3

func WithRuntimeFuncForPC(f func(pc uintptr) *runtime.Func) Option

WithRuntimeFuncForPC returns the option to set the runtime FuncForPC function.

func WithServerName added in v1.0.3

func WithServerName(s string) Option

WithServerName returns the option to set the server name.

type StackTrace

type StackTrace struct {
	URL      string `json:"url,omitempty"           yaml:"url,omitempty"`
	FuncName string `json:"function_name,omitempty" yaml:"func_name,omitempty"`
	File     string `json:"file,omitempty"          yaml:"file,omitempty"`
	Line     int    `json:"line,omitempty"          yaml:"line,omitempty"`
}

StackTrace represents stacktrace information about url, function name, file, line ..etc.

func (StackTrace) ShortString added in v1.7.14

func (s StackTrace) ShortString() string

func (StackTrace) String added in v1.0.0

func (s StackTrace) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL