Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFOPLAT-1575 Implement Prometheus to OTel metrics conversion and export #997

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pkcll
Copy link
Contributor

@pkcll pkcll commented Jan 14, 2025

Implement Prometheus to OTel metrics conversion and export.

Receiver:

Exporter:

  • Wraps otlpexporter
  • Receives metric data from the receiver
  • Export OTel metrics data to otel collector endpoint via otlpexporter

Depends on

Run Example

cd chainlink-common/pkg/promotel

# start otel-collector 
docker run \
  -p 127.0.0.1:4317:4317 \
  -p 127.0.0.1:4318:4318 \
  -p 127.0.0.1:55679:55679 \
  otel/opentelemetry-collector-contrib:0.117.0

# run example
make run-example

Example app output

...
   INFO    cmd/example.go:34       Reported Prometheus metric      {"name": "test_counter_metric", "value": 7}
   INFO    cmd/example.go:48       Received Prometheus metric      {"name": "test_counter_metric", "value": 7}
   INFO    cmd/example.go:138      Exporting OTel metric   {"name": "test_counter_metric", "value": 7}
...

otel-collector-agent logs

otelcollectoragent  | Metric #27
otelcollectoragent  | Descriptor:
otelcollectoragent  |      -> Name: test_counter_metric
otelcollectoragent  |      -> Description:
otelcollectoragent  |      -> Unit:
otelcollectoragent  |      -> DataType: Sum
otelcollectoragent  |      -> IsMonotonic: true
otelcollectoragent  |      -> AggregationTemporality: Cumulative
otelcollectoragent  | NumberDataPoints #0
otelcollectoragent  | Data point attributes:
otelcollectoragent  |      -> app: Str(promotel-demo)
otelcollectoragent  | StartTimestamp: ...
otelcollectoragent  | Timestamp: ...
otelcollectoragent  | Value: 7.000000

@pkcll pkcll force-pushed the INFOPLAT-1575/promotel branch from 2a83ee6 to b986992 Compare January 14, 2025 05:50
@pkcll pkcll changed the title [promotel] Implement Prometheus to OTel metrics conversion and export… [promotel] Implement Prometheus to OTel metrics conversion Jan 14, 2025
@pkcll pkcll changed the title [promotel] Implement Prometheus to OTel metrics conversion Implement Prometheus to OTel metrics conversion and export Jan 14, 2025
@pkcll pkcll changed the title Implement Prometheus to OTel metrics conversion and export INFOPLAT-1575 Implement Prometheus to OTel metrics conversion and export Jan 14, 2025
@pkcll pkcll requested a review from 4of9 January 14, 2025 06:01
Comment on lines +43 to +44
// Scrape from the provided gatherer
scrape.SetDefaultGatherer(g)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this set a package global?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants