Skip to content

Commit

Permalink
add github actions and some badges
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilatuz committed Sep 25, 2022
1 parent 20332c5 commit 48e344d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: otelzap-go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Build
run: go build -v ./...

- name: Test
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Coverage
uses: codecov/codecov-action@v3
with:
files: coverage.txt
fail_ci_if_error: true
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# otelzap
# otelzap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]

OpenTelemetry integration with ZAP logger
OpenTelemetry integration with ZAP logger.

Released under the [MIT License](LICENSE).


## Quick start

This package can be used to add regular log messages as OpenTelemetry events.

```{.go}
func MyAction(ctx context.Context, foo int) {
ctx, span := tracer.Start(ctx, "MyAction")
defer span.End()
LOG := otelzap.SpanLogger(span, logger)
LOG.Debug("do my action", zap.Int("foo", foo))
}
```

The code above will also add OpenTelemetry event with "foo" attribute attached.


[doc-img]: https://godoc.org/github.com/Pilatuz/otelzap?status.svg
[doc]: https://godoc.org/github.com/Pilatuz/otelzap
[ci-img]: https://github.com/Pilatuz/otelzap/actions/workflows/go.yml/badge.svg
[ci]: https://github.com/Pilatuz/otelzap/actions
[cov-img]: https://codecov.io/gh/Pilatuz/otelzap/branch/main/graph/badge.svg
[cov]: https://codecov.io/gh/Pilatuz/otelzap
[reportcard-img]: https://goreportcard.com/badge/github.com/Pilatuz/otelzap
[reportcard]: https://goreportcard.com/report/github.com/Pilatuz/otelzap

0 comments on commit 48e344d

Please sign in to comment.