All Projects β†’ NomadBlacky β†’ scaladog

NomadBlacky / scaladog

Licence: MIT License
Datadog API client for Scala.

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to scaladog

natchez-extras
Integrations between Natchez, Doobie, HTTP4s, Log4cats and Datadog. Formerly called effect-utils.
Stars: ✭ 24 (-17.24%)
Mutual labels:  datadog
terraform-aws-datadog-forwarders
Terraform module which creates resources on AWS to forward logs/metrics to Datadog πŸ‡ΊπŸ‡¦
Stars: ✭ 30 (+3.45%)
Mutual labels:  datadog
nebulous
The Kubefirst Open Source Platform
Stars: ✭ 122 (+320.69%)
Mutual labels:  datadog
dd-go-opentracing
[WIP] OpenTracing Tracer implementation for Datadog in Go
Stars: ✭ 22 (-24.14%)
Mutual labels:  datadog
yake
A Rake-like DSL for writing AWS Lambda handlers
Stars: ✭ 146 (+403.45%)
Mutual labels:  datadog
SwiftDog
This is an (un)official swift library of the datadog API! Many more features to come, but right now it supports sending metrics and events!
Stars: ✭ 26 (-10.34%)
Mutual labels:  datadog
datadog-tracer-js
[DEPRECATED] OpenTracing tracer implementation for Datadog in JavaScript.
Stars: ✭ 39 (+34.48%)
Mutual labels:  datadog
heroku-datadog-drain-golang
Funnel metrics from multiple Heroku apps into DataDog using statsd.
Stars: ✭ 34 (+17.24%)
Mutual labels:  datadog
datadog-anomaly-detector
🐢 Anomaly detection system for Datadog multiple metrics
Stars: ✭ 19 (-34.48%)
Mutual labels:  datadog
datadog-to-terraform
Converts Datadog resource JSON into Terraform alarm code.
Stars: ✭ 191 (+558.62%)
Mutual labels:  datadog
okra
Hot-swap Kubernetes clusters while keeping your service up and running.
Stars: ✭ 46 (+58.62%)
Mutual labels:  datadog
terraform-aws-datadog-integration
Terraform module to configure Datadog AWS integration
Stars: ✭ 26 (-10.34%)
Mutual labels:  datadog
watchdog
DEPRECATED -- Github Bot for Datadog codification
Stars: ✭ 26 (-10.34%)
Mutual labels:  datadog
statsd.cr
A statsd client library for Crystal.
Stars: ✭ 32 (+10.34%)
Mutual labels:  datadog
datadog-actions-metrics
Send GitHub Actions metrics to Datadog
Stars: ✭ 27 (-6.9%)
Mutual labels:  datadog
dd-trace-php
[DEPRECATED] Use https://github.com/dataDog/dd-trace-php instead
Stars: ✭ 18 (-37.93%)
Mutual labels:  datadog
datadog-trace-agent
Datadog Trace Agent archive (pre-6.10.0)
Stars: ✭ 70 (+141.38%)
Mutual labels:  datadog
datadog monitor2terraform
Import DataDog monitor rule and generate Terraform resource configuration
Stars: ✭ 14 (-51.72%)
Mutual labels:  datadog
passenger-datadog-monitor
Golang application for reporting Phusion Passenger stats to DataDog via statsD
Stars: ✭ 15 (-48.28%)
Mutual labels:  datadog
datadog-api-client-python
Python client for the Datadog API
Stars: ✭ 44 (+51.72%)
Mutual labels:  datadog

scaladog

Datadog API client for Scala.

Scala Steward badge

Getting Started

Add the dependency.

  • build.sbt
libraryDependencies += "dev.nomadblacky" %% "scaladog" % "0.5.3"
import $ivy.`dev.nomadblacky::scaladog:0.5.3`

Set API key and Application key

  • from environment variables
export DATADOG_API_KEY=<your api key>
export DATADOG_APP_KEY=<your application key>
export DATADOG_SITE=<your site> # Optional, "US" or "EU", default is "US"
val client = scaladog.Client()
  • or manually
val client = scaladog.Client("<your api key>", "<your application key>", scaladog.api.DatadogSite.US)

Supported APIs

  • Service Checks
  • Comments
  • Dashboards
  • Dashboard Lists
  • Downtimes
  • Embeddable graphs
  • Events
  • Graphs
  • Hosts
  • Integration AWS
  • Integration Azure
  • Integration GCP
  • Integration PagerDuty
  • Integration Slack
  • Integration Webhooks
  • Key Management
  • Logs
  • Logs Indexes
  • Metrics
    • GET /v1/metrics
    • POST /v1/series
    • GET /v1/query
    • GET /v1/metrics/<METRIC_NAME>
    • PUT /v1/metrics/<METRIC_NAME>
    • GET /v1/search
  • Monitors
  • Organizations
  • Screenboards
  • Synthetics
  • Tags
  • Timeboards
  • Tracing
  • Usage metering
  • Users

Examples

Service Checks

Post a check run

import scaladog.api.service_checks.ServiceCheckStatus
import java.time.Instant

val client = scaladog.Client()

val response = client.serviceCheck.postStatus(
  check = "app.is_ok",
  hostName = "app1",
  status = ServiceCheckStatus.OK,
  timestamp = Instant.now(),
  message = "The application is healthy.",
  tags = Seq("env:prod")
)

assert(response.isOk)

Metrics

Get list of active metrics

import java.time._, temporal._

val client = scaladog.Client()

val from = Instant.now().minus(1, ChronoUnit.DAYS)
val host = "myhost"
val response = client.metrics.getMetrics(from, host)

println(response) // GetMetricsResponse(List(test.metric),2019-07-30T15:22:39Z,Some(myhost))

Post timeseries points

import scaladog.api.metrics._
import java.time.Instant
import scala.util.Random

val response = scaladog.Client().metrics.postMetrics(
  Seq(
    Series(
      metric = "test.metric",
      points = Seq(Point(Instant.now(), Random.nextInt(1000))),
      host = "myhost",
      tags = Seq("project:scaladog"),
      MetricType.Gauge
    )
  )
)

assert(response.isOk)

// If you want to send a single metric, you can write more simply.
scaladog.Client().metrics.postSingleMetric("test.metric", 12.34)

Events

Post an event

import scaladog.api.events._
import java.time.Instant

val response = scaladog.Client().events.postEvent(
  title = "TEST EVENT",
  text = "This is a test event.",
  dateHappened = Instant.now(),
  priority = Priority.Low,
  tags = Seq("project:scaladog"),
  alertType = AlertType.Info
)

assert(response.isOk)

Get an event

import scaladog.api.events._
import java.time.Instant

val event = scaladog.Client().events.getEvent(1234567890123456789L)

assert(event.id == 1234567890123456789L)
assert(event.title == "TEST EVENT")
assert(event.text == "This is a test event.")
assert(event.tags == Seq("project:scaladog"))

Query the event stream

import scaladog.api.events._
import java.time._, temporal._

val now = Instant.now()
val events = scaladog.Client().events.query(start = now.minus(1, ChronoUnit.DAYS), end = now)

Graphs

Graph snapshot

import java.time._, temporal._

val now = Instant.now()
val url = scaladog.Client().graphs.snapshot(
  metricQuery = "avg:datadog.estimated_usage.hosts{*}",
  start = now.minus(7, ChronoUnit.DAYS),
  end = now,
  title = getClass.getSimpleName
)
assert(url.toString startsWith "https://p.datadoghq.com/snapshot/view/dd-snapshots-prod/")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].