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

[Docs]OSPP-Add more observability in apollo config client #5229

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Rawven
Copy link

@Rawven Rawven commented Sep 10, 2024

What's the purpose of this PR

related pr apolloconfig/apollo-java#74
XXXXX

Which issue(s) this PR fixes:

Fixes #

Brief changelog

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

Summary by CodeRabbit

  • New Features

    • Enhanced monitoring capabilities for the Apollo client, including new configuration options for enabling and customizing monitoring.
    • Integration with Prometheus for metrics export, with detailed configuration examples provided.
    • Introduction of a new API for retrieving various metrics and status information programmatically.
  • Documentation

    • Added comprehensive guides for monitoring features and integration with custom monitoring systems, specifically for Prometheus.
    • Updated user guides in both English and Chinese to include new monitoring configurations and usage instructions.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 10, 2024
Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The changes enhance the Apollo client monitoring capabilities, specifically for version 2.4.0 and above. New configuration options allow users to enable and customize monitoring through properties and YAML files. The integration with Prometheus for metrics export is detailed, along with a new API for manual data retrieval. Additionally, a Java class for custom monitoring systems is introduced, providing methods for metric registration and initialization.

Changes

Files Change Summary
docs/en/client/java-sdk-user-guide.md, docs/zh/client/java-sdk-user-guide.md Added sections on monitoring configurations, usage instructions, and Prometheus integration, enhancing observability.
docs/en/extension/java-client-how-to-use-custom-monitor-system.md, docs/zh/extension/java-client-how-to-use-custom-monitor-system.md Introduced a new Java class for custom metrics exporting to Prometheus, detailing methods for initialization and metric registration.
src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/* Introduced new classes and methods for metrics exporting, including ApolloClientMetricsExporter and PrometheusApolloClientMetricsExporter.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ApolloClient
    participant PrometheusExporter
    participant CollectorRegistry

    User->>ApolloClient: Configure monitoring
    ApolloClient->>PrometheusExporter: Initialize exporter
    PrometheusExporter->>CollectorRegistry: Register metrics
    User->>ApolloClient: Request metrics
    ApolloClient->>PrometheusExporter: Retrieve metrics
    PrometheusExporter->>CollectorRegistry: Get metrics data
    PrometheusExporter-->>User: Return Prometheus-compatible metrics
Loading

Poem

🐇 In the meadow where data flows,
Monitoring blooms, as knowledge grows.
With Prometheus by our side,
Metrics dance, and insights glide.
Hooray for changes, bright and new,
A leap for clients, just for you! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (3)
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (3)

Line range hint 411-411: Add alternate text to the image.

Images should have alternate text for accessibility.

Add meaningful alternate text within the [] in the image markdown. For example:

![Meaningful alt text describing the image](https://cdn.jsdelivr.net/gh/Rawven/image@main/2024-08-24-14-59-01-image.png)
Tools
LanguageTool

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)


Line range hint 542-542: Add alternate text to the image.

Images should have alternate text for accessibility.

Add meaningful alternate text within the [] in the image markdown. For example:

![Meaningful alt text describing the image](https://raw.githubusercontent.com/Rawven/image/main/20240828003803.png)
Tools
LanguageTool

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)


Line range hint 576-576: Specify the language for the fenced code block.

Fenced code blocks should have a language specified for proper syntax highlighting.

Add the language after the opening triple backticks. For example:

```properties
# TYPE apollo_client_thread_pool_queue_remaining_capacity gauge
...
Tools
LanguageTool

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31e6486 and 15f108b.

Files selected for processing (2)
  • docs/zh/client/java-sdk-user-guide.md (3 hunks)
  • docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (1 hunks)
Additional context used
LanguageTool
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

docs/zh/client/java-sdk-user-guide.md

[uncategorized] ~415-~415: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

Markdownlint
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

141-141: null
Bare URL used

(MD034, no-bare-urls)

docs/zh/client/java-sdk-user-guide.md

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


576-576: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


542-542: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


659-659: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

Additional comments not posted (1)
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (1)

Line range hint 415-415:

Tools
LanguageTool

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)


同时查看Prometheus控制台也能看到如下信息

![](https://raw.githubusercontent.com/Rawven/image/main/20240910002345.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add alternate text to the image.

Images should have alternate text for accessibility.

Add meaningful alternate text within the [] in the image markdown. For example:

![Meaningful alt text describing the image](https://raw.githubusercontent.com/Rawven/image/main/20240910002345.png) 
Tools
Markdownlint

659-659: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

@Rawven
Copy link
Author

Rawven commented Sep 10, 2024

@Anilople PTAL

@Anilople
Copy link
Contributor

可以先搞定中文文档,最后再翻译到英文文档中

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (3)
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (1)

139-142: Convert the bare URL to a Markdown link.

To improve the readability and consistency of the document, consider converting the bare URL to a proper Markdown link.

Apply this diff to convert the bare URL to a Markdown link:

-完整代码:https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java
-/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java
+完整代码:[PrometheusApolloClientMetricsExporter.java](https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java)
Tools
Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)

docs/zh/client/java-sdk-user-guide.md (2)

411-412: Add alternate text to the image.

The image showing the JMX monitoring data is relevant. However, please add meaningful alternate text within the [] in the image markdown to improve accessibility. For example:

![Meaningful alt text describing the image](https://cdn.jsdelivr.net/gh/Rawven/image@main/2024-08-24-14-59-01-image.png)
Tools
Markdownlint

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


415-416: Improve sentence structure for clarity.

The explanation of the apollo.client.monitor.external.type configuration property and its usage for enabling exporters is informative. The flexibility of using officially provided or self-implemented MetricsExporter SPI is also mentioned.

However, the sentence structure could be slightly improved for better clarity, especially the part "这种设计是为了用户能更方便的扩展". Consider rephrasing it as:

这种设计是为了让用户能更方便地扩展。

The addition of "地" makes the sentence more grammatically correct and easier to understand.

Tools
LanguageTool

[uncategorized] ~415-~415: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 15f108b and 7227498.

Files selected for processing (2)
  • docs/zh/client/java-sdk-user-guide.md (3 hunks)
  • docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (1 hunks)
Additional context used
LanguageTool
docs/zh/client/java-sdk-user-guide.md

[uncategorized] ~415-~415: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint
docs/zh/client/java-sdk-user-guide.md

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


576-576: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


542-542: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


656-656: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

141-141: null
Bare URL used

(MD034, no-bare-urls)

Additional comments not posted (12)
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (5)

3-42: LGTM!

The section provides a clear example of creating a custom metrics exporter for Prometheus by extending the AbstractApolloClientMetricsExporter class. The code snippet effectively illustrates the structure of the custom exporter.


44-69: LGTM!

The section clearly explains the purpose of the doInit method in the custom exporter class and when it is called. The code snippets provide helpful context and an example implementation for initializing the Prometheus CollectorRegistry and cache map.


71-80: LGTM!

The section clearly explains the purpose of the isSupport method in the custom exporter class and when it is called by DefaultApolloClientMetricsExporterFactory via SPI. The example implementation is straightforward and easy to understand.


82-121: LGTM!

The section clearly explains the purpose of the registerOrUpdateCounterSample and registerOrUpdateGaugeSample methods in the custom exporter class for registering Counter and Gauge type metrics. The example implementations using the Prometheus client library are straightforward and easy to understand.

Tools
LanguageTool

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)


123-137: LGTM!

The section clearly explains the purpose of the response method in the custom exporter class and how the exported data is used by ConfigMonitor. The example implementation using the Prometheus TextFormat to write the metrics data is straightforward and easy to understand.

docs/zh/client/java-sdk-user-guide.md (7)

402-403: LGTM!

The section introduction for monitoring related configurations looks good.


404-406: Looks good!

The context about the enhanced observability features in version 2.4.0 is clear and informative.


407-408: Configuration prerequisite is clear.

The requirement to set apollo.client.monitor.enabled to true for enabling the monitor feature is clearly mentioned.


409-410: JMX configuration property is clear.

The apollo.client.monitor.jmx.enabled property for exposing monitor data via JMX is clearly mentioned.


413-414: Exception queue size configuration is clear.

The apollo.client.monitor.exception-queue-size property for setting the maximum number of exceptions stored by the monitor, along with its default value, is clearly mentioned.


417-418: Reference to detailed usage section is helpful.

Providing a reference to the "Extension Development - Java Client Access to Different Monitoring Systems" section for specific usage details is helpful for users to find more information.


419-420: Export period configuration is clear.

The apollo.client.monitor.external.export-period property for controlling the frequency of the scheduled task that exports status information from the monitor, along with its default value, is clearly mentioned.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 22, 2024
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.52%. Comparing base (f55b419) to head (254c449).
Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5229      +/-   ##
============================================
+ Coverage     50.30%   50.52%   +0.22%     
- Complexity     2013     2053      +40     
============================================
  Files           388      393       +5     
  Lines         12228    12359     +131     
  Branches       1209     1213       +4     
============================================
+ Hits           6151     6245      +94     
- Misses         5712     5747      +35     
- Partials        365      367       +2     
Flag Coverage Δ
50.52% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Outside diff range and nitpick comments (1)
docs/zh/client/java-sdk-user-guide.md (1)

415-416: Consider rephrasing the sentence for better readability.

The sentence "这种设计是为了用户能更方便的扩展" could be rephrased as "这种设计是为了用户能更方便地扩展" for better readability.

Tools
LanguageTool

[uncategorized] ~415-~415: 动词的修饰一般为'形容词(副词)+地+动词'。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

Tools
LanguageTool

[uncategorized] ~415-~415: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7227498 and 254c449.

Files selected for processing (4)
  • docs/en/client/java-sdk-user-guide.md (4 hunks)
  • docs/en/extension/java-client-how-to-use-custom-monitor-system.md (1 hunks)
  • docs/zh/client/java-sdk-user-guide.md (3 hunks)
  • docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (1 hunks)
Additional context used
LanguageTool
docs/en/client/java-sdk-user-guide.md

[uncategorized] ~422-~422: Loose punctuation mark.
Context: ...ations. apollo.client.monitor.enabled: Enables the Monitor mechanism, i.e., wh...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~424-~424: Loose punctuation mark.
Context: ...se. apollo.client.monitor.jmx.enabled: Exposes Monitor data in JMX format. If ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Loose punctuation mark.
Context: ...llo.client.monitor.exception-queue-size`: Sets the maximum number of exceptions t...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~430-~430: Loose punctuation mark.
Context: .... apollo.client.monitor.external.type: Non-standard configuration item, us...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~434-~434: Loose punctuation mark.
Context: ...o.client.monitor.external.export-period`: The Exporter exports status information...

(UNLIKELY_OPENING_PUNCTUATION)

docs/zh/client/java-sdk-user-guide.md

[uncategorized] ~415-~415: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:方便"地"扩展
Context: ...Exporter的SPI使可用官方提供的或自己实现),这种设计是为了用户能更方便的扩展。多填,错填和不填则不启用任何Exporter。 具体使用见 扩展开发-j...

(wb4)

docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

[uncategorized] ~82-~82: 您的意思是“"既"是”吗?
Context: ...ounterSample,registerOrUpdateGaugeSample即是用来注册Counter,Gauge类型指标的方法,只需要根据传来的参数正常注册...

(JI11_JI2)

Markdownlint
docs/en/client/java-sdk-user-guide.md

604-604: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


573-573: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


684-684: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

docs/en/extension/java-client-how-to-use-custom-monitor-system.md

141-141: null
Bare URL used

(MD034, no-bare-urls)

docs/zh/client/java-sdk-user-guide.md

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


576-576: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


542-542: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


656-656: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

docs/zh/extension/java-client-how-to-use-custom-monitor-system.md

141-141: null
Bare URL used

(MD034, no-bare-urls)

Additional comments not posted (18)
docs/zh/extension/java-client-how-to-use-custom-monitor-system.md (5)

1-2: Helpful overview!

The introduction provides a clear and concise overview of the new metrics collection and export feature in the Java client. It sets the context for the changes introduced in this file.


9-40: LGTM!

The PrometheusApolloClientMetricsExporter class structure and method signatures are well-defined. The class extends the appropriate base class and implements the required interface. The method names are descriptive and follow the naming conventions.


60-68: Initialization looks good!

The doInit() method correctly initializes the CollectorRegistry and the map to store metrics. The introduction of the Prometheus Java client dependency is justified and necessary for integrating with Prometheus.


84-120: Implementation looks solid!

The registerOrUpdateCounterSample(...) and registerOrUpdateGaugeSample(...) methods are implemented correctly. The logic for registering and updating counters and gauges follows the best practices of checking for the existence of a metric before creating a new one. The code is readable and well-structured.


125-136: Response method looks good!

The response() method is implemented correctly and follows the expected format for Prometheus. The use of StringWriter is appropriate for writing the metrics, and the error handling is adequate, logging an error message if the write operation fails.

docs/en/extension/java-client-how-to-use-custom-monitor-system.md (1)

1-141: Excellent documentation for creating a custom metrics exporter!

The documentation provides clear step-by-step instructions on how to create a custom metrics exporter for the Apollo Java client to integrate with Prometheus. The code examples are well-structured and cover key aspects such as initialization, metrics registration, and response generation.

This will greatly help users extend the Apollo Java client for monitoring purposes. Great work!

Tools
Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)

docs/zh/client/java-sdk-user-guide.md (6)

402-402: LGTM!

The section heading is clear and describes the content that follows.


404-406: LGTM!

The statement provides useful information about the new observability features in version 2.4.0.


407-408: LGTM!

The statement provides clear instructions on how to enable the monitor feature.


409-410: LGTM!

The statement provides clear instructions on how to enable JMX exposure of monitor data.


413-414: LGTM!

The statement provides clear information about the configuration option and its default value.


417-418: LGTM!

The statement provides a reference to where more information about using the feature can be found.

docs/en/client/java-sdk-user-guide.md (6)

417-435: Excellent addition of monitor-related configurations!

The new configuration options significantly enhance the observability of the Apollo client. The defaults are sensible, and the options provide flexibility to customize the monitoring behavior as needed.

Tools
LanguageTool

[uncategorized] ~422-~422: Loose punctuation mark.
Context: ...ations. apollo.client.monitor.enabled: Enables the Monitor mechanism, i.e., wh...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~424-~424: Loose punctuation mark.
Context: ...se. apollo.client.monitor.jmx.enabled: Exposes Monitor data in JMX format. If ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Loose punctuation mark.
Context: ...llo.client.monitor.exception-queue-size`: Sets the maximum number of exceptions t...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~430-~430: Loose punctuation mark.
Context: .... apollo.client.monitor.external.type: Non-standard configuration item, us...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~434-~434: Loose punctuation mark.
Context: ...o.client.monitor.external.export-period`: The Exporter exports status information...

(UNLIKELY_OPENING_PUNCTUATION)


544-602: Great usage examples for the monitor feature!

The instructions are clear and easy to follow. The configuration examples cover common monitoring scenarios, and the code snippets provide a helpful reference for integrating the feature into a Spring application.

Tools
Markdownlint

573-573: null
Images should have alternate text (alt text)

(MD045, no-alt-text)


686-702: Informative examples of using the ConfigMonitor API!

The code segment provides clear examples of how to manually retrieve various types of monitoring data using the ConfigMonitor API. This is helpful for users who need to process and report data to their monitoring systems.


704-729: Comprehensive metrics data table!

The metrics data table provides a good overview of the key metrics exported by the Apollo client. The metrics cover important aspects like configuration usage, thread pool performance, and exceptions. The naming convention for metrics and tags is consistent and descriptive.


1498-1507: Flexible MetricsExporter extension mechanism!

The MetricsExporter extension provides a powerful way for users to integrate Apollo client metrics with their preferred monitoring systems. The SPI and abstract class offer flexibility and simplify the implementation of custom exporters. This extension aligns well with the enhanced observability features in version 2.4.0.


422-422: Skipping static analysis hints.

The flagged punctuation marks are used appropriately in the configuration keys. Specifying a language for the code block and adding alternate text for images would be nice enhancements but are not critical in this context.

Also applies to: 424-424, 428-428, 430-430, 434-434, 604-604, 573-573, 684-684

Tools
LanguageTool

[uncategorized] ~422-~422: Loose punctuation mark.
Context: ...ations. apollo.client.monitor.enabled: Enables the Monitor mechanism, i.e., wh...

(UNLIKELY_OPENING_PUNCTUATION)


At this point, the client's metric data has been integrated with Prometheus.

Full code:https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the bare URL.

The bare URL at the end of the documentation should be wrapped in angle brackets to make it a valid Markdown link.

Apply this diff to fix the bare URL:

-Full code:https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java
+Full code:<https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Full code:https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java
Full code:<https://github.com/apolloconfig/apollo-java/main/master/apollo-plugin/apollo-plugin-client-prometheus/src/main/java/com/ctrip/framework/apollo/monitor/internal/exporter/impl/PrometheusApolloClientMetricsExporter.java>
Tools
Markdownlint

141-141: null
Bare URL used

(MD034, no-bare-urls)

Comment on lines +411 to +412
![](https://cdn.jsdelivr.net/gh/Rawven/image@main/2024-08-24-14-59-01-image.png)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add alternate text to the image.

Images should have alternate text for accessibility.

Add meaningful alternate text within the [] in the image markdown. For example:

![Meaningful alt text describing the image](https://cdn.jsdelivr.net/gh/Rawven/image@main/2024-08-24-14-59-01-image.png) 
Tools
Markdownlint

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

Tools
Markdownlint

411-411: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants