Swiftpack.co - Apodini/ApodiniObservePrometheus as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Apodini.
Apodini/ApodiniObservePrometheus 0.1.4
Prometheus metrics configuration and types for the ApodiniObserve module
⭐️ 0
🕓 2 years ago
macOS
.package(url: "https://github.com/Apodini/ApodiniObservePrometheus.git", from: "0.1.4")

ApodiniObservePrometheus

Build codecov

ApodiniObservePrometheus is a Apodini extension that drastically simplifies the configuration process for using the common Prometheus software stack with ApodiniObserve.

Integration

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")
        ]
    )
]

Usage

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
        )
    }
}

Contributing

Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.

License

This project is licensed under the MIT License. See Licenses for more information.

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.1.4
2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics