uuid

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

Trace/UUID Plugin

The trace/uuid plugin adds a X-Micro-Trace-Id header with a uuid if it does not exist.

Usage

Register the plugin before building Micro

package main

import (
	"github.com/micro/micro/plugin"
	"github.com/micro/go-plugins/micro/trace/uuid"
)

func init() {
	plugin.Register(uuid.New())
}
Scoped to API

If you like to only apply the plugin for a specific component you can register it with that specifically. For example, below you'll see the plugin registered with the API.

package main

import (
	"github.com/micro/micro/api"
	"github.com/micro/go-plugins/micro/trace/uuid"
)

func init() {
	api.Register(uuid.New())
}