Commit Graph

860 Commits (105ab590fff8d9d8187bf2401aba9a6125ca5d5e)

Author SHA1 Message Date
Kevin Wan 963b52fb1b
chore: add more tests (#2794) 2 years ago
Kevin Wan 02265d0bfe
chore: add more tests (#2792)
* chore: add more tests

* chore: add more tests

* chore: add more tests

* chore: add more tests
2 years ago
Ofey Chan 82c642d3f4
feat: expose NewTimingWheelWithClock (#2787) 2 years ago
Kevin Wan b2571883ca
chore: refactor (#2785)
* chore: refactor

* chore: refactor
2 years ago
Alonexy 00ff50c2cc
add zset withsocre float (#2689)
* add zset withsocre float

* update

* add IncrbyFloat,HincrbyFloat

Co-authored-by: Kevin Wan <wanjunfeng@gmail.com>
2 years ago
Kevin Wan 4d7fa08b0b
feat: support **struct in mapping (#2784)
* feat: support **struct in mapping

* chore: fix test failure
2 years ago
Kevin Wan 367afb544c
feat: support ptr of ptr of ... in mapping (#2779)
* feat: support ptr of ptr of ... in mapping

* feat: support ptr of ptr of time.Duration in mapping

* feat: support ptr of ptr of json.Number in mapping

* chore: improve setting in mapping

* feat: support ptr of ptr encoding.TextUnmarshaler in mapping

* chore: add more tests

* fix: string ptr

* chore: update tests
2 years ago
Kevin Wan bae061a67e
chore: add tests (#2778) 2 years ago
Kevin Wan 0b176e17ac
fix: #2576 (#2776) 2 years ago
Kevin Wan 74e0676617
feat: add config to truncate long log content (#2767) 2 years ago
MarkJoyMa 0defb7522f
feat: replace NewBetchInserter function name (#2769) 2 years ago
Kevin Wan e52dace416
chore: refactor (#2764) 2 years ago
chen quan dc260f196a
refactor: simplify the code (#2763)
* refactor: simplify the code

* fix: fix data race

* refactor: simplify the code

* refactor: simplify the code
2 years ago
MarkJoyMa a5fcf24c04
feat: add batch inserter (#2755) 2 years ago
MarkJoyMa e71c505e94
feat: add mongo options (#2753)
* feat: add mongo options

* feat: add mongo options

* feat: add mongo options

* feat: add mongo options

* feat: add mongo options

* feat: add mongo options
2 years ago
#Suyghur 69d355eb4b
feat(redis): add zscan command implementation (#2729) (#2751) 2 years ago
cong 42413dc294
feat(trace): support otlp http exporter (#2746)
* feat(trace): support otlp http exporter

* chore: use otlptracehttp v1.10.0 not upgrade grpc version prevent other modules break

* refactor(trace): rename exporter kind grpc to otlpgrpc.

BREAKING CHANGE: trace Config.Batcher should use otlpgrpc instead of grpc now.
2 years ago
Kevin Wan ec7ac43948
chore: reorg imports (#2745)
* chore: reorg imports

* chore: format code
2 years ago
cong deefc1a8eb
fix(trace): grpc exporter should use nonblock option (#2744)
* fix(trace): grpc exporter should use nonblock option

* chore: sort imports
2 years ago
Kevin Wan 036328f1ea
chore: update tests (#2741)
* chore: update tests

* chore: codecov on comments

* chore: codecov on comments
2 years ago
wojiukankan 85057a623d
🐛 debug grpc export (#2379) (#2719)
* 🐛 debug grpc export (#2379) 

#2379 Fixed the issue that the GRPC exporter did not establish an RPC link
原文使用的 otlptracegrpc.NewUnstarted创建的是一个未建立rpc连接的导出器,无法正常使用;改为otlptracegrpc.New才妥

* Update agent_test.go

修复单元测试失败
2 years ago
Xargin 1c544a26be
use stat instead of disableStat (#2740) 2 years ago
chainlife 20a61ce43e
logx conf add DisableStat (#2434)
Co-authored-by: sunsoft <sunsoft@qq.com>
2 years ago
Kevin Wan cf6c349118
fix: #2735 (#2736)
* fix: #2735

* chore: make error consistent
2 years ago
Kevin Wan c7a0ec428c
fix: key like TLSConfig not working (#2730)
* fix: key like TLSConfig not working

* fix: remove unnecessary code

* chore: rename variable
2 years ago
Kevin Wan c3756a8f1c
fix: etcd publisher reconnecting problem (#2710)
* fix: etcd publisher reconnecting problem

* chore: fix wrong call
2 years ago
Archer f4fd735aee
Use read-write lock instead of mutex (#2727) 2 years ago
Archer 683d793719
RawFieldNames should ignore the field whose name is start with a dash (#2725) 2 years ago
Kevin Wan affbcb5698
fix: camel cased key of map item in config (#2715)
* fix: camel cased key of map item in config

* fix: mapping anonymous problem

* fix: mapping anonymous problem

* chore: refactor

* chore: add more tests

* chore: refactor
2 years ago
Kevin Wan f76b976262
fix: #2684 (#2693) 2 years ago
Kevin Wan fdc57d07d7
fix: #2672 (#2681)
* fix: #2672

* chore: fix more cases

* chore: update deps

* chore: update deps

* chore: refactor

* chore: refactor

* chore: refactor
2 years ago
re-dylan ef22042f4d
feat: add dev server and health (#2665)
* feat: add dev server and health

* fix: fix ci

* fix: fix comment.

* feat: add enabled

* remove no need test

* feat: mv devServer to internal

* feat: default enable pprof

Co-authored-by: dylan.wang <dylan.wang@yijinin.com>
2 years ago
Tim Xiao 944193ce25
fix:Remove duplicate code (#2686) 2 years ago
Kevin Wan dcfc9b79f1
feat: accept camelcase for config keys (#2651)
* feat: accept camelcase for config keys

* chore: refactor

* chore: refactor

* chore: add more tests

* chore: refactor

* fix: map elements of array
2 years ago
Kevin Wan 9941055eaa
feat: add trace.SpanIDFromContext and trace.TraceIDFromContext (#2654) 2 years ago
edieruby b1c3c21c81
fix: log currentSize should not be 0 when file exists and size is not 0 (#2639) 2 years ago
Kevin Wan 95a5f64493
feat: add stringx.ToCamelCase (#2622) 2 years ago
Kevin Wan 06fafd2153
feat: validate value in options for mapping (#2616) 2 years ago
Kevin Wan b562e940e7
feat: support bool for env tag (#2593) 2 years ago
Kevin Wan 69068cdaf0
feat: support env tag in config (#2577)
* feat: support env tag in config

* chore: add more tests

* chore: add more tests, add stringx.Join

* fix: test fail

* chore: remove print code

* chore: rename variable
2 years ago
Kevin Wan e3e08a7396
fix: inherit issue when parent after inherits (#2586)
* fix: inherit issue when parent after inherits

* chore: add more tests
2 years ago
Kevin Wan 1677a4dceb
feat: conf inherit (#2568)
* feat: add ValuerWithParent

* feat: make etcd config inherit from parents

* chore: add more tests

* chore: add more tests

* chore: add more comments

* chore: refactor

* chore: add more comments

* fix: fix duplicated code and refactor

* fix: remove unnecessary code

* fix: fix test case for removing print

* feat: support partial inherit
2 years ago
王哈哈 dac3600b53
Modify comment syntax error (#2572) 2 years ago
Kevin Wan 7eb6aae949
fix: potential slice append issue (#2560) 2 years ago
re-dylan 4d2a146733
typo(mapping): fix typo for key (#2548) 2 years ago
Kevin Wan 46e236fef7
chore: add more tests (#2547) 2 years ago
Kevin Wan 06e4914e41
feat: add logger.WithFields (#2546) 2 years ago
Kevin Wan 9cadab2684
chore: refactor (#2545)
* chore: refactor

* chore: refactor
2 years ago
swliao425 b21162d638
fix: redis's pipeline logs are not printed completely (#2538)
* fix: redis's pipeline logs are not printed completely

* add unit test

Signed-off-by: liaoshiwei <liaoshiwei@uniontech.com>

Signed-off-by: liaoshiwei <liaoshiwei@uniontech.com>
2 years ago
Kevin Wan f9beab1095
feat: support uuid.UUID in mapping (#2537) 2 years ago
Kevin Wan d4c9fd2aff
chore: add golangci-lint config file (#2519)
* chore: add golangci-lint config file

* chore: member alignment
2 years ago
foliet f7a4e3a19e
chore: fix naming problem (#2500)
When I was looking for how to mock mongo client, I found some naming problems and wanted to fix them.
2 years ago
swliao425 a515a3c735
chore: sqlx's metric name is different from redis (#2505) 2 years ago
Kevin Wan 10f94ffcc2
chore: remove unnecessary code (#2499) 2 years ago
sado f068062b13
token limit support context (#2335)
* token limit support context

* add token limit with ctx

add token limit with ctx

Co-authored-by: sado <liaoyonglin@bilibili.com>
2 years ago
cui fliter fc59aec2e7
fix a few function names on comments (#2496)
Signed-off-by: cui fliter <imcusg@gmail.com>

Signed-off-by: cui fliter <imcusg@gmail.com>
2 years ago
Kevin Wan 773b59106b
chore: remove init if possible (#2485) 2 years ago
Kevin Wan 38a73d7fbe
fix: etcd reconnecting problem (#2478) 2 years ago
Kevin Wan 1bc138bd34
chore: refactor to reduce duplicated code (#2477) 2 years ago
Kevin Wan 4b9066eda6
chore: better shedding algorithm, make sure recover from shedding (#2476)
* backup

* chore: better shedding algorithm, make sure recover from shedding
2 years ago
#Suyghur 0c66e041b5
feat(redis):add timeout method to extend blpop (#2472) 2 years ago
Halo aa2be0163a
fix: add more tests (#2473)
* chore: add string to map in httpx parse method

* feat: add httpx parse stringToMap method test

* fix: add more test
2 years ago
Kevin Wan ada2941e87
chore: sort methods (#2470) 2 years ago
Kevin Wan 59c0013cd1
feat: add logc package, support AddGlobalFields for both logc and logx. (#2463)
* feat: add logc package

* feat: add logc, add AddGlobalFields for both logc and logx

* chore: add benchmarks

* chore: add more tests

* chore: simplify globalFields in logx

* chore: remove outdated comments
2 years ago
Halo 05737f6519
feat: add string to map in httpx parse method (#2459)
* chore: add string to map in httpx parse method

* feat: add httpx parse stringToMap method test
2 years ago
Kevin Wan 1a6d7b3ef6
chore: gofumpt (#2439) 2 years ago
chen quan 2e1e4f3574
feat: add color to debug (#2433) 2 years ago
Kevin Wan 22d0a2120a
chore: replace fmt.Fprint (#2425) 2 years ago
chen quan 68e15360c2
fix: fix log output (#2424) 2 years ago
dawn_zhou d640544a40
refactor: redis error for prometheus metric label (#2412)
Co-authored-by: dawn.zhou <dawn.zhou@yijinin.com>
2 years ago
MarkJoyMa e6aa6fc361
feat: add log debug level (#2411) 2 years ago
Kevin Wan 0b1884b6bd
feat: support caller skip in logx (#2401)
* feat: support caller skip in logx

* chore: remove debug prints

* chore: remove debug prints

* chore(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc (#2402)

Bumps [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://github.com/open-telemetry/opentelemetry-go) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: simplify test code

* chore: remove new WithFields in logx, and deprecated old WithFields

* chore: simplify WithDuration

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Kevin Wan 1f6688e5c1
chore: refactor the imports (#2406) 2 years ago
dawn_zhou ae7f1aabdd
feat: mysql and redis metric support (#2355)
* feat: mysql and redis metric support

* feat: mysql and redis metric support

* feat: mysql and redis metric support

Co-authored-by: dawn.zhou <dawn.zhou@yijinin.com>
2 years ago
Kevin Wan e9650d547b
chore: refactor (#2388) 2 years ago
genewoo 05c2f313c7
feat: add grpc export (#2379)
Co-authored-by: Gene Wu <gene.wu@cabital.com>
2 years ago
Kevin Wan 66c2a28e66
fix #2364 (#2377) 2 years ago
Kevin Wan d935c83a54
feat: support baggage propagation in httpc (#2375)
* feat: support baggage propagation in httpc

* chore: use go 1.16

* chore: use go 1.16

* chore: use go ^1.16

* chore: remove deprecated
2 years ago
Kevin Wan da80662b0f
chore: refactor (#2365) 2 years ago
maizige cfda972d50
fix:trace graceful stop,pre loss trace (#2358) 2 years ago
maizige 422f401153
fix:etcd get&watch not atomic (#2321) 2 years ago
Kevin Wan dfeef5e497
fix: thread-safe in getWriter of logx (#2319) 2 years ago
Archer 8c72136631
make logx#getWriter concurrency-safe (#2233)
* make logx#getWriter concurrency-safe

* make logx#getWriter concurrency-safe
2 years ago
Kevin Wan a1466e1707
fix: range validation on mapping (#2317) 2 years ago
lowang-bh 1b477bbef9
improve: number range compare left and righ value (#2315)
Co-authored-by: wanglonghui7 <wanglonghui7@jd.com>
2 years ago
Kevin Wan 813625d995
refactor: sequential range over safemap (#2316) 2 years ago
李平平 15a2802f12
safemap add Range method (#2314) 2 years ago
Kevin Wan d978563523
fix: more accurate panic message on mapreduce (#2311) 2 years ago
Kevin Wan 2d60f0c65a
fix: logx disable not working in some cases (#2306)
* fix: logx disable not working in some cases

* fix: test fail
2 years ago
maizige 5d4ae201d0
Fix/del server interceptor duplicate copy md 20220827 (#2309)
* fix:grpc server interceptor duplicate copy MD

* modify wrong comments
2 years ago
sado bebf6322ff
fix resource manager dead lock (#2302)
Co-authored-by: sado <liaoyonglin@bilibili.com>
2 years ago
Kevin Wan 36678f9023
chore: refactor stat (#2299) 2 years ago
Josh Quintana 90cdd61efc
Initialize CPU stat code only if used (#2020)
Co-authored-by: Josh Quintana <josh@highwaybenefits.com>
2 years ago
chen quan 0316b6e10e
feat(redis): add ZaddFloat & ZaddFloatCtx (#2291) 2 years ago
chen quan 847a396f1c
fix(logx): display garbled characters in windows(DOS, Powershell) (#2232)
* fix(logx): display garbled characters in windows(DOS, Powershell)

* Update writer.go
2 years ago
Kevin Wan 8ed22eafdd
fix #2240 (#2263) 2 years ago
Kevin Wan 05dd6bd743
chore: refactor logx (#2262) 2 years ago
Kevin Wan 1568c3be0e
fix: time repr wrapper (#2255) 2 years ago
chen quan 4fad067a0e
fix(logx): need to wait for the first caller to complete the execution. (#2213) 2 years ago
safeoy 3f3c811e08
fix: fix comment typo (#2220)
Use an instead of 'a' if the following word starts with a vowel sound, e.g. 'an in-memory cache'.
2 years ago
Kevin Wan 91b8effb24
chore: refactor redislock (#2210)
* chore: refactor redislock

* chore: add more tests
2 years ago
cong 4879d4dfcd
feat(redislock): support set context (#2208)
* feat(redislock): support set context

* chore: fix test
2 years ago
Kevin Wan 5cd9229986
fix: only setup logx once (#2188)
* fix: only setup logx once

* fix: test failure

* chore: not reset logging level in reset

* chore: refactoring
2 years ago
施国鹏 3d38d36605
fix: logx test foo (#2144)
constant testlog "Stay hungry, stay foolish." contains foo(foolish), changed to foo1
2 years ago
Kevin Wan 9b334b5428
chore: let logx.SetWriter can be called anytime (#2186) 2 years ago
Kevin Wan 92145b56dc
chore: refactoring (#2182) 2 years ago
Kevin Wan 34eb3fc12e
chore: refactoring logx (#2181) 2 years ago
SgtDaJim 101304be53
feat: logx support logs rotation based on size limitation. (#1652) (#2167)
* feat: logx support logs rotation based on size limitation. (#1652)

implementation of #1652

Totally compatible with the old logx.LogConf. No effect if users do not change their options.

* feat: logx support logs rotation based on size limitation. (#1652)

implementation of #1652

Totally compatible with the old logx.LogConf. No effect if users do not change their options.

* feat: logx support logs rotation based on size limitation. (#1652)

implementation of #1652

Totally compatible with the old logx.LogConf. No effect if users do not change their options.

* feat: logx support logs rotation based on size limitation. (#1652)

implementation of #1652

Totally compatible with the old logx.LogConf. No effect if users do not change their options.
2 years ago
Kevin Wan 23f34234d0
chore: add more tests (#2129) 2 years ago
Kevin Wan 24787a946b
feat: support logx.WithFields (#2128) 2 years ago
Kevin Wan e672b3f8e1
feat: add Wrap and Wrapf in errorx (#2126) 2 years ago
Kevin Wan 97a171441d
chore: remove blank lines (#2117)
* chore: remove blank lines

* chore: refactor
2 years ago
Kevin Wan 1410f7dc20
fix #2109 (#2116) 2 years ago
warrior 8afe68f3f1
refactor:remove duplicate codes (#2101)
Co-authored-by: 沈四胜 <sisheng.shen@71360.com>
2 years ago
Minghong Fang 48f7e01158
feat: add method to jsonx (#2049) 2 years ago
Kevin Wan 18035bd4d4
chore: refactor (#2085) 2 years ago
家福 f3b8fef34f
fix: type matching supports string to int (#2038)
* fix: type matching supports string to int

* feat: type matching supports string to int

Co-authored-by: 程家福 <chengjiafu@uniontech.com>
2 years ago
givemeafish 6a4885ba64
fix concurrent map writes (#2079)
Co-authored-by: wero <wero@werodeMacBook-Pro.local>
2 years ago
wxc d200ba4a7b
feat: CompareAndSwapInt32 may be better than AddInt32 (#2077) 2 years ago
Kevin Wan 3da5c5f530
Update readme.md 2 years ago
Kevin Wan 1694a92db0
Update readme.md 2 years ago
Kevin Wan db9a1f3e27
chore: rename methods (#1998) 2 years ago
马守越 392a390a3f
periodlimit new function TakeWithContext (#1983)
Co-authored-by: mashouyue's m1max <mashouyue@toowow.cn>
2 years ago
Gaffey 2a900e1795
typo: add type keyword (#1992) 2 years ago
Kevin Wan 1d95e95cf8
chore: make methods consistent in signatures (#1971)
* chore: make methods consistent in signatures

* test: fix fails
3 years ago
taobig 3fa8c5940d
fix: The validation of tag "options" is not working with int/uint type (#1969) 3 years ago
Kevin Wan c44edd7cac
test: fix fails (#1970) 3 years ago
Kevin Wan af05219b70
test: make tests stable (#1968)
* test: make tests stable

* test: fix fails
3 years ago
Kevin Wan 6c94e4652e
chore: better mongo logs (#1965)
* chore: better mongo logs

* chore: add comments
3 years ago
kevin edfaa6d906
🐞 fix: fixed typo (#1916)
Co-authored-by: kevinzhang <kevinzhang@moonton.com>
3 years ago
Kevin Wan 7868bdf660
Chore/goctl version (#1962)
* chore: update version to v1.3.7

* docs: update migrate versions

* chore: remove debug prints

* chore: remove debug prints
3 years ago
Kevin Wan bb33a20bc8
Update readme-cn.md 3 years ago
Kevin Wan 5536473a08
Update readme.md 3 years ago
Kevin Wan 30958a91f7
docs: add docs for logx (#1960) 3 years ago
Kevin Wan b94b68a427
chore: refactoring mapping string to slice (#1959) 3 years ago
家福 07145b210e
fix: panic on convert to string on fillSliceFromString() (#1951)
* Update unmarshaler.go

 fix: 修复fillSliceFromString()方法中mapValue 强转string后的panic 错误

* test: 增加单元测试

增加单元测试

* Update unmarshaler_test.go
3 years ago
Kevin Wan 321a20add6
chore: update roadmap (#1948) 3 years ago
vic 6d3ed98744
优化代码 (#1939) 3 years ago
NoTryNoSuccess fb519fa547
core/mr:a little optimization for collector initialization in ForEach function (#1937)
Co-authored-by: notrynosuccess <daihongshan@gmail.com>
3 years ago
chen quan fd12659729
chore: add release action to auto build binaries (#1884)
* chore: add release action to auto build binaries

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* fix: test bugs

Signed-off-by: chenquan <chenquan.dev@gmail.com>
3 years ago
Kevin Wan 72ebbb9774
feat: update docker alpine package mirror (#1924)
* feat: update docker alpine package mirror

* chore: format code
3 years ago
Kevin Wan 6b1e15cab1
chore: update k8s.io/client-go for security reason, go is upgrade to 1.16 (#1912)
* chore: fix jwt dependency security issue

* chore: update clickhouse driver

* chore: fix a security issue

* chore: update dependencies
3 years ago
Kevin Wan e80a64fa67
feat: support WithStreamClientInterceptor for zrpc clients (#1907)
* feat: support WithStreamClientInterceptor for zrpc clients

* fix: data race
3 years ago
Kevin Wan 1e717f9f5c
feat: add toml config (#1899) 3 years ago
chen quan e567a0c718
refactor: refactor trace in redis & sql & mongo (#1865)
* refactor: refactor tracing in redis & sql & mongo

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* fix: fix some tests

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: add missing content

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: adjust `log` and `return`

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: reformat code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: reformat code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: reformat code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: simpler span name

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: fix a bug

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* refactor: fix a bug

Signed-off-by: chenquan <chenquan.dev@gmail.com>
3 years ago
Kevin Wan 6d2b9fd904
chore: improve codecov (#1878) 3 years ago
Kevin Wan 69c2bad410
feat: logx with color (#1872)
* feat: logx with color

* chore: update logs

* fix test error

* chore: change colors of http codes

* chore: add comments

* chore: use faith/color instead of ascii code color

* chore: update colors

* chore: update colors

* chore: fix duplicated slowcall text

* chore: remove slowcall colors
3 years ago
Kevin Wan d0a59b13a6
chore: fix deprecated usages (#1871)
* add conf documents

* chore: use {} instead of () for environment variables

* chore: fix deprecated usages

* chore: fix unstable tests

* chore: show stack on github actions
3 years ago
Kevin Wan 469e62067c
add conf documents (#1869)
* add conf documents

* chore: use {} instead of () for environment variables
3 years ago
Kevin Wan a36d58aac9
fix time, duration, slice types on logx.Field (#1868)
* chore: refine tests

* fix #1866
3 years ago
Kevin Wan aa5118c2aa
chore: refine tests (#1864) 3 years ago
Kevin Wan 974ba5c9aa
test: add codecov (#1863) 3 years ago
Kevin Wan ec1de4f48d
test: add codecov (#1861)
* test: add codecov

* test: add codecov
3 years ago
Kevin Wan bab72b7630
chore: use time.Now() instead of timex.Time() because go optimized it (#1860) 3 years ago
Kevin Wan ac321fc146
feat: add fields with logx methods, support using third party logging libs. (#1847)
* backup

* simplify

* chore: remove unused pool

* chore: fix lint errors

* chore: use strings.Builder instead of bytes.Buffer

* test: add more tests

* chore: fix reviewdog

* test: fix data race

* feat: make logger customizable

* chore: fix reviewdog

* test: fix fails

* chore: fix set writer twice

* chore: use context instead of golang.org context

* chore: specify uint32 for level types
3 years ago
Kevin Wan f21970c117
test: add more tests (#1856) 3 years ago
Kevin Wan 3bbc90ec24
refactor: move json related header vars to internal (#1840)
* refactor: move json related header vars to internal

* refactor: use header.ContentType
3 years ago
Kevin Wan cef83efd4e
fix #1838 (#1839) 3 years ago
Kevin Wan f7a60cdc24
fix: remove deprecated dependencies (#1837)
* fix: remove deprecated dependencies

* backup

* fix test error
3 years ago
Kevin Wan 1a38eddffe
refactor: simplify the code (#1835) 3 years ago
Kevin Wan 5bcee4cf7c
fix #1806 (#1833)
* fix #1806

* chore: refine error text
3 years ago
chen quan 22b157bb6c
chore: optimize code (#1818)
Signed-off-by: chenquan <chenquan.dev@gmail.com>
3 years ago
Kevin Wan bc3c9484d1
chore: refactor (#1814) 3 years ago
chen quan 162e9cef86
feat: add trace in redis & mon & sql (#1799)
* feat: add sub spanId with redis

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* add tests

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* fix a bug

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* feat: add sub spanId in sql

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* feat: add sub spanId in mon

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* chore: optimize code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* feat: add breaker in warpSession

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* chore: optimize code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* test: add tests

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* chore: reformat code

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* fix: fix typo

Signed-off-by: chenquan <chenquan.dev@gmail.com>

* fix a bug

Signed-off-by: chenquan <chenquan.dev@gmail.com>
3 years ago
Kevin Wan 2cdff97934
feat: use mongodb official driver instead of mgo (#1782)
* wip: backup

* wip: backup

* wip: backup

* backup

* backup

* backup

* add more tests

* fix wrong dependency

* fix lint errors

* remove test due to data race

* add tests

* fix test error

* add mon.Model

* add mon.Model unmarshal

* add monc

* add more tests for monc

* add more tests for monc

* add docs for mon and monc packages

* fix doc errors

* chhore: add comment

* chore: fix test bug

* chore: refine tests

* chore: remove primitive.NewObjectID in test code

* chore: rename test files for typo
3 years ago
杨圆建 d58cf7a12a
fix: Hdel check result & Pfadd check result (#1801) 3 years ago
Kevin Wan 5d4e7c84ee
revert postgres package refactor (#1796)
* Revert "refactor: move postgres to pg package (#1781)"

This reverts commit ba8ac974aa.

* remove pg, use postgres
3 years ago
Kevin Wan cb4fcf2c6c
fix marshal ptr in httpc (#1789)
* fix marshal ptr in httpc

* add more tests

* add more tests

* add more tests

* fix issue on options and optional both provided
3 years ago
Kevin Wan ecc3653d44
fix #1729 (#1783) 3 years ago
Kevin Wan ba8ac974aa
refactor: move postgres to pg package (#1781) 3 years ago
Kevin Wan 50de01fb49
feat: add httpc.Do & httpc.Service.Do (#1775)
* backup

* backup

* backup

* feat: add httpc.Do & httpc.Service.Do

* fix: not using strings.Cut, it's from Go 1.18

* chore: remove redudant code

* feat: httpc.Do finished

* chore: fix reviewdog

* chore: break loop if found

* add more tests
3 years ago
Kevin Wan 8bc34defc4
chore: avoid deadlock after stopping TimingWheel (#1768) 3 years ago
Kevin Wan 4e48286838
chore: add doc (#1764) 3 years ago
benqi 475d17e17d
feat: support ctx in kv methods (#1759) 3 years ago
Kevin Wan 8472415472
fix #1754 (#1757) 3 years ago
Kevin Wan e0fa8d820d
feat: return original value of setbit in redis (#1746) 3 years ago
Kevin Wan 2b9fc26c38
refactor: guard timeout on API files (#1726) 3 years ago
Kevin Wan e9620c8c05
chore: refactor code (#1708) 3 years ago
aimuz 70e51bb352
fix: empty slice are set to nil (#1702)
support for empty slce, Same behavior as json.Unmarshal
3 years ago
Kevin Wan 278cd123c8
feat: remove reentrance in redislock, timeout bug (#1704) 3 years ago
Kevin Wan ec271db7a0
chore: refactor code (#1699) 3 years ago
benqi bbac994c8a
feat: add getset command in redis and kv (#1693) 3 years ago
Kevin Wan fe262766b4
chore: fix lint issue (#1694) 3 years ago
Kevin Wan f060a226bc
refactor: simplify the code (#1670) 3 years ago
Mervin.Wong 93d524b797
fix: the new RawFieldNames considers the tag with options. (#1663)
Co-authored-by: JinfaWang <wangjinfa@iie.ac.cn>
3 years ago
Kevin Wan 3279a7ef0f
feat: add rest/httpc to make http requests governacible (#1638)
* feat: change x-trace-id to traceparent to follow opentelemetry

* feat: add rest/httpc to make http requests governacible

* chore: remove blank lines
3 years ago
Kevin Wan c05d74b44c
feat: support cpu stat on cgroups v2 (#1636)
* feat: cpu stat

* feat: add cpu stat for cgroup2

* feat: add cpu stat for cgroup2, tidy mod

* feat: support cpu stat in cgroup v2
3 years ago
mlr3000 32c88b6352
feat: support oracle :N dynamic parameters (#1552)
* chore:use struct pointer

* feat: support oracle :N dynamic parameters

* Update utils.go

* Update utils.go

* Update utils.go

pg argIndex will not always go up

* Update utils_test.go

* Keep the original

* Update utils_test.go
3 years ago
Kevin Wan b939ce75ba
chore: refactor code (#1613) 3 years ago
Kevin Wan 3b7ca86e4f
chore: add unit tests (#1615)
* test: add more tests

* test: add more tests
3 years ago
Javen 60760b52ab
model中db标签增加'-'符号以支持数据库查询时忽略对应字段. (#1612) 3 years ago
qi 96c128c58a
fix: HitQuota should be returned instead of Allowed when limit is equal to 1. (#1581) 3 years ago
Kevin Wan 900bc96420
test: add more tests (#1604) 3 years ago
Kevin Wan 259a5a13e7
chore: fix data race (#1593) 3 years ago
Fyn cf7c7cb392
build: update goctl dependency ddl-parser to v1.0.3 (#1586)
* build: update goctl dependency ddl-parser to v1.0.3

* fix: race condition when testing logx

Resolves: #1587
3 years ago
ccx 86d01e2e99
test: add testcase for FIFO Queue in collection module (#1589)
cover the case of non-zero value for q.Header when q.Elements expands
3 years ago
Kevin Wan e0454138e0
update goctl to go 1.16 for io/fs usage (#1571)
* update goctl to go 1.16 for io/fs usage

* feat: support pg serial type for auto_increment (#1563)

* add correct example for pg's url

* 🐞 fix: merge

* 🐞 fix: pg default port

*  feat: support serial type

Co-authored-by: kurimi1 <d0n41df@gmail.com>

* chore: format code

Co-authored-by: toutou_o <33993460+kurimi1@users.noreply.github.com>
Co-authored-by: kurimi1 <d0n41df@gmail.com>
3 years ago
Kevin Wan 607bae27fa
feat: support ctx in sqlx/sqlc, listed in ROADMAP (#1535)
* feat: support ctx in sqlx/sqlc

* chore: update roadmap

* fix: context.Canceled should be acceptable

* use %w to wrap errors

* chore: remove unused vars
3 years ago
Kevin Wan 9e113909b3
ignore context.Canceled for redis breaker (#1545) 3 years ago
Kevin Wan b215fa3ee6
fix #1541 (#1542) 3 years ago
Kevin Wan 2732d3cdae
chore: refactor cache (#1532) 3 years ago
chenquan e8c307e4dc
feat: support ctx in `Cache` (#1518)
* feature: support ctx in `Cache`

Signed-off-by: chenquan <chenquan.dev@foxmail.com>

* fix: `errors.Is` instead of `=`

Signed-off-by: chenquan <chenquan.dev@foxmail.com>
3 years ago
Kevin Wan cf4321b2d0
fix #1525 (#1527) 3 years ago
chenquan 1993faf2f8
fix: fix a typo (#1522)
Signed-off-by: chenquan <chenquan.dev@foxmail.com>
3 years ago
Kevin Wan a40254156f
refactor: refactor yaml unmarshaler (#1517) 3 years ago
chenquan 05cc62f5ff
chore: optimize yaml unmarshaler (#1513) 3 years ago
chenquan 9c2c90e533
chore: make error clearer (#1514) 3 years ago
Kevin Wan 822ee2e1c5
feat: update go-redis to v8, support ctx in redis methods (#1507)
* feat: update go-redis to v8, support ctx in redis methods

* fix compile errors

* chore: remove unused const

* chore: add tracing log on redis
3 years ago
Kevin Wan bb75cc796e
test: change fuzz tests (#1504) 3 years ago
Kevin Wan 0fdd8f54eb
ci: add test for win (#1503)
* ci: add test for win

* ci: update check names

* ci: use go build instead of go test to verify win test

* fix: windows test failure

* chore: disable logs in tests
3 years ago
Kevin Wan ec299085f5
docs: update tal-tech to zeromico in docs (#1498) 3 years ago
Kevin Wan 5f9d101bc6
feat: add runtime stats monitor (#1496) 3 years ago
Kevin Wan 6c2abe7474
fix: goroutine stuck on edge case (#1495)
* fix: goroutine stuck on edge case

* refactor: simplify mapreduce implementation
3 years ago
Kevin Wan 14a902c1a7
feat: handling panic in mapreduce, panic in calling goroutine, not inside goroutines (#1490)
* feat: handle panic

* chore: update fuzz test

* chore: optimize square sum algorithm
3 years ago
Kevin Wan b3e7d2901f
Feature/trie ac automation (#1479)
* fix: trie ac automation issues

* fix: trie ac automation issues

* fix: trie ac automation issues

* fix: trie ac automation issues
3 years ago
Kevin Wan f1102fb262
chore: optimize string search with Aho–Corasick algorithm (#1476)
* chore: optimize string search with Aho–Corasick algorithm

* chore: optimize keywords replacer

* fix: replacer bugs

* chore: reorder members
3 years ago
Kevin Wan fdc7f64d6f
chore: update unauthorized callback calling order (#1469)
* chore: update unauthorized callback calling order

* chore: add comments
3 years ago
Kevin Wan bf2feee5b7
feat: implement console plain output for debug logs (#1456)
* feat: implement console plain output for debug logs

* chore: rename console encoding to plain

* chore: refactor names
3 years ago
Letian Jiang ce05c429fc
chore: check interface satisfaction w/o allocating new variable (#1454) 3 years ago
shenbaise9527 13db7a1931
feat: 支持redis的LTrim方法 (#1443) 3 years ago
Kevin Wan b9b80c068b
ci: add translator action (#1441) 3 years ago
Kevin Wan 2203809e5e
chore: fix typo (#1437) 3 years ago
Kevin Wan 8d6d37f71e
remove unnecessary drain, fix data race (#1435)
* remove unnecessary drain, fix data race

* chore: fix parameter order

* refactor: rename MapVoid to ForEach in mr
3 years ago
Kevin Wan ea4f2af67f
fix: mr goroutine leak on context deadline (#1433)
* fix: mr goroutine leak on context deadline

* test: update fx test check
3 years ago
Kevin Wan 53af194ef9
chore: refactor periodlimit (#1428)
* chore: refactor periodlimit

* chore: add comments
3 years ago
Kevin Wan eb4b86137a
fix: golint issue (#1423) 3 years ago
Kevin Wan a91c3907a8
feat: rename module from tal-tech to zeromicro (#1413) 3 years ago
Kevin Wan a7aeb8ac0e
feat: support tls for etcd client (#1390)
* feat: support tls for etcd client

* chore: fix typo

* refactor: rename TrustedCAFile to CACertFile

* docs: add comments

* fix: missing tls registration

* feat: add InsecureSkipVerify config for testing
3 years ago
Kevin Wan a8e7fafebf
refactor: optimize fx (#1404)
* refactor: optimize fx

* chore: add more comments

* ci: make test robust
3 years ago
Kevin Wan c19d2637ea
feat: implement fx.NoneMatch, fx.First, fx.Last (#1402)
* chore: use workers from options in fx.unlimitedWalk

* feat: add fx.NoneMatch

* feat: add fx.First, fx.Last

* chore: add more comments

* docs: add mr readme
3 years ago
Kevin Wan fe1da14332
chore: simplify mapreduce (#1401) 3 years ago
Kevin Wan d6ff30a570
chore: fix golint issues (#1396) 3 years ago
Kevin Wan e4ab518576
test: add more tests (#1391) 3 years ago
Kevin Wan 23deaf50e6
feat: support array in default and options tags (#1386)
* feat: support array in default and options tags

* feat: ignore spaces in tags

* test: add more tests
3 years ago
Kevin Wan c0647f0719
feat: support context in MapReduce (#1368) 3 years ago
Kevin Wan 8745ed9c61
chore: add 1s for tolerance in redislock (#1367) 3 years ago
种豆得豆 836726e710
fix redis try-lock bug (#1366)
#issue_id: 1338

Co-authored-by: zhangwei <>
3 years ago
Kevin Wan cd289465fd
chore: coding style and comments (#1361)
* chore: coding style and comments

* chore: optimize `ParseJsonBody` (#1353)

* chore: optimize `ParseJsonBody`

* chore: optimize `ParseJsonBody`

* fix: fix a test

* chore: optimize `ParseJsonBody`

* fix a test

* chore: add comment

* chore: refactor

Co-authored-by: chenquan <chenquan.dev@foxmail.com>
3 years ago
chenquan 263e426ae1
chore: optimize `ParseJsonBody` (#1353)
* chore: optimize `ParseJsonBody`

* chore: optimize `ParseJsonBody`

* fix: fix a test

* chore: optimize `ParseJsonBody`

* fix a test

* chore: add comment
3 years ago
Kevin Wan d1c2a31af7
chore: add tests & refactor (#1346)
* chore: add tests & refactor

* chore: refactor
3 years ago
MarkJoyMa 3e6c217408
Feature: support adding custom cache to mongoc and sqlc (#1313)
* merge

* Feature: support adding custom cache to mongoc and sqlc
3 years ago
Kevin Wan b299f350be
chore: add comments (#1345) 3 years ago
Kevin Wan 776e6e647d
feat: tidy mod, add go.mod for goctl (#1328) 3 years ago
Kevin Wan 4ccdf4ec72
chore: format code (#1327) 3 years ago
CrazyZard a7bd993c0c
commit missing method for redis (#1325)
* commit `decr ` `decrby` `lindex` missing method for redis

* fix(store_test):TestRedis_DecrBy

* add unit tests for redis commands. And put the functions in alphabetical order

* put the functions in alphabetical order

* add `lindex` unit test

* sort func
3 years ago
Kevin Wan 914692cc82
fix #1309 (#1317) 3 years ago
Kevin Wan 403dd7367a
fix #1288 (#1292)
* fix #1288

* chore: make wrapup & shutdown callbacks run simulatenously
3 years ago
Kevin Wan d828c3f37e
feat: add etcd resolver scheme, fix discov minor issue (#1281) 3 years ago
chenquan cf683411ee
feature(retry): Delete retry mechanism (#1279) 3 years ago
Kevin Wan de5ed6a677
feat: support %w in logx.Errorf (#1278) 3 years ago
Kevin Wan a7a6753118
fixes #1257 (#1271)
* fixes #1257

* chore: format code

* test: add more tests
3 years ago
FabioCircle 11c485a5ed
Duplicate temporary variable (#1244)
Co-authored-by: fabiowzhang <fabiowzhang@wesure.cn>
3 years ago
Kevin Wan 11f85d1b80
chore: remove conf.CheckedDuration (#1235) 3 years ago
Kevin Wan 4f5c30e083
chore: remove unused const (#1224) 3 years ago
an 3a510a9138
chore: redislock use stringx.randn replace randomStr func (#1220) 3 years ago
anqiansong 69a4d213a3
Fix issue 1205 (#1211)
* fix #1205

* move builder into stores

* remove xrom

* Remove unused code

* Remove unused code

* refactor builderx to builder

Co-authored-by: anqiansong <anqiansong@bytedance.com>
3 years ago
Kevin Wan e8efcef108
update dependencies. (#1210)
* chore: update dependencies

* chore: update dependencies

* chore: update dependencies

* chore: update dependencies

* chore: fix test failure
3 years ago
yedf2 6aba5f74fc
feat: add NewSessionFromTx to interact with other orm (#1202)
Co-authored-by: yedongfu <dongfuye@163.com>
3 years ago
Kevin Wan 785d100be9
feat: slow threshold customizable in sqlx (#1188) 3 years ago
Kevin Wan f13e6f1149
feat: slow threshold customizable in redis (#1187) 3 years ago
Kevin Wan 8be0f77d96
feat: slow threshold customizable in mongo (#1186) 3 years ago
Kevin Wan 429f85a9de
feat: slow threshold customizable in redis (#1185)
* feat: slow threshold customizable in redis

* chore: improve config robustness
3 years ago
Kevin Wan 3c1cfd4c1e
feat: support multiple trace agents (#1183)
* feat: support multiple trace agents

* feat: support multiple trace agents, let later calls run if error happens

* test: add more tests
3 years ago
Kevin Wan a71a210704
feat: let different services start prometheus on demand (#1182) 3 years ago
Kevin Wan 59b9687f31
feat: support auth account for etcd (#1174) 3 years ago
Kevin Wan bd26783b33
test: add more tests (#1166)
* chore: reverse the order of stopping services

* chore: reverse the order of stopping services

* test: add more tests
3 years ago
Kevin Wan eda8230521
chore: reorg imports, format code, make MaxRetires default to 0 (#1165)
* chore: reverse the order of stopping services

* chore: reverse the order of stopping services

* chore: reorg imports, format code

* chore: format code, and refactor

* feat: change MaxRetries default to 0, disable retry
3 years ago
chenquan 462ddbb145
Add grpc retry (#1160)
* Add grpc retry

* Update grpc retry

* Add tests

* Fix a bug

* Add api && some tests

* Add comment

* Add double check

* Add server retry quota

* Update optimize code

* Fix bug

* Update optimize code

* Update optimize code

* Fix bug
3 years ago
Kevin Wan 7109d6d635
chore: reverse the order of stopping services (#1159)
* chore: reverse the order of stopping services

* chore: reverse the order of stopping services
3 years ago
Kevin Wan a6bdffd225
test: add more tests (#1154) 3 years ago
Kevin Wan eab77e21dd
test: add more tests (#1147)
* test: add more tests

* test: add more tests
3 years ago
Kevin Wan 265b1f2459
test: add more tests (#1138) 3 years ago
Kevin Wan c92ea59228
test: add more tests (#1137) 3 years ago
Kevin Wan fa4dc151ca
test: add more tests (#1134) 3 years ago
Mikael 837a9ffa03
go-zero/core/hash/hash_test.go 增加测试 TestMd5Hex (#1128) 3 years ago
Kevin Wan 10e7922597
feat: opentelemetry integration, removed self designed tracing (#1111)
* feat: opentelemetry integration, removed self designed tracing

* feat: support zipkin on opentelemetry integration

* feat: support zipkin on opentelemetry integration, enable it in conf

* style: format code

* fix: support logx without exporter configured

* fix: check return values

* refactor: simplify code

* refactor: simplify opentelemetry integration

* ci: fix staticcheck errors
3 years ago
Kevin Wan ed15ca04f4
fix: opentelemetry traceid not correct (#1108) 3 years ago
Kevin Wan d1e702e8a3
test: add more tests (#1106)
* style: format code

* test: add more tests

* fix: staticcheck errors
3 years ago
chenquan d1bfb5ef61
Fix the `resources` variable not reset after the resource manager is closed (#1105)
* Fix the resource variable not reset after the resource manager is closed

* Format code
3 years ago
Kevin Wan e43357164c
chore: replace redis.NewRedis with redis.New (#1103) 3 years ago
Kevin Wan cd21c9fa74
chore: mark redis.NewRedis as Deprecated, use redis.New instead. (#1100)
* chore: mark redis.NewRedis as Deprecated

* chore: mark redis.NewRedis as Deprecated
3 years ago
Kevin Wan 65905b914d
ci: add reviewdog (#1096) 3 years ago
Kevin Wan 8403ed16ae
ci: add Lint check on commits (#1086)
* ci: add Lint check on commits

* ci: fix Lint script error

* test: fix go vet errors

* test: fix go vet errors, remove gofumpt to check go vet

* test: fix go vet errors, try gofumpt

* test: fix go vet errors, try gofumpt, round 1

* test: fix go vet errors, try gofumpt, round 2

* ci: fix Lint errors
3 years ago
NevS 004ee488a6
fix AtomicError panic when Set nil (#1049) (#1050) 3 years ago
Kevin Wan 2e12cd2c99
coding style (#1083) 3 years ago
neosu 2695c30886
we can use otel.ErrorHandlerFunc instead of custom struct when we update OpenTelemetry to 1.0.0 (#1081) 3 years ago
Kevin Wan c9db9588b7
chore: fix comment issues (#1056) 3 years ago
Kevin Wan 872c50b71a
chore: make comment accurate (#1055) 3 years ago
Kevin Wan f4bb9f5635
fix test error on ubuntu (#1048) 3 years ago
Kevin Wan 71c0288023
fix symlink issue on windows for goctl (#1034)
* fix symlink issue on windows for goctl

* move readlink into separate file
3 years ago
Kevin Wan 24fd34413f
fix golint issues (#1027) 3 years ago
Kevin Wan 3f47251892
fix proc.Done not found in windows (#1026) 3 years ago
Kevin Wan 0b6bc69afa
reorg imports, format code (#1024) 3 years ago
Kevin Wan 5cc9eb0de4
rename sharedcalls to singleflight (#1017) 3 years ago
Kevin Wan f070d447ef
refactor for better error reporting on sql error (#1016)
* refactor for better error reporting on sql error

* fix errors

* add docs
3 years ago
Kevin Wan f6d9e19ecb
expose sql.DB to let orm operate on it (#1015)
* expose sql.DB to let orm operate on it

* add missing RawDB methods

* add NewSqlConnFromDB for cooperate with dtm
3 years ago
Kevin Wan c837dc21bb
refactoring tracing interceptors. (#1009)
* refactor tracing interceptors

* add stream tracing interceptor
3 years ago
Kevin Wan bdec5f2349
use sdktrace instead of trace for opentelemetry to avoid conflicts (#1005)
* use sdktrace instead of trace for opentelemetry to avoid conflicts

* disable opentelemetry for right now
3 years ago
neosu dec6309c55
add opentelemetry test (#1002) 3 years ago
Kevin Wan 10805577f5
reorg imports, format code (#1000) 3 years ago