-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
feat: opentelementry support #14668
feat: opentelementry support #14668
Conversation
lib/utils/otel/metric.ts
Outdated
}, | ||
}); | ||
|
||
export const metric_handler = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const metric_handler = { | |
export const metric = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the rename is necessary, the metric_handler
here is just a wrapper around the aggregated metrics counter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or any other better var name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix your git history. There shouldn't be 2000+ changed files.
2f42b79
to
704d639
Compare
"@opentelemetry/api": "^1.8.0", | ||
"@opentelemetry/exporter-prometheus": "^0.49.1", | ||
"@opentelemetry/exporter-trace-otlp-http": "^0.49.1", | ||
"@opentelemetry/resources": "^1.22.0", | ||
"@opentelemetry/sdk-metrics": "^1.22.0", | ||
"@opentelemetry/sdk-trace-base": "^1.22.0", | ||
"@opentelemetry/semantic-conventions": "^1.22.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"@opentelemetry/api": "^1.8.0", | |
"@opentelemetry/exporter-prometheus": "^0.49.1", | |
"@opentelemetry/exporter-trace-otlp-http": "^0.49.1", | |
"@opentelemetry/resources": "^1.22.0", | |
"@opentelemetry/sdk-metrics": "^1.22.0", | |
"@opentelemetry/sdk-trace-base": "^1.22.0", | |
"@opentelemetry/semantic-conventions": "^1.22.0", | |
"@opentelemetry/api": "1.8.0", | |
"@opentelemetry/exporter-prometheus": "0.49.1", | |
"@opentelemetry/exporter-trace-otlp-http": "0.49.1", | |
"@opentelemetry/resources": "1.22.0", | |
"@opentelemetry/sdk-metrics": "1.22.0", | |
"@opentelemetry/sdk-trace-base": "1.22.0", | |
"@opentelemetry/semantic-conventions": "1.22.0", |
Please pin the dependency version.
@@ -158,6 +158,16 @@ Access code is the md5 generated based on the access key + route, eg: | |||
|
|||
`SENTRY_ROUTE_TIMEOUT`: Report Sentry if route execution takes more than this milliseconds, default to `3000` | |||
|
|||
## Opentelementry Config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Opentelementry Config | |
## OpenTelemetry Config |
@@ -27,6 +28,7 @@ const app = new Hono(); | |||
app.use(compress()); | |||
|
|||
app.use(mLogger); | |||
app.use(trace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If DEBUG_INFO
is set to false
or any strings other than true
, the debug info from RSSHub will be hidden and only available if the same string is provided as query string debug
.
/metrics
does not respect this behaviour currently.
The same also apply to ACCESS_KEY
.
RSSHub/lib/middleware/access-control.ts
Line 15 in 15a51bd
if (requestPath === '/' || requestPath === '/robots.txt' || requestPath === '/metrics') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basicly, metrics should be export with a external local port. In that case rsshub may handle another port with 127.0.0.1:9090
for example.
I'm not sure if an external port should be created, but it might be a better solution than modify if else for access-control.
And also should be with env to control local server enable or not.
* chore: squash commit * fix: tweak some mentioned issues --------- Co-authored-by: incubator4 <[email protected]>
…6087) * chore: squash commit * fix: tweak some mentioned issues --------- Co-authored-by: incubator4 <[email protected]>
Involved Issue / 该 PR 相关 Issue
Close #
Example for the Proposed Route(s) / 路由地址示例
New RSS Route Checklist / 新 RSS 路由检查表
Puppeteer
Note / 说明
Implement opentelementry feature
metrics
andtrace
Metrics
metrics endpoint with
/metrics
labels:
method
http method (example: GET/POST)path
request pathstatus
response return status codeunit
only for bucket (example: second/millisecond)The following metric name supported for now.
request_total
record request with paramsrequest_error_total
record request error with paramsrequest_duration_seconds_bucket
record request second with paramsrequest_duration_milliseconds_bucket
record request millisecond with paramstrace
trace with opentelementry OTLP exporter, which could be collected by jaeger (for example)
endpoint follow OpenTelemetry Specification on Protocol Exporter.