Skip to content

Prometheus is not able to parse metrics when WebLogic is running under MS-Windows #16

Closed
@echocharlie125

Description

@echocharlie125

Under Windows, each line of metrics sent from WebLogic Monitoring Exporter is ended with \n\r (line feed, carriage return) The Carriage return (\r) character is not expected by Prometheus when it parses each metrics line and then raise an exception.
This issue can be solved with an update of methods printMetric() and printPerformanceMetrics() from the io.prometheus.wls.rest.MetricsStream class.

Here is a correction proposal :
void printMetric(String name, Object value) {
//println(name + " " + value);
printf( "%s %s\n", name, value);
scrapeCount++;
}

/**
 * Prints the summary performance metrics
 */
void printPerformanceMetrics() {
    //printf( "%s %d%n", getCountName(), scrapeCount);
    //printf("%s %.2f%n", getDurationName(), toSeconds(getElapsedTime()));
    //printf("%s %.2f%n", getCpuUsageName(), toSeconds(getCpuUsed()));
    printf( "%s %d\n", getCountName(), scrapeCount);
    printf("%s %.2f\n", getDurationName(), toSeconds(getElapsedTime()));
    printf("%s %.2f\n", getCpuUsageName(), toSeconds(getCpuUsed()));
}

Metadata

Metadata

Assignees

No one assigned

    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