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

add static attributes to exporter #1

Draft
wants to merge 2 commits into
base: kibana-128755-otel-metrics-poc
Choose a base branch
from

Conversation

klacabane
Copy link

@klacabane klacabane commented Jul 19, 2022

Summary

Stacked on elastic#133171

Prometheus exporter currently does not support resource attributes. While you can define these attributes, the serializer will simply ignore them and the downstream collection won't be able to provide host/service context to the ingested metrics.
This is a workaround that adds a concept of static attributes that will be passed to each metric during serialization.


HTTP output

[12:36:15] kibana git:(otel-metrics-static-attributes*) $ curl http://elastic:changeme@localhost:5601/pat/api/monitoring_collection/v1/prometheus
# HELP ruleExecutionsTotal_total description missing
# TYPE ruleExecutionsTotal_total counter
ruleExecutionsTotal_total{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 7 1658226977569
# HELP ruleExecutions_total description missing
# TYPE ruleExecutions_total counter
ruleExecutions_total{ruleType="monitoring_alert_thread_pool_search_rejections",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_alert_nodes_changed",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_alert_cpu_usage",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_shard_size",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_alert_thread_pool_write_rejections",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_ccr_read_exceptions",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
ruleExecutions_total{ruleType="monitoring_alert_cluster_health",serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 1 1658226977569
# HELP ruleFailures_total description missing
# TYPE ruleFailures_total counter
# HELP ruleDuration description missing
# TYPE ruleDuration histogram
ruleDuration_count{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 7 1658226977569
ruleDuration_sum{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0"} 2658 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="0"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="5"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="10"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="25"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="50"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="75"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="100"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="250"} 0 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="500"} 7 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="1000"} 7 1658226977569
ruleDuration_bucket{serviceName="kevins-macbook-pro.home",serviceInstanceId="5b2de169-2785-441b-ae8c-186a1936b17d",serviceVersion="8.4.0",le="+Inf"} 7 1658226977569

Ingested document

Screenshot 2022-07-19 at 12 27 43

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.

1 participant