http4s-timer-newrelic


License

License

MIT
Categories

Categories

Ant Build Tools
GroupId

GroupId

org.lyranthe
ArtifactId

ArtifactId

http4s-timer-newrelic_2.12
Last Version

Last Version

0.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

http4s-timer-newrelic
http4s-timer-newrelic
Project URL

Project URL

https://github.com/fiadliel/http4s-timer
Project Organization

Project Organization

org.lyranthe
Source Code Management

Source Code Management

https://github.com/fiadliel/http4s-timer

Download http4s-timer-newrelic_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/org.lyranthe/http4s-timer-newrelic_2.12/ -->
<dependency>
    <groupId>org.lyranthe</groupId>
    <artifactId>http4s-timer-newrelic_2.12</artifactId>
    <version>0.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/org.lyranthe/http4s-timer-newrelic_2.12/
implementation 'org.lyranthe:http4s-timer-newrelic_2.12:0.0.4'
// https://jarcasting.com/artifacts/org.lyranthe/http4s-timer-newrelic_2.12/
implementation ("org.lyranthe:http4s-timer-newrelic_2.12:0.0.4")
'org.lyranthe:http4s-timer-newrelic_2.12:jar:0.0.4'
<dependency org="org.lyranthe" name="http4s-timer-newrelic_2.12" rev="0.0.4">
  <artifact name="http4s-timer-newrelic_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.lyranthe', module='http4s-timer-newrelic_2.12', version='0.0.4')
)
libraryDependencies += "org.lyranthe" % "http4s-timer-newrelic_2.12" % "0.0.4"
[org.lyranthe/http4s-timer-newrelic_2.12 "0.0.4"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.4
org.lyranthe : http4s-timer-core_2.12 jar 0.0.4

Project Modules

There are no modules declared in this project.

http4s-timer

Introduction

This adds timing capability to http4s, with a possible concrete implementation for New Relic

New Relic Usage

Add to your library dependencies:

"org.lyranthe" % "http4s-timer-newrelic" % <version>

You should have the New Relic agent installed, with custom annotations enabled.

Changes to HttpService[F]

If your initial version looks like:

val service = HttpService[IO] {
  case GET -> Root / "hello" / name =>
    Ok(Json.obj("message" -> Json.fromString(s"Hello, ${name}")))
}

then this should be modified to:

import org.lyranthe.http4s.timer._
import org.lyranthe.http4s.timer.newrelic._

val service = TimedService[IO]("my_service") {
  case GET -> Root / "hello" / name =>
    "hello/:name" ->
      Ok(Json.obj("message" -> Json.fromString(s"Hello, ${name}")))
}

The body of each partial function now returns a tuple of path name, and the contents of the resulting HTTP response. The path name cannot be taken directly from the requested path, as many paths vary in such things like user ID, but these should not be included in the path sent to monitoring.

Changes to AuthedService[F]

Similarly, you should modify any AuthedService to use TimedAuthedService.

Library Dependencies

The core library is dependent on "org.http4s" %% "http4s-core" % "0.18.0-M8".

The newrelic library is also dependent on "com.newrelic.agent.java" % "newrelic-api" % "3.45.0"

Versions

Version
0.0.4
0.0.3
0.0.2
0.0.1