Skip to content

Commit 809d543

Browse files
committed
fixes generation error creation
1 parent 31068e2 commit 809d543

File tree

4 files changed

+71
-5
lines changed

4 files changed

+71
-5
lines changed

.gitignore

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,54 @@
1-
testConfig.json
1+
# Project specific
2+
testConfig.json
3+
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool
15+
*.out
16+
coverage.txt
17+
coverage.html
18+
19+
# Dependency directories
20+
vendor/
21+
22+
# Go workspace file
23+
go.work
24+
go.work.sum
25+
26+
# Build artifacts
27+
dist/
28+
build/
29+
bin/
30+
31+
# IDE specific files
32+
.vscode/
33+
.idea/
34+
*.swp
35+
*.swo
36+
*~
37+
.DS_Store
38+
39+
# Air (live reload) tmp directory
40+
tmp/
41+
42+
# Environment variables
43+
.env
44+
.env.local
45+
.env.*.local
46+
47+
# Logs
48+
*.log
49+
50+
# Debug files
51+
__debug_bin
52+
debug
53+
54+
.DS_Store

logging/generation.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,12 @@ func (g *Generation) SetResult(r interface{}) {
294294

295295
func (g *Generation) SetError(err *GenerationError) {
296296
g.error = err
297-
g.commit("update", map[string]interface{}{
298-
"error": g.error,
297+
g.commit("result", map[string]interface{}{
298+
"result": map[string]interface{}{
299+
"error": g.error,
300+
},
299301
})
302+
g.End()
300303
}
301304

302305
func (g *Generation) data() map[string]interface{} {

logging/logger.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,12 @@ func (l *Logger) AddResultToGeneration(gId string, result interface{}) {
253253

254254
// SetGenerationError sets an error for the specified generation
255255
func (l *Logger) SetGenerationError(gId string, error *GenerationError) {
256-
l.writer.commit(newCommitLog(EntityGeneration, gId, "error", map[string]interface{}{
257-
"error": error,
256+
l.writer.commit(newCommitLog(EntityGeneration, gId, "result", map[string]interface{}{
257+
"result": map[string]interface{}{
258+
"error": error,
259+
},
258260
}))
261+
end(l.writer, EntityGeneration, gId)
259262
}
260263

261264
// EndGeneration marks the specified generation as ended

logging/trace.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package logging
22

3+
// TraceConfig represents the configuration for a trace
34
type TraceConfig struct {
45
Id string `json:"id"`
56
SpanId *string `json:"spanId,omitempty"`
@@ -8,11 +9,13 @@ type TraceConfig struct {
89
SessionId *string
910
}
1011

12+
// Trace represents a trace in the logging system
1113
type Trace struct {
1214
*eventEmitter
1315
SessionId *string
1416
}
1517

18+
// newTrace creates a new trace
1619
func newTrace(c *TraceConfig, w *writer) *Trace {
1720
t := &Trace{
1821
eventEmitter: &eventEmitter{
@@ -31,6 +34,7 @@ func newTrace(c *TraceConfig, w *writer) *Trace {
3134
return t
3235
}
3336

37+
// AddGeneration adds a generation to the trace
3438
func (t *Trace) AddGeneration(c *GenerationConfig) *Generation {
3539
g := newGeneration(c, t.writer)
3640
gData := g.data()
@@ -39,10 +43,12 @@ func (t *Trace) AddGeneration(c *GenerationConfig) *Generation {
3943
return g
4044
}
4145

46+
// SetFeedback adds a feedback to the trace
4247
func (t *Trace) SetFeedback(f *Feedback) {
4348
t.commit("add-feedback", f)
4449
}
4550

51+
// AddSpan adds a span to the trace
4652
func (t *Trace) AddSpan(c *SpanConfig) *Span {
4753
s := newSpan(c, t.writer)
4854
sData := s.data()
@@ -51,6 +57,7 @@ func (t *Trace) AddSpan(c *SpanConfig) *Span {
5157
return s
5258
}
5359

60+
// AddRetrieval adds a retrieval to the trace
5461
func (t *Trace) AddRetrieval(c *RetrievalConfig) *Retrieval {
5562
r := newRetrieval(c, t.writer)
5663
rData := r.data()

0 commit comments

Comments
 (0)