Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/vendor/cloud.google.com/go/pubsub
dependabot[bot] 9416812858
Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349)
2 years ago
..
apiv1 Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
internal Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
CHANGES.md Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
LICENSE Gcplog targetmanager (#3083) 4 years ago
README.md promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago
debug.go promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago
doc.go Bump cloud.google.com/go/storage from 1.27.0 to 1.29.0 (#8276) 2 years ago
flow_controller.go promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago
iterator.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
message.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
nodebug.go promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago
pubsub.go Bump cloud.google.com/go/storage from 1.27.0 to 1.29.0 (#8276) 2 years ago
pullstream.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
schema.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
service.go promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago
snapshot.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
subscription.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
topic.go Bump cloud.google.com/go/pubsub from 1.27.1 to 1.28.0 (#8349) 2 years ago
trace.go promtail: GCPLog fixing `failed to receive pubsub messages` error (#6965) 3 years ago

README.md

Cloud Pub/Sub Go Reference

Example Usage

First create a pubsub.Client to use throughout your application:

client, err := pubsub.NewClient(ctx, "project-id")
if err != nil {
	log.Fatal(err)
}

Then use the client to publish and subscribe:

// Publish "hello world" on topic1.
topic := client.Topic("topic1")
res := topic.Publish(ctx, &pubsub.Message{
	Data: []byte("hello world"),
})
// The publish happens asynchronously.
// Later, you can get the result from res:
...
msgID, err := res.Get(ctx)
if err != nil {
	log.Fatal(err)
}

// Use a callback to receive messages via subscription1.
sub := client.Subscription("subscription1")
err = sub.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
	fmt.Println(m.Data)
	m.Ack() // Acknowledge that we've consumed the message.
})
if err != nil {
	log.Println(err)
}