Git Product home page Git Product logo

otel-otlp-metric-example's Introduction

otel-otlp-metric-example

Example of how to setup an OTLP exporter for metrics

Run

Start the collector using docker-compose:

docker-compose up -d

Run the client:

go run .

Make an HTTP request to the Go App:

curl -v localhost:8080/

Wait 10 seconds for the periodic reader collection cycle to expire and watch the logs for data:

docker-compose logs -f

If everything goes right, you should see the collector logging the histogram data it has received.

...
otel-otlp-metric-example-otel-collector-1  | 2022-10-31T19:50:40.376Z	INFO	loggingexporter/logging_exporter.go:56	MetricsExporter	{"#metrics": 1}
otel-otlp-metric-example-otel-collector-1  | 2022-10-31T19:50:40.376Z	DEBUG	loggingexporter/logging_exporter.go:66	ResourceMetrics #0
otel-otlp-metric-example-otel-collector-1  | Resource labels:
otel-otlp-metric-example-otel-collector-1  |      -> env: STRING(dev)
otel-otlp-metric-example-otel-collector-1  |      -> service.instance.id: STRING(xi)
otel-otlp-metric-example-otel-collector-1  |      -> service.name: STRING(serviceName)
otel-otlp-metric-example-otel-collector-1  |      -> telemetry.sdk.language: STRING(go)
otel-otlp-metric-example-otel-collector-1  |      -> telemetry.sdk.name: STRING(opentelemetry)
otel-otlp-metric-example-otel-collector-1  |      -> telemetry.sdk.version: STRING(1.11.1)
otel-otlp-metric-example-otel-collector-1  | InstrumentationLibraryMetrics #0
otel-otlp-metric-example-otel-collector-1  | InstrumentationLibrary go.opentelemetry.io/otel/example/otlp v0.1.1
otel-otlp-metric-example-otel-collector-1  | Metric #0
otel-otlp-metric-example-otel-collector-1  | Descriptor:
otel-otlp-metric-example-otel-collector-1  |      -> Name: request.duration
otel-otlp-metric-example-otel-collector-1  |      -> Description: Time taken to perfrom a user request
otel-otlp-metric-example-otel-collector-1  |      -> Unit: ms
otel-otlp-metric-example-otel-collector-1  |      -> DataType: Histogram
otel-otlp-metric-example-otel-collector-1  |      -> AggregationTemporality: AGGREGATION_TEMPORALITY_CUMULATIVE
otel-otlp-metric-example-otel-collector-1  | HistogramDataPoints #0
otel-otlp-metric-example-otel-collector-1  | StartTimestamp: 2022-10-31 19:50:10.268993381 +0000 UTC
otel-otlp-metric-example-otel-collector-1  | Timestamp: 2022-10-31 19:50:40.273494074 +0000 UTC
otel-otlp-metric-example-otel-collector-1  | Count: 1
otel-otlp-metric-example-otel-collector-1  | Sum: 0.000000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #0: 0.010000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #1: 0.100000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #2: 1.000000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #3: 10.000000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #4: 100.000000
otel-otlp-metric-example-otel-collector-1  | ExplicitBounds #5: 1000.000000
otel-otlp-metric-example-otel-collector-1  | Buckets #0, Count: 1
otel-otlp-metric-example-otel-collector-1  | Buckets #1, Count: 0
otel-otlp-metric-example-otel-collector-1  | Buckets #2, Count: 0
otel-otlp-metric-example-otel-collector-1  | Buckets #3, Count: 0
otel-otlp-metric-example-otel-collector-1  | Buckets #4, Count: 0
otel-otlp-metric-example-otel-collector-1  | Buckets #5, Count: 0
otel-otlp-metric-example-otel-collector-1  | Buckets #6, Count: 0
...

otel-otlp-metric-example's People

Contributors

dependabot[bot] avatar mralias avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.