mongo

package module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2022 License: GPL-3.0 Imports: 3 Imported by: 1

README

mongo

How to

go get github.com/tel-io/instrumentation/plugins/mongo@latest
Usage
package main

import (
	"context"
	"github.com/tel-io/tel/v2"
	plugin "github.com/tel-io/instrumentation/plugins/mongo"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)

func main() {
	t, cc := tel.New(context.Background(), tel.GetConfigFromEnv())
	defer cc()
	
	// connect to MongoDB
	opts := options.Client()

	// inject plugin
	plugin.Inject(opts, plugin.WithTel(&t))

	opts.ApplyURI("mongodb://localhost:27017")
	client, err := mongo.Connect(context.Background(), opts)

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(c *options.ClientOptions, opts ...Option)

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option interface used for setting optional config properties.

func WithOtelConf

func WithOtelConf(opt ...otelmongo.Option) Option

func WithTel

func WithTel(t *tel.Telemetry) Option

WithTel also add options to pass own metric and trace provider

Directories

Path Synopsis
example module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL