Skip to content

🚀 [Feature]: Otelfiber: Custom Response Metrics #1359

@henrysearle

Description

@henrysearle

Feature Description

At the moment custom attributes can be added for traces and metrics, however they are all gathered before the request is routed. This means it's not possible to add custom attributes which you might only know about once the request has been routed. Being able to call something like this would solve multiple challenges for us when it comes to tracing and metrics as we would be able to store/retrieve data from the context and add it to traces/metrics.

Additional Context (optional)

No response

Code Snippet (optional)

otelfiber.Middleware(
	otelfiber.WithCustomResponseAttributes(func(ctx *fiber.Ctx) []attribute.KeyValue {
		return []attribute.KeyValue{}
	}),
	otelfiber.WithCustomResponseMetricAttributes(func(ctx *fiber.Ctx) []attribute.KeyValue {
		return []attribute.KeyValue{}
	}),
)

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my suggestion prior to opening this one.
  • I understand that improperly formatted feature requests may be closed without explanation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions