Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up some style issues and exported functions that should be private #529

Merged
merged 1 commit into from Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions v3/internal/integrationsupport/integrationsupport.go
Expand Up @@ -93,6 +93,7 @@ var DTEnabledCfgFn = func(cfg *newrelic.Config) {
cfg.DistributedTracer.Enabled = true
}

// AppLogEnabledCfgFn enables application logging features
var AppLogEnabledCfgFn = func(cfg *newrelic.Config) {
cfg.Enabled = false
cfg.ApplicationLogging.Enabled = true
Expand Down
1 change: 1 addition & 0 deletions v3/internal/jsonx/encode.go
Expand Up @@ -118,6 +118,7 @@ func AppendFloat(buf *bytes.Buffer, x float64) error {
return nil
}

// AppendFloat32 appends a numeric literal representingthe value to buf.
func AppendFloat32(buf *bytes.Buffer, x float32) error {
var scratch [64]byte
x64 := float64(x)
Expand Down
20 changes: 10 additions & 10 deletions v3/newrelic/internal_app_test.go
Expand Up @@ -78,14 +78,14 @@ const (
SampleAppName = "my app"
)

// ExpectApp combines Application and Expect, for use in validating data in test apps
type ExpectApp struct {
// expectApp combines Application and Expect, for use in validating data in test apps
type expectApplication struct {
internal.Expect
*Application
}

// NewTestApp creates an ExpectApp with the given ConnectReply function and Config function
func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) ExpectApp {
// newTestApp creates an ExpectApp with the given ConnectReply function and Config function
func newTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) expectApplication {
cfgFn = append(cfgFn,
func(cfg *Config) {
// Prevent spawning app goroutines in tests.
Expand All @@ -104,27 +104,27 @@ func NewTestApp(replyfn func(*internal.ConnectReply), cfgFn ...ConfigOption) Exp

internal.HarvestTesting(app.Private, replyfn)

return ExpectApp{
return expectApplication{
Expect: app.Private.(internal.Expect),
Application: app,
}
}

var SampleEverythingReplyFn = func(reply *internal.ConnectReply) {
var sampleEverythingReplyFn = func(reply *internal.ConnectReply) {
reply.SetSampleEverything()
}

var ConfigTestAppLogFn = func(cfg *Config) {
var configTestAppLogFn = func(cfg *Config) {
cfg.Enabled = false
cfg.ApplicationLogging.Enabled = true
cfg.ApplicationLogging.Forwarding.Enabled = true
cfg.ApplicationLogging.Metrics.Enabled = true
}

func TestRecordLog(t *testing.T) {
testApp := NewTestApp(
SampleEverythingReplyFn,
ConfigTestAppLogFn,
testApp := newTestApp(
sampleEverythingReplyFn,
configTestAppLogFn,
)

time := int64(timeToUnixMilliseconds(time.Now()))
Expand Down