基于go-ora 的 oracle prometheus exporter

还是基于iamseth/oracledb_exporter 的扩展,很简单,就是替换依赖,以前有一个基于godror/godror
调整的版本,go-ora 是一个纯golang开发的oracle 驱动,以下是一个调整试用

需要修改的代码

  • go.mod
 
module github.com/iamseth/oracledb_exporter
go 1.14
require (
    github.com/BurntSushi/toml v0.3.1
    github.com/prometheus/client_golang v1.0.0
    github.com/prometheus/common v0.6.0
    github.com/sijms/go-ora v0.0.0-20201205173311-40e04fc02df4
    gopkg.in/alecthomas/kingpin.v2 v2.2.6
)
  • main.go
package main
import (
    "bytes"
    "context"
    "crypto/sha256"
    "database/sql"
    "errors"
    "hash"
    "io"
    "net/http"
    "os"
    "strconv"
    "strings"
    "sync"
    "time"
    "github.com/BurntSushi/toml"
    _ "github.com/sijms/go-ora"
    "fmt"
    "github.com/prometheus/client_golang/prometheus"
    "github.com/prometheus/client_golang/prometheus/promhttp"
    "github.com/prometheus/common/log"
    "gopkg.in/alecthomas/kingpin.v2"
    //Required for debugging
    _ "net/http/pprof"
)

说明

目前不太好的是go-ora 性能不是很好,但是从跨平台的角度来说go-ora一个很不错的选择,具体可以参考代码https://github.com/rongfengliang/oracledb_exporter/tree/v1.0.1,如果需要分析性能可以集合pprof,我通过
测试发现性能还是差异很大的,参考火焰图

 

 

参考资料

https://github.com/sijms/go-ora
https://github.com/iamseth/oracledb_exporter
https://github.com/rongfengliang/oracledb_exporter
https://www.cnblogs.com/rongfengliang/p/14109740.html
https://github.com/godror/godror
https://github.com/rongfengliang/go-ora-godror

posted on   荣锋亮  阅读(514)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-12-10 minio select api 试用
2018-12-10 tailor 基础模版的使用
2017-12-10 parceljs 基本使用———又一个前端构建工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示