-
Notifications
You must be signed in to change notification settings - Fork 10.3k
The type of metric is not determined when receiving OTLP #17437
Copy link
Copy link
Closed as duplicate of#13163
Description
What did you do?
I have launched the latest prometheus image in docker.
prometheus:
image: prom/prometheus:latest
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--enable-feature=exemplar-storage'
- '--web.enable-otlp-receiver'
- '--enable-feature=metadata-wal-records'
- '--enable-feature=promql-experimental-functions'
- '--log.level=debug'
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"prometheus.yml
otlp:
# Recommended attributes to be promoted to labels.
promote_resource_attributes:
- service.instance.id
- service.name
- service.namespace
- cloud.availability_zone
- cloud.region
- container.name
- deployment.environment.name
- k8s.cluster.name
- k8s.container.name
- k8s.cronjob.name
- k8s.daemonset.name
- k8s.deployment.name
- k8s.job.name
- k8s.namespace.name
- k8s.pod.name
- k8s.replicaset.name
- k8s.statefulset.name
# Ingest OTLP data keeping all characters in metric/label names.
translation_strategy: UnderscoreEscapingWithSuffixes
keep_identifying_resource_attributes: true
storage:
tsdb:
out_of_order_time_window: 30mI am sending metrics to prometheus using this test application.
from flask import Flask
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
from opentelemetry.metrics import Observation
import random
# Настройка OTLP экспортера
otlp_exporter = OTLPMetricExporter(
endpoint="http://localhost:9090/api/v1/otlp/v1/metrics",
)
reader = PeriodicExportingMetricReader(otlp_exporter, export_interval_millis=5000)
provider = MeterProvider(metric_readers=[reader])
metrics.set_meter_provider(provider)
meter = metrics.get_meter(__name__)
request_counter = meter.create_counter(
name="flask_requests_total",
description="Total number of HTTP requests",
)
def random_value_callback(options):
return [Observation(random.random() * 100)]
random_gauge = meter.create_observable_gauge(
name="random_value",
description="Random gauge value",
callbacks=[random_value_callback],
)
app = Flask(__name__)
@app.route("/")
def index():
request_counter.add(1, {"endpoint": "/"})
return "Hello, Prometheus via OTLP!"
@app.route("/ping")
def ping():
request_counter.add(1, {"endpoint": "/ping"})
return {"status": "ok"}What did you expect to see?
I expected to see the type and description of the metric, but they are all unknown.
What did you see instead? Under which circumstances?
System information
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64
Prometheus version
prometheus, version 3.7.3 (branch: HEAD, revision: 0a41f0000705c69ab8e0f9a723fc73e39ed62b07)
build user: root@08c890a84441
build date: 20251030-07:26:10
go version: go1.25.3
platform: linux/amd64
tags: netgo,builtinassets
Prometheus configuration file
otlp:
# Recommended attributes to be promoted to labels.
promote_resource_attributes:
- service.instance.id
- service.name
- service.namespace
- cloud.availability_zone
- cloud.region
- container.name
- deployment.environment.name
- k8s.cluster.name
- k8s.container.name
- k8s.cronjob.name
- k8s.daemonset.name
- k8s.deployment.name
- k8s.job.name
- k8s.namespace.name
- k8s.pod.name
- k8s.replicaset.name
- k8s.statefulset.name
# Ingest OTLP data keeping all characters in metric/label names.
translation_strategy: UnderscoreEscapingWithSuffixes
keep_identifying_resource_attributes: true
storage:
tsdb:
out_of_order_time_window: 30mAlertmanager version
Alertmanager configuration file
Logs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels