Version: v0.0.0-...-24d4c76 Latest Latest

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

Go to latest
Published: Oct 16, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0



Package obfuscate implements quantizing and obfuscating of tags and resources for a set of spans matching a certain criteria.



View Source
const (
	EOFChar           = 0x100
	LexError          = 57346
	ID                = 57347
	Limit             = 57348
	Null              = 57349
	String            = 57350
	Number            = 57351
	BooleanLiteral    = 57352
	ValueArg          = 57353
	ListArg           = 57354
	Comment           = 57355
	Variable          = 57356
	Savepoint         = 57357
	PreparedStatement = 57358
	EscapeSequence    = 57359
	NullSafeEqual     = 57360
	LE                = 57361
	GE                = 57362
	NE                = 57363
	As                = 57365

	// Filtered specifies that the given token has been discarded by one of the
	// token filters.
	Filtered = 57364

	// FilteredComma specifies that the token is a comma and was discarded by one
	// of the filters.
	FilteredComma = 57366

	// FilteredBracketedIdentifier specifies that we are currently discarding
	// a bracketed identifier (MSSQL).
	// See issue https://github.com/DataDog/datadog-trace-agent/issues/475.
	FilteredBracketedIdentifier = 57367

list of available tokens; this list has been reduced because we don't need a full-fledged tokenizer to implement a Lexer


This section is empty.


This section is empty.


type Obfuscator

type Obfuscator struct {
	// contains filtered or unexported fields

Obfuscator quantizes and obfuscates spans. The obfuscator is not safe for concurrent use.

func NewObfuscator

func NewObfuscator(cfg *config.ObfuscationConfig) *Obfuscator

NewObfuscator creates a new Obfuscator.

func (*Obfuscator) Obfuscate

func (o *Obfuscator) Obfuscate(span *model.Span)

Obfuscate may obfuscate span's properties based on its type and on the Obfuscator's configuration.

type SyntaxError

type SyntaxError struct {
	Offset int64 // error occurred after reading Offset bytes
	// contains filtered or unexported fields

A SyntaxError is a description of a JSON syntax error.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

type Tokenizer

type Tokenizer struct {
	InStream *strings.Reader
	Position int
	// contains filtered or unexported fields

Tokenizer is the struct used to generate SQL tokens for the parser.

func NewStringTokenizer

func NewStringTokenizer(sql string) *Tokenizer

NewStringTokenizer creates a new Tokenizer for the sql string.

func (*Tokenizer) Reset

func (tkn *Tokenizer) Reset(in string)

Reset the underlying buffer and positions

func (*Tokenizer) Scan

func (tkn *Tokenizer) Scan() (int, []byte)

Scan scans the tokenizer for the next token and returns the token type and the token buffer. TODO[manu]: the current implementation returns a new Buffer for each Scan(). An improvement to reduce the overhead of the Scan() is to return slices instead of buffers.

Jump to

Keyboard shortcuts

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