-
Notifications
You must be signed in to change notification settings - Fork 7
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
Abstract and fix middlewares #158
base: main
Are you sure you want to change the base?
Conversation
e96d282
to
cd9b3e4
Compare
trace/client/src/main/scala/org/http4s/otel4s/middleware/trace/client/AttributeProvider.scala
Show resolved
Hide resolved
.../server/src/main/scala/org/http4s/otel4s/middleware/trace/server/TypedServerAttributes.scala
Outdated
Show resolved
Hide resolved
cd9b3e4
to
f515c75
Compare
@ioleo can you have a look and let me know if this meets your needs? |
...lient/src/main/scala/org/http4s/otel4s/middleware/trace/client/ClientMiddlewareBuilder.scala
Outdated
Show resolved
Hide resolved
Add abstraction to middlewares to support full customisation of span names and attributes while keeping default use case as simple as possible. Fix default attributes to align with otel semantic conventions. Add tests for all attribute creation.
Use `MeterProvider` for `MetricsOps` rather than `Meter` and use `TracerProvider for middlewares rather than `Tracer`.
4db2487
to
3b029ea
Compare
d675146
to
6a3994b
Compare
val middlewareVersion: AttributeProvider = | ||
new AttributeProvider { | ||
def requestAttributes[F[_]]( | ||
request: Request[F], | ||
urlTemplateClassifier: UriTemplateClassifier, | ||
urlRedactor: UriRedactor, | ||
headersAllowedAsAttributes: Set[AuthScheme], | ||
): Attributes = Attributes(TypedAttributes.middlewareVersion) | ||
def responseAttributes[F[_]]( | ||
response: Response[F], | ||
headersAllowedAsAttributes: Set[AuthScheme], | ||
): Attributes = Attributes.empty | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is a reasonable thing to do or not, but it's a separate commit so it will be easy to remove if we decide not
spanDataProvider: SpanDataProvider, | ||
urlTemplateClassifier: UriTemplateClassifier, | ||
headersAllowedAsAttributes: HeadersAllowedAsAttributes, | ||
shouldTrace: RequestPrelude => ShouldTrace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upon further thought, it's weird to me that this is a Function1
and not a SAM trait. I don't know if changing that has to happen in this PR (though given all the other changes, it would seem weird for it to happen elsewhere)
Add abstraction to middlewares to support full customisation of span names and attributes while keeping default use case as simple as possible.
Fix default attributes to align with otel semantic conventions.
Add tests for all attribute creation.