Skip to content

[receiver/apache] Add metrics for max workers, bytes per second, and requests per second#47223

Open
hardik-choksi wants to merge 3 commits intoopen-telemetry:mainfrom
hardik-choksi:feat/apache-receiver-new-metrics
Open

[receiver/apache] Add metrics for max workers, bytes per second, and requests per second#47223
hardik-choksi wants to merge 3 commits intoopen-telemetry:mainfrom
hardik-choksi:feat/apache-receiver-new-metrics

Conversation

@hardik-choksi
Copy link
Copy Markdown
Contributor

Summary

Resolves #47061

Adds three new metrics to the Apache receiver, all sourced from the standard
server-status?auto endpoint:

  • apache.workers.max (gauge, int) — Total worker slots, derived from
    len(Scoreboard). Enables utilization calculation: apache.workers{state=busy} / apache.workers.max.
  • apache.bytes_per_sec (gauge, double) — Average bytes served per second, read from
    the BytesPerSec field.
  • apache.requests_per_sec (gauge, double) — Average requests served per second, read
    from the ReqPerSec field.

All three metrics are set to stability: development and enabled: true.

Changes

  • metadata.yaml — Added 3 new metric definitions
  • scraper.go — Added parsing for BytesPerSec, ReqPerSec, and scoreboard length
  • Updated unit test mock server data and golden files
  • Updated integration test expected output
  • Generated code via make generate
  • Added changelog entry

Test plan

  • Unit tests pass (go test ./...)
  • Lint passes (make lint)
  • Code generation is up to date (make generate)
  • Changelog validates (make chlog-validate)
  • Integration tests with real Apache container (go test -tags=integration ./...)

… requests per second

   Add three new metrics to the Apache receiver from the server-status?auto endpoint:
   - apache.workers.max: total worker slots derived from scoreboard length
   - apache.bytes_per_sec: average bytes served per second (BytesPerSec field)
   - apache.requests_per_sec: average requests served per second (ReqPerSec field)

   Closes open-telemetry#47061
Comment on lines +15 to +17
### apache.bytes_per_sec

The average number of bytes served per second since the server was started.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about making this apache.request.io or apache.connection.io based on https://opentelemetry.io/docs/specs/semconv/general/naming/#instrument-naming

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Um, its an lifetime average, not an instataneous I/O, also just IO sounds also vague. and its not bidirectional - its just server's outbound bytes.

check this out

maybe we can come up with a better name.

Copy link
Copy Markdown
Contributor

@thompson-tomo thompson-tomo Mar 31, 2026

Choose a reason for hiding this comment

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

What about apache.request.rate.io or even apache.request_rate.io, with my preference being the later.

This way we could in the future also capture incoming data rate.

Alternatively we could do apache.request_rate.io.transferred or if we are sure we would only ever want to capture recieved we could do apache.request_rate.io.recieved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how about apache.connection.tx_bytes ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The bytes seems some redundant in the name & we then are back at the initial situation and it is not clear that it is the average.

I think it would be nice to have it with alongside ie same sub namespace as apache.request_rate.count.

That way all apache.request_rate.* metrics are describing the requests being processed per second. I still like having io as that way we could also opt to capture not just incoming but outgoing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After looking at how other receivers in this repo handle similar metrics, I think .io isn't the right fit here - in OTel conventions, .io implies bidirectional data flow with a direction attribute (e.g., system.network.io, iis.network.io), but Apache's BytesPerSec is outbound-only server throughput.

The established pattern for bytes/second rates across receivers is .throughput:

  • vcenter.host.network.throughput (KiBy/s)
  • mongodbatlas.disk.partition.throughput (By/s)
  • splunk.indexer.throughput (By/s)

Since we already have apache.traffic as the cumulative byte counter, I'd propose apache.traffic.throughput - it clearly signals this is the rate form of the existing traffic metric.

What do you think?

Comment on lines +111 to +112
apache.requests_per_sec:
description: "ApacheRequestsPerSecMetricConfig provides config for the apache.requests_per_sec metric."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
apache.requests_per_sec:
description: "ApacheRequestsPerSecMetricConfig provides config for the apache.requests_per_sec metric."
apache.request.count.1sec:
description: "ApacheRequestsPerSecMetricConfig provides config for the apache.request.count.1sec."

That way it suits alongside the other request metrics and naming guidance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one is also a life time average rate (Total Accesses / Uptime), The 1sec name would be misleading as it implies 1 second window count. maybe we can keep it apache.request.rate

Copy link
Copy Markdown
Contributor

@thompson-tomo thompson-tomo Mar 31, 2026

Choose a reason for hiding this comment

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

How about apache.request_rate.count to complement the other metric.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that sounds good.

hardik-choksi and others added 2 commits March 31, 2026 09:52
Co-authored-by: James Thompson <thompson.tomo@outlook.com>
Applies reviewer feedback to use singular noun and 'limit' suffix
following opentelemetry semantic convention instrument naming
guidelines.
regenerated code via make generate and reordered golden files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

receiver/apache: Add metrics for max workers, bytes per second, and requests per second

4 participants