当前位置: 首页> 教育> 高考 > 长沙网络营销公司_公司网站建设费计入哪个科目_无代码建站_免费顶级域名申请网站

长沙网络营销公司_公司网站建设费计入哪个科目_无代码建站_免费顶级域名申请网站

时间:2025/7/14 11:33:31来源:https://blog.csdn.net/u013718730/article/details/145487512 浏览次数:0次
长沙网络营销公司_公司网站建设费计入哪个科目_无代码建站_免费顶级域名申请网站

文章目录

          • Install Prometheus Server
          • Install Grafana Server
          • Spring Prometheus Project
          • Spring Prometheus Properties
          • Spring Prometheus Application
          • Spring Prometheus Configuration
          • Spring Prometheus Controller
          • Configure Grafana Dash Board

Install Prometheus Server
# download package
https://github.com/prometheus/prometheus/releases/download/v3.1.0/prometheus-3.1.0.linux-amd64.tar.gz
# edit prometheus config
prometheus-linux-amd64/prometheus.yml
scrape_configs:- job_name: "prometheus"metrics_path: '/actuator/prometheus'scheme: 'http'static_configs:- targets: ["localhost:10003"]
# run server
sudo ./prometheus
# visit admin page
http://localhost:9090
Install Grafana Server
# download package
https://dl.grafana.com/enterprise/release/grafana-enterprise-11.5.0.linux-amd64.tar.gz
# run server
sudo bin/grafana server
# visit admin page
http://localhost:3000 admin/admin
Spring Prometheus Project
pluginManagement {repositories {gradlePluginPortal()google()mavenCentral()}
}dependencyResolutionManagement {repositoriesMode = RepositoriesMode.PREFER_SETTINGSrepositories {gradlePluginPortal()google()mavenCentral()}
}buildscript {repositories {gradlePluginPortal()google()mavenCentral()}
}plugins {id("org.jetbrains.kotlin.jvm") version "2.0.21" apply falseid("org.jetbrains.kotlin.kapt") version "2.0.21" apply falseid("org.jetbrains.kotlin.plugin.spring") version "2.0.21" apply falseid("org.springframework.boot") version "3.4.1" apply false
}include("prometheus-app")
Spring Prometheus Properties
# service
server.port=10003
spring.application.name=prometheus-app
spring.profiles.active=dev
spring.devtools.add-properties=false
management.endpoints.web.exposure.include=*
# prometheus
management.prometheus.metrics.export.enabled=true
Spring Prometheus Application
package x.spring.helloimport org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication@SpringBootApplication
class PrometheusApplicationfun main(args: Array<String>) {runApplication<PrometheusApplication>(*args)
}
Spring Prometheus Configuration
package x.spring.hello.componentimport io.micrometer.core.instrument.Counter
import io.micrometer.core.instrument.MeterRegistry
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.stereotype.Component@Component
class MetricsProvider {@Bean(name = ["count"])fun getCounterMetrics(registry: MeterRegistry,@Value("\${spring.application.name}") name: String): Counter {return registry.counter("count_api_calling_times", "application", name)}
}
Spring Prometheus Controller
package x.spring.hello.controllerimport io.micrometer.core.instrument.Counter
import jakarta.annotation.Resource
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController@RestController
class MetricsController {@Resource(name = "count")private lateinit var counterMetrics: Counter@GetMapping("/count")fun count(): String {counterMetrics.increment()return "count_api_calling_times_total +1"}
}
Configure Grafana Dash Board
# add data source
Connections -> Data Sources -> Add Data Source -> Prometheus
settings.name=prometheus
connection.url=http://localhost:9090
# create dash board
Dashboards -> Create Dashboard -> Add Visualization -> Add Queries -> Run Queries
datasource=prometheus
metrics=count_api_calling_times_total
关键字:长沙网络营销公司_公司网站建设费计入哪个科目_无代码建站_免费顶级域名申请网站

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: