Skip to content

Prometheus metrics configuration and types for the ApodiniObserve module

Notifications You must be signed in to change notification settings

Apodini/ApodiniObservePrometheus

Repository files navigation

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.

About

Prometheus metrics configuration and types for the ApodiniObserve module

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages