-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#14 introducing a new telemetry struct
- Loading branch information
1 parent
1c16e4b
commit f808c7c
Showing
4 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package telemetry | ||
|
||
import "go.uber.org/zap" | ||
|
||
type TelemetryConfig struct { | ||
LogConfig *LogConfig `json:"logs" yaml:"logs"` | ||
// TODO: add OTEL config | ||
} | ||
|
||
type Telemetry struct { | ||
logger *zap.Logger | ||
// TODO: add OTEL meter, tracer | ||
} | ||
|
||
func NewTelemetry(cfg *TelemetryConfig) (*Telemetry, error) { | ||
// TODO: gonna be read from a config file | ||
logConfig := NewLogConfig() | ||
logConfig.Level = zap.NewAtomicLevelAt(zap.DebugLevel) | ||
logConfig.Encoding = "console" | ||
|
||
logger, err := telemetry.NewLogger(logConfig) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &Telemetry{ | ||
logger: logger, | ||
} | ||
} | ||
|
||
func (t *Telemetry) Logger() *zap.Logger { | ||
return t.logger | ||
} |