func (mod *Prometheus) Provision(ctx *gotenberg.Context) error {
	flags := ctx.ParsedFlags()
	mod.namespace = flags.MustString("prometheus-namespace")
	mod.interval = flags.MustDuration("prometheus-collect-interval")
	mod.disableRouteLogging = flags.MustBool("prometheus-disable-route-logging")
	mod.disableCollect = flags.MustBool("prometheus-disable-collect")
	if mod.disableCollect {
		return nil
	}
	mods, err := ctx.Modules(new(gotenberg.MetricsProvider))
	if err != nil {
		return fmt.Errorf("get metrics providers: %w", err)
	}
	metricsProviders := make([]gotenberg.MetricsProvider, len(mods))
	for i, metricsProvider := range mods {
		metricsProviders[i] = metricsProvider.(gotenberg.MetricsProvider)
	}
	for _, metricsProvider := range metricsProviders {
		metrics, err := metricsProvider.Metrics()
		if err != nil {
			return fmt.Errorf("get metrics: %w", err)
		}
		mod.metrics = append(mod.metrics, metrics...)
	}
	mod.registry = prometheus.NewRegistry()
	return nil
}
Provision sets the modules properties.
package prometheus
import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"time"
	"github.com/gotenberg/gotenberg/v7/pkg/gotenberg"
	"github.com/gotenberg/gotenberg/v7/pkg/modules/api"
	"github.com/labstack/echo/v4"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promhttp"
	flag "github.com/spf13/pflag"
)
func init() {
	gotenberg.MustRegisterModule(Prometheus{})
}
type Prometheus struct {
	namespace           string
	interval            time.Duration
	disableRouteLogging bool
	disableCollect      bool
	metrics  []gotenberg.Metric
	registry *prometheus.Registry
}
func (Prometheus) Descriptor() gotenberg.ModuleDescriptor {
	return gotenberg.ModuleDescriptor{
		ID: "prometheus",
		FlagSet: func() *flag.FlagSet {
			fs := flag.NewFlagSet("prometheus", flag.ExitOnError)
			fs.String("prometheus-namespace", "gotenberg", "Set the namespace of modules' metrics")
			fs.Duration("prometheus-collect-interval", time.Duration(1)*time.Second, "Set the interval for collecting modules' metrics")
			fs.Bool("prometheus-disable-route-logging", false, "Disable the route logging")
			fs.Bool("prometheus-disable-collect", false, "Disable the collect of metrics")
			return fs
		}(),
		New: func() gotenberg.Module { return new(Prometheus) },
	}
}