Skip to content

Commit d905682

Browse files
committed
docs: Improve comments and docs for welcoming helix.ts
Signed-off-by: Loïc Saint-Roch <[email protected]>
1 parent d560f94 commit d905682

File tree

12 files changed

+27
-36
lines changed

12 files changed

+27
-36
lines changed

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
[![GitHub Release](https://img.shields.io/github/v/release/nunchistudio/helix.go)](https://github.com/nunchistudio/helix.go/releases/latest)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
88

9-
helix.go is the Go implementation of [helix](https://github.com/nunchistudio/helix).
10-
11-
helix.go was developed with the following use cases in mind:
12-
13-
- Consistent and high-performance (micro) services;
14-
- Effortless end-to-end observability and event propagation across services.
15-
16-
By using helix.go, organizations can benefit from automatic distributed tracing,
17-
error recording, and event propagation across Go services and integrations with
18-
no additional lines of code!
9+
helix.go is the Go implementation of [helix](https://github.com/nunchistudio/helix),
10+
for building cloud-native, consistent, reliable, and high-performance (micro)
11+
services. It allows back-end engineers to simplify development of complex problems
12+
through a thin layer of abstraction that handles automatic logging, tracing,
13+
observability, and event propagation across services and integrations.
1914

2015
![Event propagation with helix](https://nunchi.studio/helix/screenshots/trace-distributed.png)
2116

documentation/api-references.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

documentation/from-zero-to-hero-second.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"errors"
2222

23-
natsinte "go.nunchi.studio/helix/integration/nats"
23+
"go.nunchi.studio/helix/integration/nats"
2424
"go.nunchi.studio/helix/service"
2525
"go.nunchi.studio/helix/telemetry/trace"
2626

@@ -32,7 +32,7 @@ App holds the different components needed to run our Go service. In this
3232
case, it only holds a NATS JetStream context.
3333
*/
3434
type App struct {
35-
JetStream natsinte.JetStream
35+
JetStream nats.JetStream
3636
}
3737

3838
/*
@@ -47,7 +47,7 @@ func NewAndStart() error {
4747

4848
// First, create a new NATS JetStream context. We keep empty config but feel
4949
// free to dive more later for advanced configuration.
50-
js, err := natsinte.Connect(natsinte.Config{})
50+
js, err := nats.Connect(nats.Config{})
5151
if err != nil {
5252
return err
5353
}
@@ -58,7 +58,7 @@ func NewAndStart() error {
5858
}
5959

6060
// Create a new stream in NATS JetStream called "demo-stream", for subject "demo".
61-
stream, _ := js.CreateStream(context.Background(), jetstream.StreamConfig{
61+
stream, _ := js.CreateOrUpdateStream(context.Background(), jetstream.StreamConfig{
6262
Name: "demo-stream",
6363
Subjects: []string{"demo"},
6464
})

errorstack/error.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ var _ error = (*Error)(nil)
1111

1212
/*
1313
Error implements the Go native error type and is designed for handling errors
14-
in the helix.go ecosystem. When exposing errors to clients (such as via HTTP
15-
API), the root error should not give away too much information such as internal
16-
messages.
14+
in the helix ecosystem. When exposing errors to clients (such as via HTTP API),
15+
the root error should not give away too much information such as internal messages.
1716
*/
1817
type Error struct {
1918

@@ -30,9 +29,9 @@ type Error struct {
3029
// Message is the top-level message of the error.
3130
Message string `json:"message"`
3231

33-
// Validations represents a list of failed configuration validations. This is
34-
// used when a Integration's configuration encountered errors related to values
35-
// set by clients.
32+
// Validations represents a list of failure validations related to the error
33+
// itself. This allows to pass/retrieve additional details, such as validation
34+
// failures encountered in the request payload.
3635
Validations []Validation `json:"validations,omitempty"`
3736

3837
// Children holds child errors encountered in cascade related to the current
@@ -53,7 +52,7 @@ type Validation struct {
5352
//
5453
// Example:
5554
//
56-
// []string{"Options", "Producer", "MaxRetries"}
55+
// []string{"request", "body", "user", "email"}
5756
Path []string `json:"path,omitempty"`
5857
}
5958

errorstack/overview.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Package errorstack exposes a set of utilities for consistent error handling in
3-
the helix.go ecosystem. Every package in helix.go relies on this one.
3+
the helix ecosystem. Every package in helix.go relies on this one.
44
55
This package must not import any other package of this ecosystem.
66
*/

event/json.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
)
66

77
/*
8-
Key is the key that shall be present in a JSON-encoded value representing
9-
an Event.
8+
Key is the key that shall be present in a JSON-encoded value representing an Event.
109
1110
Example:
1211

event/overview.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Package event exposes some objects and utilities to get/set contextual informati
33
about an event. In a distributed architecture where events are flowing across
44
internal services and third-party integrations, it is highly encouraged to pass
55
an Event through a context.Context in order to trace them from end-to-end.
6-
helix.go core and integrations relies on contexts to manage logs and traces
6+
helix.go core and integrations rely on Go contexts to manage logs and traces
77
across services.
88
99
This package must not import any other package of this ecosystem.

integration/nats/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module go.nunchi.studio/helix/integration/nats
33
go 1.22
44

55
require (
6-
github.com/nats-io/nats.go v1.33.0
6+
github.com/nats-io/nats.go v1.33.1
77
github.com/stretchr/testify v1.8.4
88
go.nunchi.studio/helix v0.17.0
99
go.opentelemetry.io/otel v1.23.1

integration/nats/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
2121
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
2222
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
2323
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
24-
github.com/nats-io/nats.go v1.33.0 h1:rRg0l2F29B30n6EPl0j50hl8eYp7rA2ecoJ74E62US8=
25-
github.com/nats-io/nats.go v1.33.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
24+
github.com/nats-io/nats.go v1.33.1 h1:8TxLZZ/seeEfR97qV0/Bl939tpDnt2Z2fK3HkPypj70=
25+
github.com/nats-io/nats.go v1.33.1/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
2626
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
2727
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
2828
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=

integration/nats/jetstream_consumer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ retrieved or request times out.
4646
It automatically handles tracing and error recording.
4747
*/
4848
func (c *consumer) Fetch(ctx context.Context, batch int, opts ...jetstream.FetchOpt) (jetstream.MessageBatch, error) {
49-
_, span := trace.Start(ctx, trace.SpanKindClient, fmt.Sprintf("%s: Consumer / Fetch", humanized))
49+
_, span := trace.Start(ctx, trace.SpanKindConsumer, fmt.Sprintf("%s: Consumer / Fetch", humanized))
5050
defer span.End()
5151

5252
var err error
@@ -70,7 +70,7 @@ exceeded or request times out.
7070
It automatically handles tracing and error recording.
7171
*/
7272
func (c *consumer) FetchBytes(ctx context.Context, maxBytes int, opts ...jetstream.FetchOpt) (jetstream.MessageBatch, error) {
73-
_, span := trace.Start(ctx, trace.SpanKindClient, fmt.Sprintf("%s: Consumer / FetchBytes", humanized))
73+
_, span := trace.Start(ctx, trace.SpanKindConsumer, fmt.Sprintf("%s: Consumer / FetchBytes", humanized))
7474
defer span.End()
7575

7676
var err error
@@ -94,7 +94,7 @@ provided number of messages.
9494
It automatically handles tracing and error recording.
9595
*/
9696
func (c *consumer) FetchNoWait(ctx context.Context, batch int) (jetstream.MessageBatch, error) {
97-
_, span := trace.Start(ctx, trace.SpanKindClient, fmt.Sprintf("%s: Consumer / FetchNoWait", humanized))
97+
_, span := trace.Start(ctx, trace.SpanKindConsumer, fmt.Sprintf("%s: Consumer / FetchNoWait", humanized))
9898
defer span.End()
9999

100100
var err error

0 commit comments

Comments
 (0)