-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dario.castane/langplat-286/origin-detection
- Loading branch information
Showing
52 changed files
with
1,310 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
for file in "$@"; do | ||
temp_file="tempfile.xml" | ||
|
||
# force write a new line at the end of the gotestsum-report.xml, or else | ||
# the loop will skip the last line. | ||
# fixes issue with a missing </testsuites> | ||
echo -e "\n" >> $file | ||
|
||
while read p; do | ||
# we might try to report gotestsum-report.xml multiple times, so don't | ||
# calculate codeowners more times than we need | ||
if [[ "$p" =~ \<testcase && ! "$p" =~ "file=" ]]; then | ||
class=$(echo "$p" | grep -o '.v1/[^"]*"') | ||
file_name=$(echo "${class:3}" | sed 's/.$//') # trim off the edges to get the path | ||
new_line=$(echo "$p" | sed "s|<testcase \([^>]*\)>|<testcase \1 file=\"$file_name\">|") | ||
echo "$new_line" >> "$temp_file" | ||
else | ||
echo "$p" >> "$temp_file" | ||
fi | ||
done < $file | ||
|
||
mv "$temp_file" $file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,13 @@ | |
package sql | ||
|
||
import ( | ||
"sync" | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-go/v5/statsd" | ||
"github.com/lib/pq" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" | ||
) | ||
|
||
|
@@ -64,3 +68,22 @@ func TestStatsTags(t *testing.T) { | |
}) | ||
resetGlobalConfig() | ||
} | ||
|
||
func TestPollDBStatsStop(t *testing.T) { | ||
driverName := "postgres" | ||
Register(driverName, &pq.Driver{}, WithServiceName("postgres-test"), WithAnalyticsRate(0.2)) | ||
defer unregister(driverName) | ||
db, err := Open(driverName, "postgres://postgres:[email protected]:5432/postgres?sslmode=disable") | ||
require.NoError(t, err) | ||
defer db.Close() | ||
|
||
var wg sync.WaitGroup | ||
stop := make(chan struct{}) | ||
wg.Add(1) | ||
go func() { | ||
defer wg.Done() | ||
pollDBStats(&statsd.NoOpClientDirect{}, db, stop) | ||
}() | ||
close(stop) | ||
wg.Wait() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.