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

Create SQL functions to send a metrics from postgres to open telemetry collector #1

Open
teoincontatto opened this issue Jul 16, 2024 · 4 comments

Comments

@teoincontatto
Copy link

Create an SQL function to send a metrics from postgres to open telemetry collector for each type of metric supported by OTEL protocol:

The functions should also accept a set of labels. See https://github.com/open-telemetry/oteps/blob/main/text/metrics/0049-metric-label-set.md

@asotolongo
Copy link
Contributor

To send the metrics to opentelemetry is possible using the function SELECT pgotel_counter('URL_OPENTELEMETRY', 'counter_name', VALUE);, so far the process will be necessary be complete in less 2 seconds, due to this configuration, but can be changed.

a pg_cron entry can generate this sending process

@fabriziomello
Copy link
Collaborator

@asotolongo the problem is that the current architecture of Metrics in OTEL SDK it will continue sending the metric continuously after each 2 seconds.

@asotolongo
Copy link
Contributor

@fabriziomello but if I remember well, once the connection closes, the extension don't send the metrics, from my POV pg_cron connect does the task and disconnects (maybe 2 seconds is too short to send all metrics in one connection, it can be increased)

@teoincontatto
Copy link
Author

Seems you can force a flush of a metric using Meterprovider::Forceflush() (see open-telemetry/opentelemetry-cpp#2516).

Maybe if you set a very high export_interval_millis and force a flush in the C function it will send the metric instantly.

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

No branches or pull requests

3 participants