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(new source): New prometheus_remote_write source #5144

Merged
merged 25 commits into from
Nov 27, 2020

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Nov 20, 2020

I think this is code complete, but I have a couple of questions about non-code bits:

  1. I renamed the existing prometheus source to prometheus_metrics to disambiguate it from this prometheus_remote_write source. I really don't like this choice of name but couldn't think of anything more descriptive. I encourage suggestions so I can improve it.

  2. The output stanza of the cue file is almost certainly wrong. This source translates all input metrics into gauges, unless they are named *_total in which case they are interpreted as counters. Help with encoding that into the metadata would be appreciated.

Closes #4697

Signed-off-by: Bruce Guenter bruce@timber.io

Bruce Guenter added 7 commits November 20, 2020 10:24
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
@bruceg bruceg added source: prometheus type: feature A value-adding code addition that introduce new functionality. labels Nov 20, 2020
@bruceg bruceg requested a review from JeanMertz as a code owner November 20, 2020 16:37
@bruceg bruceg self-assigned this Nov 20, 2020
Bruce Guenter added 4 commits November 20, 2020 14:35
Signed-off-by: Bruce Guenter <bruce@timber.io>
…rite-source

Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
@bruceg bruceg requested a review from ktff as a code owner November 20, 2020 23:23
…rite-source

Signed-off-by: Bruce Guenter <bruce@timber.io>
Copy link
Contributor

@ktff ktff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding names, it is a bit confusing with what's the difference between the two prometheus sources, this also applies to their sinks, so we can use the naming to clarify this a bit. It seams that their differentiating feature is if it's push/pull or serving/accepting based, so what about using that in names, ex. :

  • prometheus_pull for old prometheus source
  • prometheus_push for prometheus_remote_write sink
  • prometheus_serve for prometheus_exporter sink
  • prometheus_accept for prometheus_remote_write source

@binarylogic
Copy link
Contributor

@ktff we landed on:

  • prometheus_remote_write source
  • prometheus_remote_write sink
  • prometheus_exporter sink
  • prometheus_scrape source

We're trying to use known Prometheus terms. "remote_write" and "exporter" are the standard terms for each Prometheus protocol.

@bruceg
Copy link
Member Author

bruceg commented Nov 25, 2020

Ping @lukesteensen @JeanMertz @lucperkins Could I get another review on this?

Bruce Guenter added 5 commits November 25, 2020 11:18
Signed-off-by: Bruce Guenter <bruce@timber.io>
…rite-source

Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
…rite-source

Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Bruce Guenter added 2 commits November 27, 2020 10:04
…rite-source

Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
message = "No path is set on the endpoint and we got a parse error, did you mean to use /metrics? This behavior changed in version 0.11.",
endpoint = %url
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the formatting messed up here?

I'm surprised the CI doesn't seem to have caught it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustfmt occasionally gives up in the presence of macros and leaves code un-reformatted. It's quite frustrating.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, that code should be unchanged since it's just a rename. I'm not sure why GitHub is showing it as a separate add.

@binarylogic binarylogic requested review from jszwedko and removed request for lukesteensen and JeanMertz November 27, 2020 17:46
Copy link
Member

@jszwedko jszwedko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I left a few in-line comments, but nothing strictly blocking.

Cargo.toml Outdated
@@ -335,7 +335,7 @@ sources-kubernetes-logs = ["kubernetes", "transforms-merge", "transforms-regex_p
sources-logplex = ["sources-utils-http"]
sources-mongodb_metrics = ["mongodb"]
sources-nginx_metrics = []
sources-prometheus = ["prometheus-parser"]
sources-prometheus = ["prometheus-parser", "snap", "sources-utils-http", "warp"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer to have sources-prometheus_scrape and sources-promotheus_remote_write as separate features. This would be:

  • Consistent with the rest of the sources list
  • Allow easily building just one of the components without the features needed of the other

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH there are several interrelated sinks that have a single feature flag: sinks-gcp and sinks-influxdb (and I added sinks-prometheus).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I see. I feel like I'd prefer to see those ones split up too, but we can punt on that.

@@ -97,6 +97,69 @@ impl InternalEvent for PrometheusHttpError {
}
}

#[derive(Debug)]
pub struct PrometheusRemoteWriteParseError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I might put these events in separate modules for each source.

@@ -6,8 +6,10 @@ mod tcp;
#[cfg(all(unix, feature = "sources-utils-unix",))]
mod unix;

#[cfg(any(feature = "sources-http", feature = "sources-logplex"))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, we could choose to support this feature with this source. That would alleviate the need to conditionally compile it here.

Bruce Guenter added 3 commits November 27, 2020 14:35
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
@bruceg bruceg requested a review from lukesteensen as a code owner November 27, 2020 20:55
@bruceg bruceg removed the request for review from lukesteensen November 27, 2020 20:58
Bruce Guenter added 2 commits November 27, 2020 16:31
Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Bruce Guenter <bruce@timber.io>
@bruceg bruceg merged commit ba910af into master Nov 27, 2020
@bruceg bruceg deleted the prometheus-remote-write-source branch November 27, 2020 23:39
mengesb pushed a commit to jacobbraaten/vector that referenced this pull request Dec 9, 2020
* Rename prometheus source to prometheus_scrape (with alias)

* Move prometheus shared bits to top level

* Add prometheus remote_write source

* Unify all the TLS test settings

* Add documentation alias for renamed prometheus_exporter sink

Signed-off-by: Bruce Guenter <bruce@timber.io>
Signed-off-by: Brian Menges <brian.menges@anaplan.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Prometheus remote_write source
6 participants