Documentation ¶
Index ¶
- func Shutdown(c *Config)
- func Start(c *Config) error
- type Config
- type Option
- func WithErrorHandler(handler otel.ErrorHandler) Option
- func WithMetricExporterEndpoint(url string) Option
- func WithMetricExporterInsecure(insecure bool) Option
- func WithMetricReportingPeriod(p time.Duration) Option
- func WithResource(resource *resource.Resource) Option
- func WithResourceAttributes(attributes map[string]string) Option
- func WithSLSConfig(project, instanceID, accessKeyID, accessKeySecret string) Option
- func WithServiceName(name string) Option
- func WithServiceVersion(version string) Option
- func WithTraceExporterEndpoint(url string) Option
- func WithTraceExporterInsecure(insecure bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { TraceExporterEndpoint string `env:"SLS_OTEL_TRACE_ENDPOINT,default=stdout"` TraceExporterEndpointInsecure bool `env:"SLS_OTEL_TRACE_INSECURE,default=false"` MetricExporterEndpoint string `env:"SLS_OTEL_METRIC_ENDPOINT,default=stdout"` MetricExporterEndpointInsecure bool `env:"SLS_OTEL_METRIC_INSECURE,default=false"` MetricReportingPeriod string `env:"SLS_OTEL_METRIC_EXPORT_PERIOD,default=30s"` ServiceName string `env:"SLS_OTEL_SERVICE_NAME"` ServiceVersion string `env:"SLS_OTEL_SERVICE_VERSION,default=v0.1.0"` Project string `env:"SLS_OTEL_PROJECT"` InstanceID string `env:"SLS_OTEL_INSTANCE_ID"` AccessKeyID string `env:"SLS_OTEL_ACCESS_KEY_ID"` AccessKeySecret string `env:"SLS_OTEL_ACCESS_KEY_SECRET"` AttributesEnvKeys string `env:"SLS_OTEL_ATTRIBUTES_ENV_KEYS"` Resource *resource.Resource // contains filtered or unexported fields }
Config configure for sls otel
type Option ¶
type Option func(*Config)
Option configures the sls otel provider
func WithErrorHandler ¶
func WithErrorHandler(handler otel.ErrorHandler) Option
WithErrorHandler Configures a global error handler to be used throughout an OpenTelemetry instrumented project. See "go.opentelemetry.io/otel" 配置OpenTelemetry错误处理函数
func WithMetricExporterEndpoint ¶
WithMetricExporterEndpoint configures the endpoint for sending metrics via OTLP 配置Metric的输出地址,如果配置为空则禁用Metric功能,配置为stdout则打印到标准输出用于测试
func WithMetricExporterInsecure ¶
WithMetricExporterInsecure permits connecting to the metric endpoint without a certificate 配置是否禁用SSL,如果输出到SLS,则必须打开SLS
func WithMetricReportingPeriod ¶
WithMetricReportingPeriod configures the metric reporting period, how often the controller collects and exports metric data. 配置Metric导出间隔,默认为30s
func WithResource ¶
WithResource configures attributes on the resource 配置上传附加的一些tag信息,例如环境、可用区等
func WithResourceAttributes ¶
WithResourceAttributes configures attributes on the resource 配置上传附加的一些tag信息,例如环境、可用区等
func WithSLSConfig ¶
WithSLSConfig configures sls project, instanceID, accessKeyID, accessKeySecret to send data to sls directly 配置输出到SLS的信息,包括 project, instanceID, accessKeyID, accessKeySecret
func WithServiceName ¶
WithServiceName configures a "service.name" resource label 配置服务名称
func WithServiceVersion ¶
WithServiceVersion configures a "service.version" resource label 配置版本号
func WithTraceExporterEndpoint ¶
WithTraceExporterEndpoint configures the endpoint for sending traces via OTLP 配置Trace的输出地址,如果配置为空则禁用Trace功能,配置为stdout则打印到标准输出用于测试
func WithTraceExporterInsecure ¶
WithTraceExporterInsecure permits connecting to the trace endpoint without a certificate 配置是否禁用SSL,如果输出到SLS,则必须打开SLS