open-telemetry / oteps

OpenTelemetry Enhancement Proposals
https://opentelemetry.io
Apache License 2.0
337 stars 164 forks source link

Proposal: Dynamic configuration of metrics #209

Open tttoad opened 2 years ago

tttoad commented 2 years ago

This OTEP is to add support for parsing request information to generate metrics. Some business-related metrics need to be generated by parsing the request information (e.g., request body, header, response body).

For example. Counting the number of active users per minute. The configuration could be as follows.

{
    "service": "user-center",
    "config": [{
        "name": "request",
        "key": "user",
        "interval": "60s",
        "type": "counter"
    }]
}

Provide a method for end users to pass in request information. Parse the request information, record the number of times the user field appears and report it once per minute.

I want this configuration to be stored on the remote server, and the client can listen to changes in the configuration to turn on or off the reporting of metrics. The end user can enable data collection for a metric at any time for the information in the request. This could be the number of successful or failed requests, the number of requests with a delay greater than 3ms, or the number of requests with the key equal to user. If the open-telemetry group is interested, I can provide a preliminary design and implementation.

jmacd commented 2 years ago

Given the existing metrics Views SDK specification supports the kind of query used in your example, this appears to be a request for dynamic configuration of the SDK for Views.

Possibly related, need for a file-format-level encoding of Views: https://github.com/open-telemetry/opentelemetry-specification/issues/1773

Possibly related, Jaeger remote sampling configuration mechanism.

tttoad commented 2 years ago

Given the existing metrics Views SDK specification supports the kind of query used in your example, this appears to be a request for dynamic configuration of the SDK for Views.

Possibly related, need for a file-format-level encoding of Views: open-telemetry/opentelemetry-specification#1773

Possibly related, Jaeger remote sampling configuration mechanism.

Yes, I would like to define the specification for remote dynamic configuration distribution.

I'm not sure if there is currently a feature to automatically parse the request and response parameters to generate metrics. If this feature is available, I would like to add a configuration about it. just like

{
    "service": "user-center",
    "config": [{
        "name": "request", // or response 
        "key": "user",  
        "interval": "60s",
        "type": "counter" // or updown , gauge
    }]
}