Skip to content

Commit 57e0ce5

Browse files
authored
Merge branch 'main' into mtoff/log_nooptracer_startspan
2 parents e6fef16 + e8b2b8c commit 57e0ce5

File tree

81 files changed

+2420
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2420
-348
lines changed

.github/pull_request_template.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [ ] If this interacts with the agent in a new way, a system test has been added.
3333
- [ ] Add an appropriate team label so this PR gets put in the right place for the release notes.
3434
- [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.
35+
- [ ] For internal contributors, a matching PR should be created to the `v2-dev` branch and reviewed by @DataDog/apm-go.
3536

3637

3738
Unsure? Have a question? Request a review!

.github/workflows/apps/go.mod

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module github.com/DataDog/dd-trace-go/.github/workflows/apps
2+
3+
go 1.23.3
4+
5+
require (
6+
github.com/Masterminds/semver/v3 v3.3.1
7+
github.com/stretchr/testify v1.10.0
8+
golang.org/x/mod v0.22.0
9+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1
10+
)
11+
12+
require (
13+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
14+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
15+
gopkg.in/yaml.v3 v3.0.1 // indirect
16+
)

.github/workflows/apps/go.sum

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
2+
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
3+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
4+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
6+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
8+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
9+
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
10+
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
11+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1 h1:ZIRxAKlr3xr6xbMUDs3IDa6xq+ISv9zxyjaDCfwDjMY=
12+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.1/go.mod h1:PMOSkeY4VfXiuPvGodeNLCZCFYU2VfOvjVI6cX5bGrc=
13+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
14+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
15+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
16+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2024 Datadog, Inc.
5+
6+
package main
7+
8+
import (
9+
"encoding/json"
10+
"fmt"
11+
"sort"
12+
"github.com/Masterminds/semver/v3"
13+
"golang.org/x/mod/modfile"
14+
"net/http"
15+
"os"
16+
"regexp"
17+
"strings"
18+
)
19+
20+
type Tag struct {
21+
Name string
22+
}
23+
24+
func getLatestMajorVersion(repo string) (string, error) {
25+
// Get latest major version available for repo from github.
26+
const apiURL = "https://api.github.com/repos/%s/tags"
27+
url := fmt.Sprintf(apiURL, repo)
28+
29+
resp, err := http.Get(url)
30+
if err != nil {
31+
return "", err
32+
}
33+
defer resp.Body.Close()
34+
35+
if resp.StatusCode != http.StatusOK {
36+
return "", fmt.Errorf("failed to fetch tags: %s", resp.Status)
37+
}
38+
39+
var tags []struct {
40+
Name string `json:"name"`
41+
}
42+
43+
if err := json.NewDecoder(resp.Body).Decode(&tags); err != nil {
44+
return "", err
45+
}
46+
latestByMajor := make(map[int]*semver.Version)
47+
48+
for _, tag := range tags {
49+
v, err := semver.NewVersion(tag.Name)
50+
if err != nil {
51+
continue // Skip invalid versions
52+
}
53+
54+
if v.Prerelease() != "" {
55+
continue // Ignore pre-release versions
56+
}
57+
58+
major := int(v.Major())
59+
if current, exists := latestByMajor[major]; !exists || v.GreaterThan(current) {
60+
latestByMajor[major] = v
61+
}
62+
}
63+
64+
var latestMajor *semver.Version
65+
for _, v := range latestByMajor {
66+
if latestMajor == nil || v.Major() > latestMajor.Major() {
67+
latestMajor = v
68+
}
69+
}
70+
71+
if latestMajor != nil {
72+
return fmt.Sprintf("v%d", latestMajor.Major()), nil
73+
}
74+
75+
return "", fmt.Errorf("no valid versions found")
76+
77+
}
78+
79+
func main() {
80+
81+
data, err := os.ReadFile("integration_go.mod")
82+
if err != nil {
83+
fmt.Println("Error reading integration_go.mod:", err)
84+
return
85+
}
86+
87+
modFile, err := modfile.Parse("integration_go.mod", data, nil)
88+
if err != nil {
89+
fmt.Println("Error parsing integration_go.mod:", err)
90+
return
91+
}
92+
93+
latestMajor := make(map[string]*semver.Version)
94+
95+
// Match on versions with /v{major}
96+
versionRegex := regexp.MustCompile(`^(?P<module>.+?)/v(\d+)$`)
97+
98+
// Iterate over the required modules and update latest major version if necessary
99+
for _, req := range modFile.Require {
100+
module := req.Mod.Path
101+
102+
if match := versionRegex.FindStringSubmatch(module); match != nil {
103+
url := match[1] // base module URL (e.g., github.com/foo)
104+
majorVersionStr := "v" + match[2] // Create semantic version string (e.g., "v2")
105+
106+
moduleName := strings.TrimPrefix(strings.TrimSpace(url), "github.com/")
107+
108+
// Parse the semantic version
109+
majorVersion, err := semver.NewVersion(majorVersionStr)
110+
if err != nil {
111+
fmt.Printf("Skip invalid version for module %s: %v\n", module, err)
112+
continue
113+
}
114+
115+
if existing, ok := latestMajor[moduleName]; !ok || majorVersion.GreaterThan(existing) {
116+
latestMajor[moduleName] = majorVersion
117+
}
118+
}
119+
}
120+
121+
// Output latest major version that we support.
122+
// Check if a new major version in Github is available that we don't support.
123+
// If so, output that a new latest is available.
124+
125+
// Sort the output
126+
modules := make([]string, 0, len(latestMajor))
127+
for module := range latestMajor {
128+
modules = append(modules, module)
129+
}
130+
sort.Strings(modules)
131+
132+
for _, module := range modules {
133+
major := latestMajor[module]
134+
135+
latestVersion, err := getLatestMajorVersion(module) // latest version available
136+
if err != nil {
137+
fmt.Printf("Error fetching latest version for module '%s': %v\n", module, err)
138+
continue
139+
}
140+
141+
latestVersionParsed, err := semver.NewVersion(latestVersion)
142+
if err != nil {
143+
fmt.Printf("Error parsing latest version '%s' for module '%s': %v\n", latestVersion, module, err)
144+
continue
145+
}
146+
147+
fmt.Printf("Latest DD major version of %s: %d\n", module, major.Major())
148+
if major.LessThan(latestVersionParsed) {
149+
fmt.Printf("New latest major version of %s available: %d\n", module, latestVersionParsed.Major())
150+
}
151+
152+
}
153+
}

.github/workflows/appsec.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
merge_group:
2020
push:
2121
branches: release-v*
22+
tags-ignore:
23+
- 'contrib/**'
24+
- 'instrumentation/**'
2225

2326
env:
2427
DD_APPSEC_WAF_TIMEOUT: 1m
@@ -97,9 +100,9 @@ jobs:
97100
needs: go-mod-caching
98101
strategy:
99102
matrix:
100-
runs-on: [ macos-12, macos-14 ] # oldest and newest macos runners available - macos-14 mainly is here to cover the fact it is an ARM machine
103+
runs-on: [ macos-13, macos-15 ] # oldest and newest macos runners available - macos-15 is an ARM runner
101104
go-version: [ "1.23", "1.22" ]
102-
fail-fast: true # saving some CI time - macos runners too long to get
105+
fail-fast: true # saving some CI time - macos runners are too long to get
103106
steps:
104107
- uses: actions/checkout@v4
105108

.github/workflows/codeql-analysis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
type: string
1010
push:
1111
branches: [ main, master ]
12+
tags-ignore:
13+
- 'contrib/**'
14+
- 'instrumentation/**'
1215
pull_request:
1316
# The branches below must be a subset of the branches above
1417
branches: [ main ]

.github/workflows/govulncheck.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ on:
99
push:
1010
branches:
1111
- main
12-
- release-v*
12+
- release-v*
13+
tags-ignore:
14+
- 'contrib/**'
15+
- 'instrumentation/**'
1316
schedule:
1417
- cron: '00 00 * * *'
1518
workflow_dispatch:

.github/workflows/main-branch-tests.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111
branches:
1212
- main
1313
- release-v*
14-
tags:
15-
- "**"
14+
tags-ignore:
15+
- 'contrib/**'
16+
- 'instrumentation/**'
1617

1718
concurrency:
1819
group: ${{ github.ref }}

.github/workflows/orchestrion.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
push:
77
branches:
88
- release-v*
9+
tags-ignore:
10+
- 'contrib/**'
11+
- 'instrumentation/**'
912

1013
permissions: read-all
1114

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Outdated Integrations
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC
5+
workflow_dispatch:
6+
7+
concurrency:
8+
# Automatically cancel previous runs if a new one is triggered to conserve resources.
9+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test:
14+
name: Find new major versions for the contrib package dependencies
15+
runs-on: ubuntu-latest
16+
permissions:
17+
actions: read
18+
contents: write
19+
pull-requests: write
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- run: go get github.com/Masterminds/semver/v3
26+
27+
- run: go run .github/workflows/apps/latest_major_version.go > latests.txt
28+
29+
- run: git diff
30+
31+
- name: Create Pull Request
32+
id: pr
33+
uses: peter-evans/create-pull-request@v6
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
branch: "upgrade-latest-major-version"
37+
commit-message: "Update latests file"
38+
base: main
39+
title: "chore: update latest majors"
40+
labels: changelog/no-changelog
41+
body: "Auto-generated PR from Outdated Integrations workflow to update latests major versions"

.github/workflows/parametric-tests.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111
branches:
1212
- main
1313
- release-v*
14-
tags:
15-
- "**"
14+
tags-ignore:
15+
- 'contrib/**'
16+
- 'instrumentation/**'
1617
pull_request:
1718
branches:
1819
- "**"

.github/workflows/pull-request.yml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
push:
99
branches:
1010
- 'mq-working-branch-**'
11+
tags-ignore:
12+
- 'contrib/**'
13+
- 'instrumentation/**'
1114

1215
concurrency:
1316
group: ${{ github.ref }}

.github/workflows/smoke-tests.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ on:
1515
branches:
1616
- main
1717
- release-v*
18-
tags:
19-
- '**'
18+
tags-ignore:
19+
- 'contrib/**'
20+
- 'instrumentation/**'
2021
schedule: # nightly
2122
- cron: "0 0 * * *"
2223
workflow_dispatch: {} # manually

.github/workflows/system-tests.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ on:
1111
branches:
1212
- main
1313
- release-v*
14-
tags:
15-
- "**"
14+
tags-ignore:
15+
- 'contrib/**'
16+
- 'instrumentation/**'
1617
pull_request:
1718
branches:
1819
- "**"

CODEOWNERS

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Note: Later matches take precedence
22

33
# default owner
4-
* @DataDog/dd-trace-go-guild
4+
* @DataDog/dd-trace-go-guild @DataDog/apm-go
55

66
# no owner: changes to these files will not automatically ping any particular
77
# team and can be reviewed by anybody with the appropriate permissions. This is
@@ -15,22 +15,22 @@ go.sum
1515
/ddtrace @DataDog/apm-go
1616

1717
# profiling
18-
/profiler @DataDog/profiling-go
19-
/internal/traceprof @DataDog/profiling-go
18+
/profiler @DataDog/profiling-go @DataDog/apm-go
19+
/internal/traceprof @DataDog/profiling-go @DataDog/apm-go
2020

2121
# appsec
22-
/appsec @DataDog/asm-go
23-
/internal/appsec @DataDog/asm-go
24-
/contrib/**/*appsec*.go @DataDog/asm-go
25-
/.github/workflows/appsec.yml @DataDog/asm-go
22+
/appsec @DataDog/asm-go @DataDog/apm-go
23+
/internal/appsec @DataDog/asm-go @DataDog/apm-go
24+
/contrib/**/*appsec*.go @DataDog/asm-go @DataDog/apm-go
25+
/.github/workflows/appsec.yml @DataDog/asm-go @DataDog/apm-go
2626

2727
# datastreams
28-
/datastreams @Datadog/data-streams-monitoring
29-
/internal/datastreams @Datadog/data-streams-monitoring
28+
/datastreams @Datadog/data-streams-monitoring @DataDog/apm-go
29+
/internal/datastreams @Datadog/data-streams-monitoring @DataDog/apm-go
3030

3131
# civisibility
32-
/internal/civisibility @DataDog/ci-app-libraries
32+
/internal/civisibility @DataDog/ci-app-libraries @DataDog/apm-go
3333

3434
# Gitlab configuration
35-
.gitlab-ci.yml @DataDog/dd-trace-go-guild @DataDog/apm-core-reliability-and-performance
36-
/.gitlab-ci @DataDog/dd-trace-go-guild @DataDog/apm-core-reliability-and-performance
35+
.gitlab-ci.yml @DataDog/dd-trace-go-guild @DataDog/apm-core-reliability-and-performance @DataDog/apm-go
36+
/.gitlab-ci @DataDog/dd-trace-go-guild @DataDog/apm-core-reliability-and-performance @DataDog/apm-go

0 commit comments

Comments
 (0)