Skip to content

Commit

Permalink
Merge pull request #96 from tpbrown/cache-control
Browse files Browse the repository at this point in the history
Cache-Control on Prometheus endpoint
  • Loading branch information
Marky Jackson authored May 3, 2019
2 parents 6e39e06 + 6a20917 commit b52d300
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static HttpResponse prometheusResponse(final CollectorRegistry collectorR
public void generateResponse(StaplerRequest request, StaplerResponse response, Object node) throws IOException, ServletException {
response.setStatus(StaplerResponse.SC_OK);
response.setContentType(TextFormat.CONTENT_TYPE_004);
response.addHeader("Cache-Control","must-revalidate,no-cache,no-store");


StringWriter buffer = new StringWriter();
TextFormat.write004(buffer, collectorRegistry.metricFamilySamples());
Expand All @@ -25,4 +27,4 @@ public void generateResponse(StaplerRequest request, StaplerResponse response, O
}
};
}
}
}

0 comments on commit b52d300

Please sign in to comment.