Skip to content

Create a proposal for supporting dynamic scrape endpoint output for browser agents #58

@ywwg

Description

@ywwg

Proposal

Users often use a web browser to test their endpoints, to confirm that their metrics are working. Content Negotiation with the scrape endpoint is done solely through the Accept and Content Type headers, which cannot reasonable be configured when using a web browser. When the endpoint receives no specific Accept headers, it returns the oldest/simplest scrape output it supports, Prometheus 0.0.1 text format.

This fallback behavior can cause confusion, for instance when a user is expecting UTF-8 characters but the browser only shows underscore-escaped metrics.

I suggest we do some basic user agent sniffing to detect browsers and use that to trigger some changes to the scrape output:

  • Comments at the top of the output giving some status, such as the format of the output (Content Type values).
  • Default to UTF-8 display (this will not change the output for users with legacy metric/label names).
  • Support URL parameters to change the desired output -- escaping selections, optional exemplar display, etc
  • Optionally: a drop-down selector to provide the user an easy way to set those URL parameters.

One small edge case is we would have to decide if URL parameters override content negotiation headers if they are also provided.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions