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

feat: Adds telemetry for faucet and postgresql #149

Closed

Conversation

andres-ixpantia
Copy link

This feature will allow us track the number of requests, response times and other data for plumber APIs and Shiny Applications.

The new feature

HTTP Telemetry

faucet now offers the option of saving HTTP events to a PostgreSQL database.
This can be very helpful for tracking latency, total API calls and other
important information.

In order to use this feature you will need a PostgreSQL database with a table
called faucet_http_events. You can create the table using this table with
the following SQL query:

CREATE TABLE faucet_http_events (
    namespace TEXT,
    target TEXT,
    ip_addr INET,
    method TEXT,
    path TEXT,
    version TEXT,
    status SMALLINT,
    user_agent TEXT,
    elapsed BIGINT,
    time TIMESTAMPTZ
);

Connection Strings

In order to connect to the database you will need to pass the
FAUCET_TELEMETRY_POSTGRES_STRING environment variable or the
--pg-con-string CLI argument.

This should include either a connection string or a URL with the postgres://
protocol.

Example connection strings

FAUCET_TELEMETRY_POSTGRES_STRING="host=localhost user=postgres connect_timeout=10 keepalives=0"
FAUCET_TELEMETRY_POSTGRES_STRING="host=/var/lib/postgresql,localhost port=1234 user=postgres password='password with spaces'"
FAUCET_TELEMETRY_POSTGRES_STRING="postgresql://user@localhost"
FAUCET_TELEMETRY_POSTGRES_STRING="postgresql://user:[email protected]/mydb?connect_timeout=10"

Telemetry Namespaces

It is likely you want to track different services on the same database. You
can control the column namespace using the environment variable
FAUCET_TELEMETRY_NAMESPACE or cli argument --telemetry-namespace. By
default, this value is "faucet"

@ixpantia ixpantia locked and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants