Open jdmcd opened 7 years ago
@mcdappdev It should be easy to make it work with Vapor. Modifying SwiftMetricsDash.swift should be the place to make any changes. We don't have it in plan to do that right now but if you would like to have a go and submit a pull request, you would be more than welcome.
@tanner0101 @LoganWright any views on doing this for Vapor?
I'd love to give it a shot!
I'm trying to figure out the best way to go about doing this, since the SwiftMetricsDash.swift
file relies heavily on Kitura based imports currently. Should it be rewritten to be protocol-based?
@mcdappdev I think the best way is make a fork, because this seems to be integrated to kitura
@mcdappdev @gperdomor we're certainly not against refactoring and providing protocols to make it easier to plug into to other frameworks.
@seabaylea would be awesome if the protocols and kitura implementation were in a separate package. We could then pull in just the protocols for the vapor implementation. lmk what I could do to help with that.
@tanner0101 I'll take a look at refactoring the protocols and Kitura implementation out into separate packages
I'm sure you're plenty busy w/ a million other things, but I wanted to check in and see if you've had a chance to take a look yet @tobespc 👍
I've created https://github.com/MrLotU/VaporMonitoring based off of SwiftMonitoring and the Kitura parts, but it's working with Vapor (as of posting this, it's still in it's early stages)
Hello, if understand the Package.swift
correctly, SwiftMetrics
does not have a direct dependency on Kitura. This would make it very lightweight to integrate it into other projects. At the moment, you always have to build Kitura even when you are not using any of the Kitura features.
As a test I changed Package.swift
slightly:
let package = Package(
name: "SwiftMetrics",
products: [
.library(
name: "SwiftMetrics",
targets: ["SwiftMetrics"]),
.library(
name: "SwiftMetricsKitura",
targets: ["SwiftMetricsKitura",
"SwiftBAMDC",
"SwiftMetricsBluemix",
"SwiftMetricsDash",
"SwiftMetricsREST",
"SwiftMetricsPrometheus"]),
.executable(name: "SwiftMetricsEmitSample", targets: ["SwiftMetricsEmitSample"]),
.executable(name: "SwiftMetricsCommonSample", targets: ["SwiftMetricsCommonSample"]),
],
dependencies: [
.package(url: "https://github.com/IBM-Swift/Kitura.git", from: "2.3.0"),
webSocketPackage,
.package(url: "https://github.com/IBM-Swift/Swift-cfenv.git", from: "6.0.0"),
.package(url: "https://github.com/RuntimeTools/omr-agentcore", .exact("3.2.4-swift4")),
],
targets: [
.target(name: "SwiftMetrics", dependencies: ["agentcore", "hcapiplugin", "envplugin", "cpuplugin", "memplugin", "CloudFoundryEnv"]),
.target(name: "SwiftMetricsKitura", dependencies: ["SwiftMetrics", "Kitura"]),
.target(name: "SwiftBAMDC", dependencies: ["SwiftMetricsKitura", "Kitura-WebSocket"]),
.target(name: "SwiftMetricsBluemix", dependencies: ["SwiftMetricsKitura","SwiftBAMDC"]),
.target(name: "SwiftMetricsDash", dependencies: ["SwiftMetricsBluemix"]),
.target(name: "SwiftMetricsREST", dependencies: ["SwiftMetricsKitura"]),
.target(name: "SwiftMetricsPrometheus", dependencies:["SwiftMetricsKitura"]),
.target(name: "SwiftMetricsCommonSample", dependencies: ["SwiftMetrics"],
path: "commonSample/Sources"),
.target(name: "SwiftMetricsEmitSample", dependencies: ["SwiftMetrics"],
path: "emitSample/Sources"),
.testTarget(name: "CoreSwiftMetricsTests", dependencies: ["SwiftMetrics"]),
.testTarget(name: "SwiftMetricsRESTTests", dependencies: ["SwiftMetricsREST"])
]
)
With this change I can use SwiftMetrics
but no longer have to build Kitura as well. Would this be an option?
Hello,
This project looks incredible. Is it possible to use it with a Vapor server? I saw in the article it said that it would automatically setup a Kitura server, but I'd like to use it with Vapor.
Thanks!