integrationsupport

package
v3.23.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package integrationsupport exists to expose functionality to integration packages without adding noise to the public API.

Index

Constants

View Source
const (
	SampleAppName = "my app"
)

This code below is used for testing and is based on the similar code in internal_test.go in the newrelic package. That code is not exported, though, and we frequently need something similar for integration packages, so it is copied here.

Variables

View Source
var BasicConfigFn = func(cfg *newrelic.Config) {
	cfg.Enabled = false
}

BasicConfigFn is a default config function to be used when no special settings are needed for a test app

View Source
var DTEnabledCfgFn = func(cfg *newrelic.Config) {
	cfg.Enabled = false
	cfg.DistributedTracer.Enabled = true
}

DTEnabledCfgFn is a reusable Config function that sets Distributed Tracing to enabled

View Source
var SampleEverythingReplyFn = func(reply *internal.ConnectReply) {
	reply.AdaptiveSampler = internal.SampleEverything{}
}

SampleEverythingReplyFn is a reusable ConnectReply function that samples everything

Functions

func AddAgentAttribute

func AddAgentAttribute(txn newrelic.Transaction, id internal.AgentAttributeID, stringVal string, otherVal interface{})

AddAgentAttribute allows instrumentation packages to add agent attributes.

func AddAgentSpanAttribute

func AddAgentSpanAttribute(txn newrelic.Transaction, key internal.SpanAttribute, val string)

AddAgentSpanAttribute allows instrumentation packages to add span attributes.

Types

type ExpectApp

type ExpectApp interface {
	internal.Expect
	newrelic.Application
}

ExpectApp combines Application and Expect, for use in validating data in test apps

func NewBasicTestApp

func NewBasicTestApp() ExpectApp

NewBasicTestApp creates an ExpectApp with the standard testing connect reply function and config

func NewTestApp

func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn func(*newrelic.Config)) ExpectApp

NewTestApp creates an ExpectApp with the given ConnectReply function and Config function

Jump to

Keyboard shortcuts

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