gin

package module
v1.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2023 License: GPL-3.0 Imports: 6 Imported by: 1

README

= gin

[source,bash]
----
go get -v github.com/tel-io/instrumentation/subMiddleware/gin@latest
----

[source,go]
----
import (
 mw "github.com/tel-io/instrumentation/subMiddleware/gin"
)

func main(){
	// should be initialized at first
	t, cc := tel.New(ccx, cfg)
	defer cc()

    app := gin.Default()
	app.Use(mw.ServerMiddlewareAll())
}
----

== example

Assume that you in gin folder

=== Launch OTEL stack
[source,bash]
----
docker-compose -p otel -f ../../docker/docker-compose.yaml up
----

=== Run app

==== from source

[source,bash]
----
go run ./example
----

==== from docker-composer
[source,bash]
----
go run ./example
----

=== Check out
[source,bash]
----
curl http://127.0.0.1:8080/crash
curl http://127.0.0.1:8080/user/123/qqq
curl http://127.0.0.1:8080/hello
curl http://127.0.0.1:8080/

for i in {1..100}; do; curl http://127.0.0.1:8080/user/123/qqq ;done;
----

and take a look at grafana dashboards. in particular HTTP dashboard

[source,bash]
----
open http://127.0.0.1:3000
----

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServerMiddlewareAll

func ServerMiddlewareAll(opts ...mw.Option) gin.HandlerFunc

ServerMiddlewareAll create mw for gin which uses github.com/tel-io/tel/v2/middleware/http note: WithPathExtractor option of it is overwritten

Types

This section is empty.

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL