Skip to content

Commit 41431dd

Browse files
committed
docs fixes
1 parent c8c0733 commit 41431dd

File tree

4 files changed

+61
-61
lines changed

4 files changed

+61
-61
lines changed

go/core/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ Users are given control over what tags they want to append by using `core.Commen
1616

1717
```go
1818
type CommenterConfig struct {
19-
EnableDBDriver bool
20-
EnableRoute bool
21-
EnableFramework bool
22-
EnableController bool
23-
EnableAction bool
24-
EnableTraceparent bool
25-
EnableApplication bool
19+
EnableDBDriver bool
20+
EnableRoute bool
21+
EnableFramework bool
22+
EnableController bool
23+
EnableAction bool
24+
EnableTraceparent bool
25+
EnableApplication bool
2626
}
2727
```
2828

2929
Users can also set the values for some static tags by using `core.StaticTags` struct.
3030

3131
```go
3232
type StaticTags struct {
33-
Application string
34-
DriverName string
33+
Application string
34+
DriverName string
3535
}
3636
```
3737

3838
These two structs together form the `core.CommenterOptions` struct, which is used by [sqlcommenter/go/database/sql](../database/sql/README.md).
3939

4040
```go
4141
type CommenterOptions struct {
42-
Config CommenterConfig
43-
Tags StaticTags
42+
Config CommenterConfig
43+
Tags StaticTags
4444
}
4545
```

go/database/sql/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Due to inherent nature of Go, the safer way to pass information from framework t
1515

1616
```go
1717
import (
18-
gosql "github.com/google/sqlcommenter/go/database/sql"
19-
sqlcommentercore "github.com/google/sqlcommenter/go/core"
20-
_ "github.com/lib/pq" // or any other database driver
18+
gosql "github.com/google/sqlcommenter/go/database/sql"
19+
sqlcommentercore "github.com/google/sqlcommenter/go/core"
20+
_ "github.com/lib/pq" // or any other database driver
2121
)
2222

2323
db, err := gosql.Open("<driver>", "<connectionString>", sqlcommentercore.CommenterOptions{
24-
Config: sqlcommentercore.CommenterConfig{<flag>:bool}
25-
Tags : sqlcommentercore.StaticTags{<tag>: string} // optional
24+
Config: sqlcommentercore.CommenterConfig{<flag>:bool}
25+
Tags : sqlcommentercore.StaticTags{<tag>: string} // optional
2626
})
2727
```
2828

@@ -32,22 +32,22 @@ Users are given control over what tags they want to append by using `core.Commen
3232

3333
```go
3434
type CommenterOptions struct {
35-
EnableDBDriver bool
36-
EnableTraceparent bool // OpenTelemetry trace information
37-
EnableRoute bool // applicable for web frameworks
38-
EnableFramework bool // applicable for web frameworks
39-
EnableController bool // applicable for web frameworks
40-
EnableAction bool // applicable for web frameworks
41-
EnableApplication bool // applicable for web frameworks
35+
EnableDBDriver bool
36+
EnableTraceparent bool // OpenTelemetry trace information
37+
EnableRoute bool // applicable for web frameworks
38+
EnableFramework bool // applicable for web frameworks
39+
EnableController bool // applicable for web frameworks
40+
EnableAction bool // applicable for web frameworks
41+
EnableApplication bool // applicable for web frameworks
4242
}
4343
```
4444

45-
Users can also provide static tags they want to use by using `core.StaticTags` struct. These tags are optional
45+
Users can also provide static tags they want to use by using `core.StaticTags` struct. These tags are optional. If not provided, the `Application` tag will get auto-populated from the user-project's module-name in `go.mod`. `DriverName` is set to the driver-name provided in `gosql.Open(driverName, ...)` call.
4646

4747
```go
4848
type StaticTags struct {
49-
Application string
50-
DriverName string
49+
Application string
50+
DriverName string
5151
}
5252
```
5353

