ApodiniObservePrometheus is a Apodini extension that drastically simplifies the configuration process for using the common Prometheus software stack with ApodiniObserve.
To use ApodiniObservePrometheus, you have to add it as a Swift Package dependency to your web service package. As ApodiniObservePrometheus is extending Apodini it also currently uses 0.x
releases and every minor version number increment could include breaking changes. Therefore using .upToNextMinor(from: "0.0.0")
is advised:
dependencies: [
.package(url: "https://github.com/Apodini/ApodiniObservePrometheus.git", .upToNextMinor(from: "0.0.0"))
]
Next, add ApodiniObservePrometheus as a target dependency to your web service target:
targets: [
.executableTarget(
name: "WebService",
dependencies: [
.product(name: "Apodini", package: "Apodini"),
.product(name: "ApodiniObserve", package: "Apodini"),
.product(name: "ApodiniObservePrometheus", package: "ApodiniObservePrometheus")
]
)
]
You can use ApodiniObservePrometheus as follows:
import Apodini
import ApodiniObserve
import ApodiniObservePrometheus
struct ExampleWebService: WebService {
var content: some Component {
// ...
}
var configuration: Configuration {
// ...
// Setup of ApodiniMetrics with a PrometheusMetricsHandler backend
MetricsConfiguration(
handlerConfiguration: MetricPullHandlerConfiguration.defaultPrometheus,
systemMetricsConfiguration: .default
)
}
}
Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.
This project is licensed under the MIT License. See Licenses for more information.