Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyst 0.2.0 #2

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Analyst 0.2.0 #2

wants to merge 8 commits into from

Conversation

pauljohanneskraft
Copy link
Collaborator

Analyst 0.2.0

♻️ Current situation

The current Metrics Query API does not really allow an implementing metrics provider to specify, which operations are valid or not. Furthermore, it is not extensible to operations that one provider has and another does not.

Analyst at the moment features a dependency to Presenter. To reduce the clutter of unnecessary dependencies, it will be removed from this repository and moved to another (possibly Presenter directly or ApodiniAnalystPresenter).

Analyst features close to zero testing coverage.

Analyst has too many dependencies for minor features (such as a networking dependency, even though a system-one could be used).

Analyst can only be used for metrics and traces together.

💡 Proposed solution

To increase type safety in this regard, the new API is much more massive by defining separate types for each operator. These types can be made available to each provider depending on whether they make them conform to a protocol or not - See PrometheusAnalyst for an example of that.

PrometheusAnalyst should feature some tests with an active Prometheus instance (that is run from within the test).

Analyst gets rid of dependencies to Presenter, AsyncHTTPClient and NIO. It adds a (small) dependency to Swift-Metrics, however, since that makes the API of Collector and Analyst more consistent without unnecessarily bloating the framework with a lot of unused features.

There is now MetricAnalyst, TraceAnalyst and Analyst (which is simply MetricAnalyst+TraceAnalyst).

Implications

Refactorings that include interface changes. Most of the operations should be somewhat compatible with both systems, but they are not 1-to-1-translatable in some cases.

Users of this framework will need to add dependencies of AsyncHTTPClient and NIO, if they have not otherwise specified and are using their interface through Analyst at the moment.

Testing

Yes, some minor tests on whether the Metric Query API is working correctly for Prometheus (i.e. checking expected and computed strings). There is also a test that runs Prometheus itself and checks whether network requests can be sent and received successfully.

Reviewer Nudging

Take a look at the Metric Query API - first the folders "0 Operators", "1 Operator", "2 Operators" and some of its operators to understand how queries are now built - it is probably too difficult to check all operators separately, but having a look at the overall structure and understanding that makes a lot of sense.

Also, it makes sense to have a look at how Prometheus implements the MetricAnalyst operators (not checking all of them, but having a brief overview).

@codecov
Copy link

codecov bot commented Dec 5, 2021

Codecov Report

Merging #2 (a2861be) into develop (66119f3) will increase coverage by 8.79%.
The diff coverage is 14.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop      #2      +/-   ##
==========================================
+ Coverage     0.85%   9.65%   +8.79%     
==========================================
  Files           29     216     +187     
  Lines          234    2818    +2584     
==========================================
+ Hits             2     272     +270     
- Misses         232    2546    +2314     
Impacted Files Coverage Δ
Sources/JaegerAnalyst/NIO+Async.swift 0.00% <0.00%> (ø)
...erAnalyst/Provider/JaegerProvider+Conversion.swift 0.00% <0.00%> (ø)
...Analyst/Provider/JaegerProvider+Dependencies.swift 0.00% <0.00%> (ø)
...erAnalyst/Provider/JaegerProvider+Operations.swift 0.00% <0.00%> (ø)
...egerAnalyst/Provider/JaegerProvider+Services.swift 0.00% <0.00%> (ø)
...JaegerAnalyst/Provider/JaegerProvider+Traces.swift 0.00% <0.00%> (ø)
...ources/JaegerAnalyst/Provider/JaegerProvider.swift 0.00% <ø> (ø)
...icAnalyst/Query/0 Operators/Range/RangeQuery.swift 0.00% <0.00%> (ø)
.../Query/0 Operators/Scalar/ScalarQuery+Double.swift 0.00% <0.00%> (ø)
...yst/Query/0 Operators/Scalar/ScalarQuery+Int.swift 0.00% <0.00%> (ø)
... and 210 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66119f3...a2861be. Read the comment docs.

@PSchmiedmayer
Copy link
Contributor

PSchmiedmayer commented Dec 6, 2021

@pauljohanneskraft Thanks for the improvements to Analyst! I took a look at the new Query API, it looks very nice! 🥳

Regarding the failing macOS builds. Unfortunately GitHub Actions currently don't support macOS 12 at the moment (actions/runner-images#3649) which would be the easy fix.
Unfortunately using the latest Xcode beta (13.2) is also not sufficient as there are are still some issues as listed in Apodini/Apodini#374 which affect this PR as well as there are some issues running an executable supporting Swift Concurrency on older macOS versions at the moment.
So my recommendation would be to stick with macOS 11 builds and therefore not running the tests at the moment but then switch to macOS 12 as soon as it is supported on GitHub Actions or Xcode 13.2 once there is a release fixing the Swift Concurrency issues. Whatever comes first 😄

As discussed you also have the GitHub permissions to merge the PR despite the SwiftLint warnings once you feel the PR is ready 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants