Relabeling for proxied hosts

23 views
Skip to first unread message

Mykola Buhryk

unread,
Mar 27, 2024, 5:20:08 PM3/27/24
to Prometheus Users
Hello, 

I'm looking for a possibility to have one Prometheus job that can include targets that are not directly accessible by Prometheus.

For now, I have 2 separate jobs, one for standard hosts, and a second one for proxied where I need to set the proxy_url parameter

So my question is, is there any way to achieve the same result with relabeling within one job?

Brian Candler

unread,
Mar 28, 2024, 2:41:30 AM3/28/24
to Prometheus Users
According to the source in prometheus-common/model/labels.go, these are the only declared magic labels:

const (
        // AlertNameLabel is the name of the label containing the an alert's name.
        AlertNameLabel = "alertname"

        // ExportedLabelPrefix is the prefix to prepend to the label names present in
        // exported metrics if a label of the same name is added by the server.
        ExportedLabelPrefix = "exported_"

        // MetricNameLabel is the label name indicating the metric name of a
        // timeseries.
        MetricNameLabel = "__name__"

        // SchemeLabel is the name of the label that holds the scheme on which to
        // scrape a target.
        SchemeLabel = "__scheme__"

        // AddressLabel is the name of the label that holds the address of
        // a scrape target.
        AddressLabel = "__address__"

        // MetricsPathLabel is the name of the label that holds the path on which to
        // scrape a target.
        MetricsPathLabel = "__metrics_path__"

        // ReservedLabelPrefix is a prefix which is not legal in user-supplied
        // label names.
        ReservedLabelPrefix = "__"

        // MetaLabelPrefix is a prefix for labels that provide meta information.
        // Labels with this prefix are used for intermediate label processing and
        // will not be attached to time series.
        MetaLabelPrefix = "__meta_"

        // TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
        // Labels with this prefix are used for intermediate label processing and
        // will not be attached to time series. This is reserved for use in
        // Prometheus configuration files by users.
        TmpLabelPrefix = "__tmp_"

        // ParamLabelPrefix is a prefix for labels that provide URL parameters
        // used to scrape a target.
        ParamLabelPrefix = "__param_"

        // JobLabel is the label name indicating the job from which a timeseries
        // was scraped.
        JobLabel = "job"

        // InstanceLabel is the label name used for the instance label.
        InstanceLabel = "instance"

        // BucketLabel is used for the label that defines the upper bound of a
        // bucket of a histogram ("le" -> "less or equal").
        BucketLabel = "le"

        // QuantileLabel is used for the label that defines the quantile in a
        // summary.
        QuantileLabel = "quantile"
)


Hence I don't think you can do what you want in relabeling; you need separate jobs.
Reply all
Reply to author
Forward
0 new messages