GithubHelp home page GithubHelp logo

isabella232 / php-datadogstatsd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datadog/php-datadogstatsd

0.0 0.0 0.0 125 KB

A PHP client for DogStatsd

License: BSD 3-Clause "New" or "Revised" License

PHP 100.00%

php-datadogstatsd's Introduction

PHP DataDog StatsD Client

Build Status Author Packagist Version Total Downloads

This is an extremely simple PHP DogStatsD client.

Requires PHP >= 5.6.0.

See CHANGELOG.md for changes.

For a Laravel-specific implementation that wraps this library, check out laravel-datadog-helper.

Installation

Add the following to your composer.json:

"datadog/php-datadogstatsd": "1.5.*"

The first version shipped in composer is 0.0.3

Or manually clone this repository and set it up with require './src/DogStatsd.php'.

Once installed, turn on the socket extension to PHP which must be enabled at compile time by giving the --enable-sockets option to configure.

Configuration

To instantiate a DogStatsd object using composer:

<?php

require __DIR__ . '/vendor/autoload.php';

use DataDog\DogStatsd;

$statsd = new DogStatsd(
    array('host' => '127.0.0.1',
          'port' => 8125,
     )
  );

DogStatsd constructor, takes a configuration array. See the full list of available DogStatsD Client instantiation parameters.

Origin detection over UDP in Kubernetes

Origin detection is a method to detect which pod DogStatsD packets are coming from in order to add the pod's tags to the tag list.

To enable origin detection over UDP, add the following lines to your application manifest

env:
  - name: DD_ENTITY_ID
    valueFrom:
      fieldRef:
        fieldPath: metadata.uid

The DogStatsD client attaches an internal tag, entity_id. The value of this tag is the content of the DD_ENTITY_ID environment variable, which is the pod’s UID. The agent uses this tag to infer packets' origin, and tag their metrics accordingly.

Usage

In order to use DogStatsD metrics, events, and Service Checks the Agent must be running and available.

Metrics

After the client is created, you can start sending custom metrics to Datadog. See the dedicated Metric Submission: DogStatsD documentation to see how to submit all supported metric types to Datadog with working code examples:

Some options are suppported when submitting metrics, like applying a Sample Rate to your metrics or tagging your metrics with your custom tags.

Events

After the client is created, you can start sending events to your Datadog Event Stream. See the dedicated Event Submission: DogStatsD documentation to see how to submit an event to your Datadog Event Stream.

Service Checks

After the client is created, you can start sending Service Checks to Datadog. See the dedicated Service Check Submission: DogStatsD documentation to see how to submit a Service Check to Datadog.

Roadmap

  • Add a configurable timeout for event submission via TCP
  • Write unit tests
  • Document service check functionality

Tests

composer test

php-datadogstatsd's People

Contributors

ahmed-mez avatar alq666 avatar bigthyme avatar celenechang avatar chaseconey avatar clutchski avatar conorbranagan avatar crshoverride avatar derek9gag avatar eirikhm avatar elafarge avatar firehed avatar hkaj avatar hush-hush avatar inverse avatar jbarciauskas avatar jklein avatar leocavaille avatar localheinz avatar lotharsee avatar masci avatar pub007 avatar remh avatar sammyk avatar seejohnrun avatar solkennedy avatar timrourke avatar yannmh avatar zhukovra avatar zippolyte avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.