go/gorrila/mux/README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import (
2020
"net/http"
2121

2222
sqlcommentermux "github.com/google/sqlcommenter/go/gorrila/mux"
23-
"github.com/gorilla/mux"
23+
"github.com/gorilla/mux"
2424
)
2525

2626
func runApp() {
27-
r := mux.NewRouter()
28-
r.Use(sqlcommentermux.SQLCommenterMiddleware)
27+
r := mux.NewRouter()
28+
r.Use(sqlcommentermux.SQLCommenterMiddleware)
2929

30-
r.HandleFunc("/", ActionHome).Methods("GET")
30+
r.HandleFunc("/", ActionHome).Methods("GET")
3131

3232
http.ListenAndServe(":8081", r)
3333
}
@@ -38,49 +38,49 @@ func runApp() {
3838
```go
3939
import (
4040
"context"
41-
"log"
42-
"net/http"
41+
"log"
42+
"net/http"
4343

4444
sqlcommentermux "github.com/google/sqlcommenter/go/gorrila/mux"
45-
"github.com/gorilla/mux"
46-
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
47-
"go.opentelemetry.io/otel"
48-
stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
49-
"go.opentelemetry.io/otel/propagation"
50-
sdktrace "go.opentelemetry.io/otel/sdk/trace"
45+
"github.com/gorilla/mux"
46+
"go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux"
47+
"go.opentelemetry.io/otel"
48+
stdout "go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
49+
"go.opentelemetry.io/otel/propagation"
50+
sdktrace "go.opentelemetry.io/otel/sdk/trace"
5151
)
5252

5353
func main() {
5454
tp, err := initTracer()
55-
if err != nil {
56-
log.Fatal(err)
57-
}
58-
defer func() {
59-
if err := tp.Shutdown(context.Background()); err != nil {
60-
log.Printf("Error shutting down tracer provider: %v", err)
61-
}
62-
}()
55+
if err != nil {
56+
log.Fatal(err)
57+
}
58+
defer func() {
59+
if err := tp.Shutdown(context.Background()); err != nil {
60+
log.Printf("Error shutting down tracer provider: %v", err)
61+
}
62+
}()
6363

64-
r := mux.NewRouter()
65-
r.Use(otelmux.Middleware("sqlcommenter sample-server"), sqlcommentermux.SQLCommenterMiddleware)
64+
r := mux.NewRouter()
65+
r.Use(otelmux.Middleware("sqlcommenter sample-server"), sqlcommentermux.SQLCommenterMiddleware)
6666

67-
r.HandleFunc("/", ActionHome).Methods("GET")
67+
r.HandleFunc("/", ActionHome).Methods("GET")
6868

6969
http.ListenAndServe(":8081", r)
7070
}
7171

7272
func initTracer() (*sdktrace.TracerProvider, error) {
73-
exporter, err := stdout.New(stdout.WithPrettyPrint())
74-
if err != nil {
75-
return nil, err
76-
}
77-
tp := sdktrace.NewTracerProvider(
78-
sdktrace.WithSampler(sdktrace.AlwaysSample()),
79-
sdktrace.WithBatcher(exporter),
80-
)
81-
otel.SetTracerProvider(tp)
82-
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
83-
return tp, nil
73+
exporter, err := stdout.New(stdout.WithPrettyPrint())
74+
if err != nil {
75+
return nil, err
76+
}
77+
tp := sdktrace.NewTracerProvider(
78+
sdktrace.WithSampler(sdktrace.AlwaysSample()),
79+
sdktrace.WithBatcher(exporter),
80+
)
81+
otel.SetTracerProvider(tp)
82+
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
83+
return tp, nil
8484
}
8585
```
8686

go/net/http/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is a low-level package that can be used to prepare SQLCommeneterTags out of
1414

1515
```go
1616
import (
17-
sqlcommenterhttp "github.com/google/sqlcommenter/go/net/http"
17+
sqlcommenterhttp "github.com/google/sqlcommenter/go/net/http"
1818
)
1919

2020
requestTags := sqlcommenterhttp.NewHTTPRequestTags(framework string, route string, action string)

0 commit comments

Comments
 (0)