Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feature: Create your own middleware #20

Closed
@heitorlessa

Description

@heitorlessa

As we prepare for GA, we need to reduce the effort in creating new middlewares, and ensure any middleware is traced opt in. This would help us move faster in creating more utilities, allow customers to create their own utilities (outside of this package), and debug middleware performance as they use multiple nested options.

This feature should allow:

  • Decorator to create middlewares
  • Control before, after, handle exceptions, and whether handler should be executed if they want to
  • Opt in option to trace middleware as an annotation with no modification to their code
  • Pass data between middlewares (e.g. correlation id, cold_start, etc.)

We have to decide between two options to pass data between middlewares:

  • Lambda Context
    • Pros: Ease to extend and available between middlewares, no additional code to maintain
    • Cons: There could be naming collision if Lamda decides to use context more extensively, each middleware needs to handle AttributeError if key is not there
  • Global Stash
    • Pros: Available anywhere in the code and handles AttributeError if data is non existent
    • Cons: Additional code to maintain

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions