Swiftpack.co - DataDog/swift-dogstatsd as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by DataDog.
DataDog/swift-dogstatsd 1.0.1
A Swift Dogstatsd client built for the Vapor framework
⭐️ 3
🕓 50 weeks ago
macOS
.package(url: "https://github.com/DataDog/swift-dogstatsd.git", from: "1.0.1")

Swift Dogstatsd

Platforms Swift 5.3 Vapor 4

Overview

Swift Dogstatsd is a dogstatsd implementation for the popular Vapor framework.

Installation

To install Swift Dogstatsd, use Swift Package Manager:

.package(name: "dogstatsd", url: "https://github.com/DataDog/swift-dogstatsd.git", from: "1.0.0")),

.target(name: "App", dependencies: [
    .product(name: "Vapor", package: "vapor"),
    .product(name: "Dogstatsd", package: "swift-dogstatsd")
])

Usage

Configuration

In configure.swift:

import Dogstatsd

// Called before your application initializes.
func configure(_ app: Application) throws {

    app.dogstatsd.config = .udp(address: "127.0.0.1", port: 8125)
    // or 
    app.dogstatsd.config = .uds(path: "/tmp/dsd.sock")

}

Usage

dogstatsd is available on both Application and Request.

import Vapor

func routes(_ app: Application) throws {

    app.get { req -> String in

        req.dogstatsd.increment("custom.swift.metric", tags: ["env:prod"])

        return "It works!"
    }
}

GitHub

link
Stars: 3
Last commit: 37 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

1.0.1
50 weeks ago
  • Added unified service tagging.
  • Fixed how tags are handled so they are not restricted to key/value pairs.

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