util

package
v0.0.0-...-ec16f60 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2018 StreamSets Inc. 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

http://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.

Copyright 2018 StreamSets Inc. 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

http://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

View Source
const (
	COUNTER_SUFFIX      = ".counter"
	METER_SUFFIX        = ".meter"
	HISTOGRAM_M5_SUFFIX = ".histogramM5"
	TIMER_SUFFIX        = ".timer"
	GAUGE_SUFFIX        = ".gauge"
)

Variables

This section is empty.

Functions

func CastToFloat64

func CastToFloat64(value interface{}) interface{}

func CloseFile

func CloseFile(file *os.File)

func Contains

func Contains(slice []string, e string) bool

func ConvertNanoToSecondsFloat

func ConvertNanoToSecondsFloat(nano float64) float64

func ConvertNanoToSecondsInt

func ConvertNanoToSecondsInt(nano int64) int64

func ConvertTimeToLong

func ConvertTimeToLong(t time.Time) int64

func CreateCounter

func CreateCounter(registry metrics.Registry, name string) metrics.Counter

func CreateHistogram5Min

func CreateHistogram5Min(registry metrics.Registry, name string) metrics.Histogram

func CreateMeter

func CreateMeter(registry metrics.Registry, name string) metrics.Meter

func CreateTimer

func CreateTimer(registry metrics.Registry, name string) metrics.Timer

func GetLastFieldNameFromPath

func GetLastFieldNameFromPath(path string) string

func IndexOf

func IndexOf(word string, data []string) int

func IsStringEmpty

func IsStringEmpty(str *string) bool

func LcFirst

func LcFirst(str string) string

func RandString

func RandString(n int) string

func TruncateString

func TruncateString(str string, num int) string

func UcFirst

func UcFirst(str string) string

Types

type LevelFilter

type LevelFilter struct {
	// Levels is the list of log levels, in increasing order of
	// severity. Example might be: {"DEBUG", "WARN", "ERROR"}.
	Levels []LogLevel

	// MinLevel is the minimum level allowed through
	MinLevel LogLevel

	// The underlying io.Writer where log messages that pass the filter
	// will be set.
	Writer io.Writer
	// contains filtered or unexported fields
}

LevelFilter is an io.Writer that can be used with a logger that will filter out log messages that aren't at least a certain level.

Once the filter is in use somewhere, it is not safe to modify the structure.

func (*LevelFilter) Check

func (f *LevelFilter) Check(line []byte) bool

Check will check a given line if it would be included in the level filter.

func (*LevelFilter) SetMinLevel

func (f *LevelFilter) SetMinLevel(min LogLevel)

SetMinLevel is used to update the minimum log level

func (*LevelFilter) Write

func (f *LevelFilter) Write(p []byte) (n int, err error)

type LogLevel

type LogLevel string

type MetricsJson

type MetricsJson struct {
	Version    string                            `json:"version"`
	Gauges     map[string]map[string]interface{} `json:"gauges"`
	Counters   map[string]map[string]interface{} `json:"counters"`
	Histograms map[string]map[string]interface{} `json:"histograms"`
	Meters     map[string]map[string]interface{} `json:"meters"`
	Timers     map[string]map[string]interface{} `json:"timers"`
}

func FormatMetricsRegistry

func FormatMetricsRegistry(r metrics.Registry) MetricsJson

Jump to

Keyboard shortcuts

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