Skip to content

Commit

Permalink
Update API calls to prom client to add all labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ddumitrache committed Feb 6, 2023
1 parent 66f4239 commit 3abe166
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions lib/fluent/plugin/in_gcloud_pubsub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,28 @@ def configure(conf)
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_messages_pulled") do
::Prometheus::Client.registry.histogram(
:"#{@metric_prefix}_messages_pulled",
"Number of Pub/Sub messages pulled by the subscriber on each invocation",
{},
[0, 1, 10, 50, 100, 250, 500, 1000],
docstring: "Number of Pub/Sub messages pulled by the subscriber on each invocation",
labels: {},
buckets: [0, 1, 10, 50, 100, 250, 500, 1000],
)
end

@messages_pulled_bytes =
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_messages_pulled_bytes") do
::Prometheus::Client.registry.histogram(
:"#{@metric_prefix}_messages_pulled_bytes",
"Total size in bytes of the Pub/Sub messages pulled by the subscriber on each invocation",
{},
[100, 1000, 10_000, 100_000, 1_000_000, 5_000_000, 10_000_000],
docstring: "Total size in bytes of the Pub/Sub messages pulled by the subscriber on each invocation",
labels: {},
buckets: [100, 1000, 10_000, 100_000, 1_000_000, 5_000_000, 10_000_000],
)
end

@pull_errors =
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_pull_errors_total") do
::Prometheus::Client.registry.counter(
:"#{@metric_prefix}_pull_errors_total",
"Errors encountered while pulling or processing messages",
{},
docstring: "Errors encountered while pulling or processing messages",
labels:{},
)
end
end
Expand Down
16 changes: 8 additions & 8 deletions lib/fluent/plugin/out_gcloud_pubsub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,28 @@ def configure(conf)
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_messages_published_per_batch") do
::Prometheus::Client.registry.histogram(
:"#{@metric_prefix}_messages_published_per_batch",
"Number of records published to Pub/Sub per buffer flush",
{},
[1, 10, 50, 100, 250, 500, 1000],
docstring: "Number of records published to Pub/Sub per buffer flush",
labels: {},
buckets: [1, 10, 50, 100, 250, 500, 1000],
)
end

@bytes_published =
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_messages_published_bytes") do
::Prometheus::Client.registry.histogram(
:"#{@metric_prefix}_messages_published_bytes",
"Total size in bytes of the records published to Pub/Sub",
{},
[100, 1000, 10_000, 100_000, 1_000_000, 5_000_000, 10_000_000],
docstring: "Total size in bytes of the records published to Pub/Sub",
labels: {},
buckets: [100, 1000, 10_000, 100_000, 1_000_000, 5_000_000, 10_000_000],
)
end

@compression_enabled =
Fluent::GcloudPubSub::Metrics.register_or_existing(:"#{@metric_prefix}_compression_enabled") do
::Prometheus::Client.registry.gauge(
:"#{@metric_prefix}_compression_enabled",
"Whether compression/batching is enabled",
{},
docstring:"Whether compression/batching is enabled",
labels: {},
)
end
@compression_enabled.set(common_labels, @compress_batches ? 1 : 0)
Expand Down

0 comments on commit 3abe166

Please sign in to comment.