Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
639756c
feat: add check for existing New Relic application before agent initi…
mirackara Jul 1, 2025
e5ca311
feat: enhance instrumentation by checking for existing New Relic appl…
mirackara Aug 12, 2025
4c4f9c1
feat: add test for semi-instrumented code with New Relic transaction …
mirackara Aug 12, 2025
615ae1a
Added new relic to go mod indirect
mirackara Aug 12, 2025
2c6f2f2
feat: update go.sum to include new New Relic agent and additional dep…
mirackara Aug 12, 2025
ee661b5
feat: add semi-instrumented to tests
mirackara Aug 13, 2025
6073ede
feat: refactor application checks in InstrumentMain for improved clar…
mirackara Aug 21, 2025
1cd3d3a
refactor: de-nest existing app check logic
bduranleau-nr Aug 21, 2025
3762a78
Merge pull request #98 from newrelic/refactor/de-nest-existing-app-check
mirackara Sep 3, 2025
7dd1250
refactor: rename CheckForExistingApplicationInMain to checkForExistin…
mirackara Sep 8, 2025
0a0638f
feat: implement transaction tracking and pre-instrumentation searching
mirackara Sep 19, 2025
525a4f0
feat: add application scanning and transaction caching debugging to i…
mirackara Sep 19, 2025
bee6486
feat: track existing code in function literals
mirackara Sep 19, 2025
e564727
feat: enhance TraceFunction to check for existing segments before cre…
mirackara Sep 19, 2025
a29ed1c
refactor: change naming of semi-instrumented example folders
mirackara Sep 19, 2025
16e522c
feat: implement transaction detection testing
mirackara Oct 14, 2025
5c9bc3c
refactor: transaction cache now stores txns as idents instead of strings
mirackara Oct 14, 2025
14ce145
refactor: standardize transaction parameter naming in functions for t…
mirackara Oct 14, 2025
960f0d2
refactor: update semi-instrumented test case name
mirackara Oct 14, 2025
890c4a2
refactor: de-nest if statements
mirackara Oct 14, 2025
aa449aa
refactor: revert de-nesting in recursive function call checks
mirackara Oct 14, 2025
7a8cb86
refactor: fix trace if gates for adding parameters to functions
mirackara Oct 14, 2025
ab4163f
fix: removed duplicate call graph creation and added expect ref for s…
mirackara Oct 15, 2025
afc74f1
refactor: add call graph creation in InstrumentApplication method for…
mirackara Oct 15, 2025
c9ac416
refactor: create InstrumentTestApplication for clarity in testing con…
mirackara Oct 15, 2025
ab7f4e8
Remove Debug Line
mirackara Oct 15, 2025
2935fed
fix: Remove unneccesary recording var
mirackara Oct 15, 2025
9ae1de8
refactor(transactioncache): unify transaction data in cache (#103)
bduranleau-nr Oct 22, 2025
751f2e8
refactor: simplify ScanApplication and InstrumentApplication signatur…
mirackara Oct 30, 2025
4127de4
Update parser/agent.go
mirackara Oct 30, 2025
139aeeb
refactor: remove unused preinstrumentation tracing function from manager
mirackara Oct 30, 2025
fa7e844
feat: add TracePackageCalls method and remove TestInstrumentApplication
mirackara Oct 30, 2025
860fdf4
Merge branch 'main' into updating
mirackara Oct 30, 2025
b3420fc
refactor: add stateless tracing function to manager before tracing pa…
mirackara Oct 30, 2025
627b9d6
fix: ensure function tracing check only occurs for non-empty function…
mirackara Oct 30, 2025
874577b
refactor: check function name is nil within IsFunctionInTransactionSc…
mirackara Oct 30, 2025
6e2264a
refactor: check if cursor is nil
mirackara Oct 30, 2025
d2ef79c
Update parser/transactioncache/transactioncache.go
mirackara Nov 3, 2025
524ef7a
refactor: enhance application detection functions with additional che…
mirackara Nov 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions end-to-end-tests/semi-instrumented/app-outside-main/expect.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- a/main.go
+++ b/main.go
@@ -18,10 +18,13 @@
}

func noticeErrorWithAttributes(w http.ResponseWriter, r *http.Request) {
+ nrTxn := newrelic.FromContext(r.Context())
+
io.WriteString(w, "Noticing an error")

err := errors.New("error with attributes")
if err != nil {
+ nrTxn.NoticeError(err)
fmt.Println(err)
}
}
@@ -41,8 +40,8 @@
}
myapp.WaitForConnection(5 * time.Second)

- http.HandleFunc("/", index)
- http.HandleFunc("/notice_error_with_attributes", noticeErrorWithAttributes)
+ http.HandleFunc(newrelic.WrapHandleFunc(myapp, "/", index))
+ http.HandleFunc(newrelic.WrapHandleFunc(myapp, "/notice_error_with_attributes", noticeErrorWithAttributes))

http.ListenAndServe(":8000", nil)
}
48 changes: 48 additions & 0 deletions end-to-end-tests/semi-instrumented/app-outside-main/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package main

import (
"errors"
"fmt"
"io"
"net/http"
"time"

"github.com/newrelic/go-agent/v3/newrelic"
)

func index(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "hello world")
}

func noticeErrorWithAttributes(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Noticing an error")

err := errors.New("error with attributes")
if err != nil {
fmt.Println(err)
}
}

func startNRApp() (*newrelic.Application, error) {
app, err := newrelic.NewApplication(
newrelic.ConfigAppName("Example App"),
newrelic.ConfigFromEnvironment(),
)
return app, err
}

func main() {
myapp, err := startNRApp()
if err != nil {
panic(err)
}
myapp.WaitForConnection(5 * time.Second)

http.HandleFunc("/", index)
http.HandleFunc("/notice_error_with_attributes", noticeErrorWithAttributes)

http.ListenAndServe(":8000", nil)
}
Loading
Loading