File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ type CommenterOptions struct {
40
40
EnableController bool // applicable for web frameworks
41
41
EnableAction bool // applicable for web frameworks
42
42
EnableApplication bool // applicable for web frameworks
43
- Application string // user-provided application-name. not required
43
+ Application string // user-provided application-name. optional
44
44
}
45
45
```
46
46
Original file line number Diff line number Diff line change @@ -95,27 +95,25 @@ func (db *DB) withComment(ctx context.Context, query string) string {
95
95
commentsMap [core .Route ] = ctx .Value (core .Route ).(string )
96
96
}
97
97
98
+ if db .options .EnableTraceparent {
99
+ carrier := core .ExtractTraceparent (ctx )
100
+ if val , ok := carrier ["traceparent" ]; ok {
101
+ commentsMap [core .Traceparent ] = val
102
+ }
103
+ }
104
+
98
105
if db .options .EnableApplication {
99
106
if ! attemptedToAutosetApplication && db .application == "" {
100
107
attemptedToAutosetApplication = true
101
108
bi , ok := debug .ReadBuildInfo ()
102
109
if ok {
103
110
db .application = bi .Path
104
- } else {
105
- db .application = ""
106
111
}
107
112
}
108
113
109
114
commentsMap [core .Application ] = db .application
110
115
}
111
116
112
- if db .options .EnableTraceparent {
113
- carrier := core .ExtractTraceparent (ctx )
114
- if val , ok := carrier ["traceparent" ]; ok {
115
- commentsMap [core .Traceparent ] = val
116
- }
117
- }
118
-
119
117
var commentsString string = ""
120
118
if len (commentsMap ) > 0 { // Converts comments map to string and appends it to query
121
119
commentsString = fmt .Sprintf ("/*%s*/" , core .ConvertMapToComment (commentsMap ))
You can’t perform that action at this time.
0 commit comments