Giter Club home page Giter Club logo

apminsight-server-sdk-java's Introduction

APMInsight Server SDK Java

Metrics

Installation

maven dependency

<dependency>
    <groupId>com.volcengine</groupId>
    <artifactId>apminsight-server-sdk-metrics</artifactId>
    <version>{latest-version}</version>
</dependency>

Usage

see CODE EXAMPLE

Build Client

MetricClient metricClient = MetricClientBuilder.newBuilder()
        .unixDomainSocket(true)
        .prefix("your application metric name common prefix")
        .maxPacketBytes(8192)
        .build();

metricClient.close();

Emit Metrics

//without tags
metricClient.emitCounter("example_counter_metric");
metricClient.emitCounter("example_counter_metric", 3);

metricClient.emitTimer("example_timer_metric", 200);
metricClient.emitTimer("example_timer_metric", 200, TimeUnit.MILLISECONDS);

metricClient.emitGauge("example_gauge_metric", 100);

//with tags
Map<String, String> tags = new HashMap<>();
tags.put("tagKey", "tagValue");
metricClient.emitCounter("example_counter_metric",  tags);
metricClient.emitCounter("example_counter_metric", 3, tags);

metricClient.emitTimer("example_timer_metric", 200, tags);
metricClient.emitTimer("example_timer_metric", 200, TimeUnit.MILLISECONDS, tags);

metricClient.emitGauge("example_gauge_metric", 100, tags);

Configuration

you can config client with MetricClientBuilder,there are some config items available in MetricConfig such as:

  • prefix the common prefix of metric name
  • unixDomainSocket use unix domain socket to send metric packet
  • sockAddress domain unix socket address
  • socketTimeOutMs send metric to agent socket timeout in milliseconds
  • maxPacketBytes send metric to agent socket max packet bytes limit
  • useMetricPool whether to use metric object pool
  • metricPoolMinIdle metric object pool min idle
  • metricPoolMaxIdle metric object pool max idle
  • byteBufferPoolMinIdle byte buffer object pool min idle
  • byteBufferPoolMaxIdle byte buffer object pool max idle
  • reporterQueueCapacity reporter buffer queue capacity.metric will be discarded when the capacity is exceeded, you can increase this queue capacity or reporterWorkers or senderWorkers to avoid
  • reporterWorkers number of reporter queue processor workers
  • senderSync send packet sync or async
  • senderWorkers number of sender queue processor workers if senderSync is false
  • workerWaitSleepMs reporter and sender processor waiting for empty poll

apminsight-server-sdk-java's People

Contributors

wisewong-bytedance avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.