Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github.com/gofiber/fiber trace instrumentation #880

Closed
wants to merge 15 commits into from
Closed

Add github.com/gofiber/fiber trace instrumentation #880

wants to merge 15 commits into from

Conversation

WLun001
Copy link

@WLun001 WLun001 commented Jul 12, 2021

close #843

WLun001 and others added 2 commits July 12, 2021 15:09
@pellared
Copy link
Member

Could you please also add a line to CHANGELOG.md?

@WLun001 WLun001 requested review from Aneurysm9 and pellared July 13, 2021 03:39
@WLun001 WLun001 requested a review from pellared July 13, 2021 09:26
@pellared pellared changed the title add Fiber Add github.com/gofiber/fiber trace instrumentation Jul 13, 2021
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was instrumentation/github.com/gofiber/fiber/README.md not supposed to be removed?

Reference https://github.com/open-telemetry/opentelemetry-go-contrib/pull/880/files#r667995107

@WLun001
Copy link
Author

WLun001 commented Jul 13, 2021

@pellared sorry I mistakenly removed the wrong README

oteltrace "go.opentelemetry.io/otel/trace"
)

var tracer = otel.Tracer("fiber-server")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@open-telemetry/go-approvers Would it be better to recommend:

  • adding sdktrace.WithResource(resource.NewWithAttributes(semconv.SchemaURL, semconv.ServiceNameKey.String("fiber-server"))), to sdktrace.NewTracerProvider call
  • creating the new span inside getUser using oteltrace.SpanFromContext()
    ?

Reference: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/net/http/otelhttp/example/server/server.go

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A service name should definitely be provided in the resource given to the tracer provider initialization.

CHANGELOG.md Outdated Show resolved Hide resolved
)

// Middleware returns fiber handler which will trace incoming requests.
func Middleware(service string, opts ...Option) fiber.Handler {
Copy link
Member

@pellared pellared Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@open-telemetry/go-approvers side question:
do we have an example of documentation that tells what attributes are being set for given instrumentation?

@pellared
Copy link
Member

pellared commented Jul 13, 2021

@WLun001 You need to add the new modules to .github/dependabot.yml

@pellared
Copy link
Member

@WLun001 Looks like you need to go mod tidy and go fmt.

@WLun001
Copy link
Author

WLun001 commented Jul 14, 2021

just ran go mod tidy, go fmt and make precommit locally, should be ok now

@codecov
Copy link

codecov bot commented Jul 14, 2021

Codecov Report

Merging #880 (831878b) into main (76dbf66) will increase coverage by 9.7%.
The diff coverage is 96.5%.

❗ Current head 831878b differs from pull request most recent head 92aa894. Consider uploading reports for the commit 92aa894 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##            main    #880     +/-   ##
=======================================
+ Coverage   69.6%   79.4%   +9.7%     
=======================================
  Files         77      64     -13     
  Lines       4955    2789   -2166     
=======================================
- Hits        3451    2215   -1236     
+ Misses      1365     441    -924     
+ Partials     139     133      -6     
Impacted Files Coverage Δ
...tation/github.com/gofiber/fiber/otelfiber/fiber.go 96.0% <96.0%> (ø)
...ation/github.com/gofiber/fiber/otelfiber/config.go 100.0% <100.0%> (ø)
instrumentation/net/http/otelhttp/transport.go 78.5% <0.0%> (-13.8%) ⬇️
exporters/metric/dogstatsd/dogstatsd.go 75.8% <0.0%> (-5.0%) ⬇️
instrumentation/net/http/otelhttp/handler.go 72.6% <0.0%> (-4.3%) ⬇️
exporters/metric/cortex/cortex.go 69.8% <0.0%> (-3.4%) ⬇️
propagators/b3/context.go 66.6% <0.0%> (-3.4%) ⬇️
propagators/jaeger/context.go 66.6% <0.0%> (-3.4%) ⬇️
detectors/aws/eks/detector.go 32.7% <0.0%> (-3.0%) ⬇️
exporters/metric/cortex/utils/config_utils.go 89.4% <0.0%> (-2.2%) ⬇️
... and 72 more

oteltrace "go.opentelemetry.io/otel/trace"
)

var tracer = otel.Tracer("fiber-server")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A service name should definitely be provided in the resource given to the tracer provider initialization.

@WLun001
Copy link
Author

WLun001 commented Aug 23, 2021

any updates on this PR?

# Conflicts:
#	.github/dependabot.yml
#	CHANGELOG.md
@efectn
Copy link

efectn commented Oct 4, 2021

Do you have any plan to add offical Fiber support?

@pellared
Copy link
Member

pellared commented Oct 5, 2021

I do not think it will be merged. See: #1100

However, I hope that all the code reviews were helpful.

@MrAlias
Copy link
Contributor

MrAlias commented Oct 12, 2021

Thanks for the contribution. According to our new instrumentation policy, we are no longer accepting new instrumentation to the project as we do not have the developer bandwidth to support it. If you are able, please consider maintaining this instrumentation in your own repository and listing it in the the OpenTelemetry Registry.

@MrAlias MrAlias closed this Oct 12, 2021
@WLun001
Copy link
Author

WLun001 commented Oct 13, 2021

@pellared thanks for the code review, very helpful

@WLun001 WLun001 deleted the fiber branch October 28, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Instrumentation for gofiber/fiber
5 participants