All Projects → palantir → metric-schema

palantir / metric-schema

Licence: Apache-2.0 license
Schema for standard metric definitions

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects

Projects that are alternatives of or similar to metric-schema

dropwizard-web-security
A Dropwizard bundle for applying default web security functionality
Stars: ✭ 37 (+184.62%)
Mutual labels:  octo-correct-managed
conjure-rust
Conjure support for Rust
Stars: ✭ 14 (+7.69%)
Mutual labels:  octo-correct-managed
witchcraft-go-server
A highly opinionated Go embedded application server for RESTy APIs
Stars: ✭ 47 (+261.54%)
Mutual labels:  octo-correct-managed
Plottable
📊 A library of modular chart components built on D3
Stars: ✭ 2,834 (+21700%)
Mutual labels:  octo-correct-managed
rust-zipkin
A library for logging and propagating Zipkin trace information in Rust
Stars: ✭ 50 (+284.62%)
Mutual labels:  octo-correct-managed
gradle-consistent-versions
Compact, constraint-friendly lockfiles for your dependencies
Stars: ✭ 92 (+607.69%)
Mutual labels:  octo-correct-managed
dialogue
A client-side RPC library for conjure-java
Stars: ✭ 12 (-7.69%)
Mutual labels:  octo-correct-managed
goastwriter
Go library for writing Go source code programatically
Stars: ✭ 27 (+107.69%)
Mutual labels:  octo-correct-managed
amalgomate
Go tool for combining multiple different main packages into a single program or library
Stars: ✭ 19 (+46.15%)
Mutual labels:  octo-correct-managed
giraffe
Gracefully Integrated Remote Access For Files and Execution
Stars: ✭ 50 (+284.62%)
Mutual labels:  octo-correct-managed
Blueprint
A React-based UI toolkit for the web
Stars: ✭ 18,376 (+141253.85%)
Mutual labels:  octo-correct-managed
Python Language Server
An implementation of the Language Server Protocol for Python
Stars: ✭ 2,412 (+18453.85%)
Mutual labels:  octo-correct-managed
phishcatch
A browser extension and API server for detecting corporate password use on external websites
Stars: ✭ 75 (+476.92%)
Mutual labels:  octo-correct-managed
gradle-docker-test-runner
Gradle plugin for running tests in Docker environments
Stars: ✭ 20 (+53.85%)
Mutual labels:  octo-correct-managed
go-baseapp
A lightweight starting point for Go web servers
Stars: ✭ 61 (+369.23%)
Mutual labels:  octo-correct-managed
log4j-sniffer
A tool that scans archives to check for vulnerable log4j versions
Stars: ✭ 180 (+1284.62%)
Mutual labels:  octo-correct-managed
palantir-java-format
A modern, lambda-friendly, 120 character Java formatter.
Stars: ✭ 203 (+1461.54%)
Mutual labels:  octo-correct-managed
python-jsonrpc-server
A Python 2 and 3 asynchronous JSON RPC server
Stars: ✭ 73 (+461.54%)
Mutual labels:  octo-correct-managed
hadoop-crypto
Library for per-file client-side encyption in Hadoop FileSystems such as HDFS or S3.
Stars: ✭ 38 (+192.31%)
Mutual labels:  octo-correct-managed
asana mailer
A script that uses Asana's RESTful API to generate plaintext and HTML emails.
Stars: ✭ 12 (-7.69%)
Mutual labels:  octo-correct-managed

Metric Schema

A simple opinionated toolchain to define and document metrics produced by a project.

Features:

  • Source of truth for metrics, eliminating incorrect and outdated documentation.
  • Produces a standardized representation of metrics to library and service consumers based on the classpath.

The generated java utilities wrap a Tritium registry to provide simple, concise accessors to declared metrics.

Getting started

Start by adding a buildscript dependency on the Metric-schema gradle plugin:

build.gradle

buildscript {
    dependencies {
        classpath 'com.palantir.metricschema:gradle-metric-schema:<latest-version>'
    }
}

Then apply com.palantir.metric-schema gradle plugin to your service project:

<your-service>/build.gradle

apply plugin: 'com.palantir.metric-schema'

Then start defining metrics in your project:

<your-service>/src/main/metrics/my-metrics.yml

namespaces:
  my.service:
    # Documentation describing the entire namespace.
    docs: Metrics helpful for monitoring a my-service instance.
    metrics:
      # Results in a meter with name `my.service.failures`
      failures:
        # Type of the metric can be one of [counter, meter, timer, histogram, gauge]
        # Each metric type corresponds to a metric type from https://metrics.dropwizard.io
        type: meter
        # General documentation about the metric
        docs: Rate of failures by `operationType`
        # Each tag allows you to provide annotate the metric with a key-value pair
        tags:
          # Tag which allows for an arbitrary string value
          - operationType
          # Tag with a predefined set of values
          - name: severity
            # Specific documentation about the tag
            docs: How important the operation was
            values: [P0, P1]

Then generate the utilities by running ./gradlew generateMetrics and begin instrumenting your code. Examples of the generated code can be found here.

MyServiceMetrics metrics = MyServiceMetrics.of(server.taggedMetrics());
// Metric objects should be reused as much as possible to avoid unnecessary lookups
Meter creationFailures = metrics.failures()
        .operationType("create")
        .severity(Failures_Severity.P0)
        .build();

Details

Metric definitions are located in project src/main/metrics directories. Files are YAML formatted with the .yml extension and represent a collection of namespaces, a logical group of metrics with a shared prefix. The schema is defined using conjure, and can be found here.

Metric utilities are updated using the generateMetrics gradle task. If this is the first metric definition in the module, it may be necessary to regenerate the IDE configuration after metrics are generated, IntelliJ IDEA users can run the idea task.

Metric documentation is updated using the generateMetricsMarkdown gradle task or by running ./gradlew --write-locks. The gradle plugin will ensure that the metrics markdown is always up to date.

All metric definitions will be embedded within the output JAR as a resource located metric-schema/metrics.json.

Options

Metric definitions can also include options that do not change the overall declaration, but may affect the way it is handled in a particular context.

options:
  # Specifies under which package Java classes should be generated
  javaPackage: 'com.palantir.my.package'
  # Specifies visibility of generated Utility class. Defaults to public
  javaVisibility: packagePrivate 
namespaces:
...

Architecture

Design documentation describing the rationale for decisions is maintained in design.md.

Start Developing

Run one of the following commands:

  • ./gradlew idea for IntelliJ
  • ./gradlew eclipse for Eclipse
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].