Skip to content

Allow for scoping of auto marking #25

Description

@domtronn

The automark functionality should be allowed to take a scope to be used in different areas of the application, rather than just once on access.

e.g.

[
  {
    "name": "total_upstream_requests",
    "help": "A count of the upstream calls with cache hits",
    "type": "Gauge",
    "mark": {
      "id":"cache",
      "method":"set",
      "path":["cache", "size"]
     }
  },
  {
    "name": "http_request_duration_hist_seconds",
    "help": "The response time of requests",
    "type": "Histogram",
    "labelNames": [
      { "key": "method", "path": [ "req", "method" ] },
      { "key": "code", "path": [ "res", "status" ] },
      { "key": "path", "path": [ "_matchedRoute" ] }
    ],
    "mark": {
      "id": "access",
      "method": "observe",
      "path": [ "res", "responseTime" ]
    },
    "buckets": {
      "type": "linear",
      "start": 40,
      "buckets": 15,
      "factor": 40
    }
  }
]

This declare to metrics that will be marked given different contexts, one on access and one when interacting with the cache, you could call them with

meters.automark('cache', cache)
meters.automark('access', ctx)

One of the main concerns would be how to make this backwards compatible for when no id / namespace is defined.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions