Skip to content

Commit

Permalink
support custom prometheus endpoint path (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 committed Jan 16, 2024
1 parent 63e30e9 commit b9d9733
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 92 deletions.
24 changes: 21 additions & 3 deletions manager/src/main/resources/define/app-prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ params:
# default value
defaultValue: 9091
required: true
# field-param field key
# field-变量字段标识
- field: path
# name-param field display i18n name
# name-参数字段显示名称
name:
zh-CN: 端点路径
en-US: Endpoint Path
# type-param field type(most mapping the html input type)
# type-字段类型,样式(大部分映射input标签type属性)
type: text
# 参数输入框提示信息
# param field input placeholder
placeholder: 'Exporter Url Endpoint Path'
defaultValue: "/metrics"
# required-true or false
# required-是否是必输项 true-必填 false-可选
required: true
- field: timeout
name:
zh-CN: 查询超时时间
Expand Down Expand Up @@ -125,7 +143,7 @@ params:
# when type is key-value, use valueAlias to config value alias name
# 当字段类型为key-value时, 使用valueAlias配置value的展示别名
valueAlias: Param Value
# field-param field key
# field-param field key
# field-变量字段标识
- field: contentType
# name-param field display i18n name
Expand All @@ -145,7 +163,7 @@ params:
# hide param-true or false
# 是否隐藏字段 true or false
hide: true
# field-param field key
# field-param field key
# field-变量字段标识
- field: payload
# name-param field display i18n name
Expand Down Expand Up @@ -246,7 +264,7 @@ metrics:
# http port
port: ^_^port^_^
# http path
path: '/metrics'
path: ^_^path^_^
timeout: ^_^timeout^_^
# http method: GET POST PUT DELETE PATCH
method: GET
Expand Down
2 changes: 2 additions & 0 deletions manager/src/main/resources/sureness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ excludedResource:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui 资源
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
2 changes: 2 additions & 0 deletions script/docker-compose/hertzbeat-mysql-iotdb/conf/sureness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ excludedResource:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui 资源
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ excludedResource:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui 资源
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ excludedResource:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui 资源
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
2 changes: 2 additions & 0 deletions script/helm/hertzbeat/templates/manager/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ data:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
2 changes: 2 additions & 0 deletions script/sureness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ excludedResource:
- /**/*.jpg===get
- /**/*.svg===get
- /**/*.json===get
- /**/*.woff===get
- /**/*.eot===get
# swagger ui 资源
- /swagger-resources/**===get
- /v2/api-docs===get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,15 +378,6 @@
</nz-form-control>
</nz-form-item>

<nz-form-item>
<nz-form-label nzSpan="7" nzFor="detect" [nzTooltipTitle]="'monitors.detect.tip' | i18n">
{{ 'monitors.detect' | i18n }}
</nz-form-label>
<nz-form-control nzSpan="8">
<nz-switch [(ngModel)]="detected" name="detect" id="detect"></nz-switch>
</nz-form-control>
</nz-form-item>

<nz-form-item>
<nz-form-label nzSpan="7" nzFor="tags" [nzTooltipTitle]="'tag.bind.tip' | i18n">
{{ 'tag.bind' | i18n }}
Expand Down Expand Up @@ -423,7 +414,16 @@

<div nz-row>
<div nz-col [nzXs]="{ span: 24 }" [nzLg]="{ span: 8, offset: 7 }" style="text-align: center">
<button nz-button nzType="primary" type="submit" (click)="onDetect(editForm.form)"> {{ 'common.button.detect' | i18n }} </button>
<button
nz-button
nzType="primary"
type="submit"
nz-tooltip
[nzTooltipTitle]="'monitors.detect.tip' | i18n"
(click)="onDetect(editForm.form)"
>
{{ 'common.button.detect' | i18n }}
</button>
<button nz-button nzType="primary" type="submit" (click)="onSubmit(editForm.form)"> {{ 'common.button.ok' | i18n }} </button>
<button nz-button nzType="primary" type="reset" (click)="onCancel()"> {{ 'common.button.cancel' | i18n }} </button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class MonitorEditComponent implements OnInit {
collectors!: Collector[];
collector: string = '';
profileForm: FormGroup = new FormGroup({});
detected: boolean = true;
detected: boolean = false;
passwordVisible: boolean = false;
isSpinning: boolean = false;
spinningTip: string = 'Loading...';
Expand Down Expand Up @@ -74,7 +74,7 @@ export class MonitorEditComponent implements OnInit {
this.paramValueMap.set(item.field, item);
});
}
this.detected = true;
this.detected = false;
if (this.monitor.tags == undefined) {
this.monitor.tags = [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,6 @@
</nz-form-control>
</nz-form-item>

<nz-form-item>
<nz-form-label nzSpan="7" nzFor="detect" [nzTooltipTitle]="'monitors.detect.tip' | i18n">
{{ 'monitors.detect' | i18n }}
</nz-form-label>
<nz-form-control nzSpan="8">
<nz-switch [(ngModel)]="detected" name="detect" id="detect"></nz-switch>
</nz-form-control>
</nz-form-item>

<nz-form-item>
<nz-form-label nzSpan="7" nzFor="tags" [nzTooltipTitle]="'tag.bind.tip' | i18n">
{{ 'tag.bind' | i18n }}
Expand Down Expand Up @@ -432,7 +423,16 @@

<div nz-row>
<div nz-col [nzXs]="{ span: 24 }" [nzLg]="{ span: 8, offset: 7 }" style="text-align: center">
<button nz-button nzType="primary" type="submit" (click)="onDetect(newForm.form)"> {{ 'common.button.detect' | i18n }} </button>
<button
nz-button
nzType="primary"
type="submit"
nz-tooltip
[nzTooltipTitle]="'monitors.detect.tip' | i18n"
(click)="onDetect(newForm.form)"
>
{{ 'common.button.detect' | i18n }}
</button>
<button nz-button nzType="primary" type="submit" (click)="onSubmit(newForm.form)"> {{ 'common.button.ok' | i18n }} </button>
<button nz-button nzType="primary" type="reset" (click)="onCancel()"> {{ 'common.button.cancel' | i18n }} </button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MonitorNewComponent implements OnInit {
monitor!: Monitor;
collectors!: Collector[];
collector: string = '';
detected: boolean = true;
detected: boolean = false;
passwordVisible: boolean = false;
// 是否显示加载中
isSpinning: boolean = false;
Expand Down Expand Up @@ -62,7 +62,7 @@ export class MonitorNewComponent implements OnInit {
this.router.navigateByUrl('/monitors/new?app=website');
}
this.titleSvc.setTitleByI18n(`monitor.app.${this.monitor.app}`);
this.detected = true;
this.detected = false;
this.passwordVisible = false;
this.isSpinning = true;
return this.appDefineSvc.getAppParamsDefine(this.monitor.app);
Expand Down
48 changes: 48 additions & 0 deletions web-app/src/app/routes/setting/define/define.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.program' | i18n">
<ul>
<li
nz-menu-item
*ngFor="let app of appMenus['program']; let i = index"
[nzSelected]="app.selected"
routerLink="/setting/define"
[queryParams]="{ app: app.value }"
>{{ app.label }}</li
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.db' | i18n">
<ul>
<li
Expand All @@ -33,6 +45,18 @@
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.cache' | i18n">
<ul>
<li
nz-menu-item
*ngFor="let app of appMenus['cache']; let i = index"
[nzSelected]="app.selected"
routerLink="/setting/define"
[queryParams]="{ app: app.value }"
>{{ app.label }}</li
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.os' | i18n">
<ul>
<li
Expand All @@ -57,6 +81,30 @@
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.bigdata' | i18n">
<ul>
<li
nz-menu-item
*ngFor="let app of appMenus['bigdata']; let i = index"
[nzSelected]="app.selected"
routerLink="/setting/define"
[queryParams]="{ app: app.value }"
>{{ app.label }}</li
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.webserver' | i18n">
<ul>
<li
nz-menu-item
*ngFor="let app of appMenus['webserver']; let i = index"
[nzSelected]="app.selected"
routerLink="/setting/define"
[queryParams]="{ app: app.value }"
>{{ app.label }}</li
>
</ul>
</li>
<li nz-submenu [nzTitle]="'menu.monitor.cn' | i18n">
<ul>
<li
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<div #collapsed_content class="help_massage_div" id="collapsed">
<div class="level1_breabcrumb" [ngClass]="{ collapsed: isCollapsed }">
<div class="breabcrumb_massage_show">
<div class="level1_breadcrumb" [ngClass]="{ collapsed: isCollapsed }">
<div>
<div class="flex help_massage_nav">
<a [routerLink]="['/']" [queryParams]="{ app: app }">
<i nz-icon nzType="home" style="color: rgba(29, 29, 29, 0.84)"></i>
<span class="help_massage_nav_item">{{ 'menu.dashboard' | i18n }}</span>
<a class="help_massage_nav_item" [routerLink]="['/']" [queryParams]="{ app: app }">
<i class="help_link_span" nz-icon nzType="home"></i>
<span>{{ 'menu.dashboard' | i18n }}</span>
</a>
</div>

<div class="flex help_massage_nav">
<a [routerLink]="">
<i nz-icon nzType="{{ icon_name }}" style="color: rgba(29, 29, 29, 0.84)"></i>
<span class="help_massage_nav_item" *ngIf="app != undefined">{{ 'monitor.app.' + app | i18n }}</span>
<span class="help_massage_nav_item" *ngIf="app == undefined">{{ module_name | i18n }}</span>
<a class="help_massage_nav_item" [routerLink]="">
<i class="help_link_span" nz-icon nzType="{{ icon_name }}"></i>
<span *ngIf="app != undefined">{{ 'monitor.app.' + app | i18n }}</span>
<span *ngIf="app == undefined">{{ module_name | i18n }}</span>
</a>
</div>
</div>
<div class="handover_button">
<button class="handover_button_content" id="handover_button_self" (click)="handleButtonClick()">{{ collapse_expand | i18n }}</button>
<i nz-icon="" nztype="home" class="anticon anticon-home">
<i nz-icon (click)="handleButtonClick()">
<svg viewBox="64 64 896 896" focusable="false" fill="#000000" width="1.12em" height="1.12em" data-icon="alert" aria-hidden="true">
<path
d="M550.4 793.6L490.666667 853.333333l-59.733334-59.733333L256 618.666667l59.733333-59.733334 174.933334 174.933334 174.933333-174.933334 59.733333 59.733334-174.933333 174.933333zM490.666667 332.8l-174.933334 174.933333L256 448l174.933333-174.933333L490.666667 213.333333l59.733333 59.733334 174.933333 174.933333-59.733333 59.733333-174.933333-174.933333z"
Expand All @@ -29,38 +29,22 @@
</i>
</div>
</div>
<div class="collapsed_content">
<div class="collapsed_content content_bg_color">
<div #level2Message class="level2_massage_show">
<div [innerHTML]="help_massage_content"></div>
</div>
<div class="help_link_content">
<div class="flex help_link_nav">
<a [href]="'question.link' | i18n" target="_blank">
<i nz-icon="" nztype="alert" ng-reflect-nz-type="alert" class="anticon anticon-alert">
<svg viewBox="64 64 896 896" focusable="false" fill="#ffffff" width="1em" height="1em" data-icon="alert" aria-hidden="true">
<path
d="M517.119 954.878c244.589 0 442.879-198.289 442.879-442.879 0-244.594-198.289-442.879-442.879-442.879C272.524 69.12 74.24 267.404 74.24 511.999 74.24 756.588 272.524 954.878 517.119 954.878L517.119 954.878zM517.119 891.608c-209.654 0-379.612-169.955-379.612-379.609s169.957-379.612 379.612-379.612 379.609 169.957 379.609 379.612S726.773 891.608 517.119 891.608L517.119 891.608zM523.949 243.992c-54.662 0-97.177 16.705-127.547 50.112-30.367 31.885-44.795 74.402-44.795 127.547l59.98 0c0-37.202 8.35-66.052 25.055-87.31 18.222-25.055 46.312-37.202 84.272-37.202 31.885 0 56.945 8.352 74.405 26.572 16.705 16.702 25.81 40.24 25.81 70.607 0 21.26-7.59 41-22.775 59.98-4.55 6.072-13.665 15.185-25.81 27.33-41 36.445-66.055 65.295-76.685 88.075-9.11 18.98-13.665 40.995-13.665 66.05l0 17.465 60.735 0 0-17.465c0-20.5 4.56-38.725 14.43-55.425 7.59-13.665 18.98-27.335 35.68-41.755 33.405-29.612 53.91-49.352 61.5-58.462 18.98-25.055 28.85-54.665 28.85-88.83 0-45.552-14.425-81.235-42.515-107.05C611.258 256.902 572.544 243.992 523.949 243.992L523.949 243.992zM512.564 706.363c-12.907 0-23.535 3.795-32.647 12.905-9.11 8.345-12.905 18.98-12.905 31.885s3.795 23.54 12.905 32.65c9.112 8.345 19.74 12.905 32.647 12.905 12.91 0 23.535-4.56 32.645-12.905 9.11-8.355 13.665-18.985 13.665-32.65 0-12.905-4.555-23.54-12.905-31.885C536.859 710.158 525.474 706.363 512.564 706.363L512.564 706.363z"
fill="#2c2c2c"
p-id="5529"
></path>
</svg>
</i>
<span class="help_link_nav_item hover_blue">{{ 'menu.link.question' | i18n }}</span>
<a class="help_massage_nav_item" [href]="'question.link' | i18n" target="_blank">
<i class="help_link_span" nz-icon nzType="question-circle"></i>
<span class="hover_blue">{{ 'menu.link.question' | i18n }}</span>
</a>
</div>

<div class="flex help_link_nav">
<a [href]="guild_link" target="_blank">
<i nz-icon="" nztype="alert" ng-reflect-nz-type="alert" class="anticon anticon-alert">
<svg focusable="false" fill="#ffffff" width="1em" height="1em" data-icon="alert" aria-hidden="true">
<path
d="M512 0c282.773333 0 512 229.226667 512 512S794.773333 1024 512 1024 0 794.773333 0 512 229.226667 0 512 0z m0 64C264.576 64 64 264.576 64 512s200.576 448 448 448 448-200.576 448-448S759.424 64 512 64z m202.666667 554.666667a32 32 0 0 1 0 64h-405.333334a32 32 0 0 1 0-64h405.333334z m0-149.333334a32 32 0 0 1 0 64h-405.333334a32 32 0 0 1 0-64h405.333334z m-234.666667-149.333333a32 32 0 0 1 0 64h-170.666667a32 32 0 0 1 0-64h170.666667z"
fill="#2c2c2c"
p-id="8407"
></path>
</svg>
</i>
<span class="help_link_nav_item hover_blue">{{ 'menu.link.guild' | i18n }}</span>
<a class="help_massage_nav_item" [href]="guild_link" target="_blank">
<i class="help_link_span" nz-icon nzType="file-search"></i>
<span class="hover_blue">{{ 'menu.link.guild' | i18n }}</span>
</a>
</div>
</div>
Expand Down
Loading

0 comments on commit b9d9733

Please sign in to comment.