Skip to content

Make Prometheus endpoint take Accept header into account - #4674

Merged
hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
mrkloan:dev-2.x
Dec 14, 2022
Merged

hannesj merged 3 commits into
opentripplanner:dev-2.xfrom
mrkloan:dev-2.x

Conversation

@mrkloan

@mrkloan mrkloan commented Dec 13, 2022

Copy link
Copy Markdown
Contributor

Summary

closes #4673 by adding a wildcard @Produces on the /otp/actuators/prometheus endpoint method.

@mrkloan
mrkloan requested a review from a team as a code owner December 13, 2022 16:54
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Base: 60.86% // Head: 60.86% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (9a41d19) compared to base (1f6f0de).
Patch has no changes to coverable lines.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #4674      +/-   ##
=============================================
- Coverage      60.86%   60.86%   -0.01%     
  Complexity     12333    12333              
=============================================
  Files           1594     1594              
  Lines          63814    63814              
  Branches        6998     6998              
=============================================
- Hits           38843    38841       -2     
- Misses         22794    22796       +2     
  Partials        2177     2177              
Impacted Files Coverage Δ
.../org/opentripplanner/ext/actuator/ActuatorAPI.java 0.00% <ø> (ø)
...aph_builder/module/OsmBoardingLocationsModule.java 78.82% <0.00%> (-2.36%) ⬇️
...ripplanner/model/transfer/ConstrainedTransfer.java 83.33% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mrkloan

mrkloan commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

Opened to suggestions on how to best test this.

@hannesj

hannesj commented Dec 13, 2022

Copy link
Copy Markdown
Contributor

We should probably always return text/plain; version=0.0.4, as described in the documentation

@mrkloan

mrkloan commented Dec 14, 2022

Copy link
Copy Markdown
Contributor Author

We should probably always return text/plain; version=0.0.4, as described in the documentation

You are right; in my latest commit I added support for both Prometheus and OpenMetrics format based on the Accept request header, and the endpoint now produces the exact Content-Type used in the response.

Comment thread src/ext/java/org/opentripplanner/ext/actuator/ActuatorAPI.java
@leonardehrenfried leonardehrenfried changed the title Introduced wildcard produces on prometheus endpoint. Make Prometheus endpoint take Accept header into account Dec 14, 2022
@leonardehrenfried leonardehrenfried added the !Improvement A functional improvement or micro feature label Dec 14, 2022
@leonardehrenfried

Copy link
Copy Markdown
Member

BTW, if BlahBlahCar is using OTP in production, we would love to hear about it. Lots of core developers chat on https://gitter.im/opentripplanner/OpenTripPlanner and we have video meetings twice a week.

@mrkloan mrkloan changed the title Make Prometheus endpoint take Accept header into account Fix Content-Type for Prometheus actuator endpoint. Dec 14, 2022
@mrkloan mrkloan changed the title Fix Content-Type for Prometheus actuator endpoint. Make Prometheus endpoint take Accept header into account Dec 14, 2022
@leonardehrenfried leonardehrenfried added the +Sandbox This will be implemented as a Sandbox feature label Dec 14, 2022
@hannesj
hannesj merged commit b58a09e into opentripplanner:dev-2.x Dec 14, 2022
t2gran pushed a commit that referenced this pull request Dec 14, 2022
@t2gran t2gran added this to the 2.3 milestone Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!Improvement A functional improvement or micro feature +Sandbox This will be implemented as a Sandbox feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actuators Prometheus endpoint refusing all Accept header values resulting in 406 Not Acceptable

5 participants