Skip to content

Commit

Permalink
Clarify the docs for observability (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis authored Oct 3, 2024
1 parent b30b5ed commit 71bb4a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/Hummingbird/Middleware/LogRequestMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
import HTTPTypes
import Logging

/// Middleware outputting to log for every call to server
/// Middleware outputting to log for every call to server.
///
/// Uses [Swift-Log](https://github.com/apple/swift-log) for logging the output.
/// Swift-Log has a flexible backend, and will output to console by default.
/// You can replace the Logging backend with other implementations.
/// A list of implementations is available in the swift-log repository's README.
public struct LogRequestsMiddleware<Context: RequestContext>: RouterMiddleware {
/// Header filter
public struct HeaderFilter: Sendable, ExpressibleByArrayLiteral {
Expand Down
5 changes: 5 additions & 0 deletions Sources/Hummingbird/Middleware/MetricsMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import Metrics
///
/// Records the number of requests, the request duration and how many errors were thrown. Each metric has additional
/// dimensions URI and method.
///
/// Uses [Swift-Metrics](https://github.com/apple/swift-metrics) for recording the metrics.
/// Swift-Metrics has a flexible backend, which will need to be initialized before any metrics are recorded.
///
/// A list of implementations is available in the swift-log repository's README.
public struct MetricsMiddleware<Context: RequestContext>: RouterMiddleware {
public init() {}

Expand Down
5 changes: 5 additions & 0 deletions Sources/Hummingbird/Middleware/TracingMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ import Tracing
///
/// You may opt in to recording a specific subset of HTTP request/response header values by passing
/// a set of header names.
///
/// Uses [Swift-Distributed-Tracing](https://github.com/apple/swift-distributed-tracing) for recording the traces.
/// Swift-Distributed-Tracing has a flexible backend, which will need to be initialized before any traces are recorded.
///
/// A list of implementations is available in the swift-distributed-tracing repository's README.
public struct TracingMiddleware<Context: RequestContext>: RouterMiddleware {
private let headerNamesToRecord: Set<RecordingHeader>
private let attributes: SpanAttributes?
Expand Down

0 comments on commit 71bb4a4

Please sign in to comment.