function incrementCounter(name, value)
%incrementCounter create a Prometheus metric event of type 'Counter'.
%
%   prodserver.metrics.incrementCounter(NAME, VALUE) creates a
%   Prometheus metrics event that is collected by MATLAB Production Server,
%   when the MATLAB code is deployed and executed.
%   This information can be queried via MATLAB Production Server Metrics API.
%
%   Input arguments:
%       NAME     Scalar text which identifies the metrics counter name.
%
%       VALUE    Scalar positive number that is added to the counter current
%                value, which is maintained by MATLAB Production Server.
%                Note that counter value monotonically increases over time.
%
%   Output:
%       This function does not have a return value.
%       This function emits an encoded metric event string to be collected
%       and processed by MATLAB Production Server, when the MATLAB code is
%       deployed and being executed.
%
%   Examples:
%       prodserver.metrics.incrementCounter("requests_processed_total", 1)
%       Increment the current value of "requests_processed_total" counter by 1.
%
%       prodserver.metrics.incrementCounter('cpu_seconds_total', 10.24)
%       Increment the current value of "cpu_seconds_total" counter by 10.24.
%
%   See also: prodserver.metrics.setGauge

% Copyright 2021 The MathWorks, Inc.

    p = inputParser;
    addRequired(p,'name', prodserver.metrics.internal.InputValidator.metricsString);
    addRequired(p,'value',prodserver.metrics.internal.InputValidator.metricsPositive);
    parse(p, name, value);

    [~, archive, ~] = fileparts(ctfroot);
    fprintf('[metric:counter] %s|%s %g\n', archive, name, value);
end

