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 {
4040 EnableController bool // applicable for web frameworks
4141 EnableAction bool // applicable for web frameworks
4242 EnableApplication bool // applicable for web frameworks
43- Application string // user-provided application-name. not required
43+ Application string // user-provided application-name. optional
4444 }
4545```
4646
Original file line number Diff line number Diff line change @@ -95,27 +95,25 @@ func (db *DB) withComment(ctx context.Context, query string) string {
9595 commentsMap [core .Route ] = ctx .Value (core .Route ).(string )
9696 }
9797
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+
98105 if db .options .EnableApplication {
99106 if ! attemptedToAutosetApplication && db .application == "" {
100107 attemptedToAutosetApplication = true
101108 bi , ok := debug .ReadBuildInfo ()
102109 if ok {
103110 db .application = bi .Path
104- } else {
105- db .application = ""
106111 }
107112 }
108113
109114 commentsMap [core .Application ] = db .application
110115 }
111116
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-
119117 var commentsString string = ""
120118 if len (commentsMap ) > 0 { // Converts comments map to string and appends it to query
121119 commentsString = fmt .Sprintf ("/*%s*/" , core .ConvertMapToComment (commentsMap ))
You can’t perform that action at this time.
0 commit comments