n1ru4l / envelop

Envelop is a lightweight library allowing developers to easily develop, share, collaborate and extend their GraphQL execution layer. Envelop is the missing GraphQL plugin system.
https://envelop.dev
MIT License
787 stars 127 forks source link

refactor(prometheus-plugin): rename metrics options #2270

Closed EmrysMyrddin closed 2 months ago

EmrysMyrddin commented 3 months ago

Description

For this plugin to work, each metric the user want to be exported should be manually enabled using the corresponding option. But the name of the exported metric and its corresponding option are different, which is confusing for users.

This PR renames all the options to use their actual metric name.

Type of change

Please delete options that are not relevant.

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 0ece136994d3690b5f22057aeaa945b3efcf8c35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------- | ----- | | @envelop/prometheus | Major | | @envelop/benchmark | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 3 months ago

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets): Package Version Info
@envelop/prometheus 11.0.0-alpha-20240813090609-0ece1369 npm ↗︎ unpkg ↗︎
github-actions[bot] commented 3 months ago
### 💻 Website Preview The latest changes are available as preview in: [https://bb800b38.envelop.pages.dev](https://bb800b38.envelop.pages.dev)
theguild-bot commented 3 months ago

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 748888     ✗ 0     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: 100.00% ✓ 160464     ✗ 0     
     ✓ { mode:envelop-cache-jit }.......................: 100.00% ✓ 327374     ✗ 0     
     ✓ { mode:envelop-just-cache }......................: 100.00% ✓ 159838     ✗ 0     
     ✓ { mode:graphql-js }..............................: 100.00% ✓ 101212     ✗ 0     
     data_received......................................: 2.9 GB  24 MB/s
     data_sent..........................................: 163 MB  1.4 MB/s
     envelop_init.......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     envelop_total......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     event_loop_lag.....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_context....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_execute....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_parse......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     graphql_validate...................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_blocked...................................: avg=1.98µs  min=691ns    med=1.83µs  max=9.59ms  p(90)=2.34µs  p(95)=2.61µs 
     http_req_connecting................................: avg=16ns    min=0s       med=0s      max=1.21ms  p(90)=0s      p(95)=0s     
     http_req_duration..................................: avg=2.92ms  min=161.8µs  med=2.84ms  max=40.04ms p(90)=5.28ms  p(95)=6.25ms 
       { expected_response:true }.......................: avg=2.92ms  min=161.8µs  med=2.84ms  max=40.04ms p(90)=5.28ms  p(95)=6.25ms 
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=3.47ms  min=421.92µs med=3.05ms  max=18.96ms p(90)=5.88ms  p(95)=6.32ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=1.54ms  min=161.8µs  med=1.22ms  max=25.52ms p(90)=2.49ms  p(95)=2.67ms 
     ✓ { mode:envelop-just-cache }......................: avg=3.48ms  min=475.69µs med=3.05ms  max=23.03ms p(90)=5.91ms  p(95)=6.35ms 
     ✓ { mode:graphql-js }..............................: avg=5.66ms  min=845µs    med=4.79ms  max=40.04ms p(90)=9.51ms  p(95)=10.27ms
     http_req_failed....................................: 0.00%   ✓ 0          ✗ 374444
     http_req_receiving.................................: avg=33.58µs min=12.54µs  med=30.17µs max=10.28ms p(90)=44.84µs p(95)=48.38µs
     http_req_sending...................................: avg=12.9µs  min=4.16µs   med=10.78µs max=9ms     p(90)=19.6µs  p(95)=20.9µs 
     http_req_tls_handshaking...........................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...................................: avg=2.88ms  min=135.28µs med=2.79ms  max=39.99ms p(90)=5.23ms  p(95)=6.2ms  
     http_reqs..........................................: 374444  3120.27066/s
     iteration_duration.................................: avg=3.19ms  min=351.07µs med=3.09ms  max=41.13ms p(90)=5.55ms  p(95)=6.52ms 
     iterations.........................................: 374444  3120.27066/s
     vus................................................: 10      min=10       max=10  
     vus_max............................................: 20      min=20       max=20  
EmrysMyrddin commented 3 months ago

The last commit is a suggestion, perhaps it could be better to separate metrics enabling/disabling options from the rest, just as we do for labels.

It looks better for types and will be easier to explain in documentation I think.