geoipprocessor

package module
v0.114.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

README

GeoIP Processor

Status
Stability alpha: traces, metrics, logs
Distributions contrib
Issues Open issues Closed issues
Code Owners @andrzej-stencel, @michalpristas, @rogercoll

Description

The geoIP processor geoipprocessor enhances the attributes of a span, log, or metric by appending information about the geographical location of an IP address. To add geographical information, the IP address must be included in the attributes using the source.address semantic conventions key attribute. By default, only the resource attributes will be modified. Please refer to config.go for the config spec.

Geographical location metadata

The following resource attributes will be added if the corresponding information is found:

  * geo.city_name
  * geo.postal_code
  * geo.country_name
  * geo.country_iso_code
  * geo.continent_name
  * geo.continent_code
  * geo.region_name
  * geo.region_iso_code
  * geo.timezone
  * geo.location.lat
  * geo.location.lon

Configuration

The following settings must be configured:

  • providers: A map containing geographical location information providers. These providers are used to search for the geographical location attributes associated with an IP. Supported providers:
  • context: Allows specifying the underlying telemetry context the processor will work with. Available values:
    • resource(default): Resource attributes.
    • record: Attributes within a data point, log record or a span.

Examples

processors:
    # processor name: geoip
    geoip:
      context: resource
      providers:
        maxmind:
          database_path: /tmp/mygeodb

Documentation

Overview

Package geoipprocessor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() processor.Factory

NewFactory creates a new processor factory with default configuration, and registers the processors for metrics, traces, and logs.

Types

type Config

type Config struct {
	// Providers specifies the sources to extract geographical information about a given IP.
	Providers map[string]provider.Config `mapstructure:"-"`

	// Context section allows specifying the source type to look for the IP. Available options: resource or record.
	Context ContextID `mapstructure:"context"`
}

Config holds the configuration for the GeoIP processor.

func (*Config) Unmarshal added in v0.105.0

func (cfg *Config) Unmarshal(componentParser *confmap.Conf) error

Unmarshal a config.Parser into the config struct.

func (*Config) Validate

func (cfg *Config) Validate() error

type ContextID added in v0.108.0

type ContextID string

func (*ContextID) UnmarshalText added in v0.108.0

func (c *ContextID) UnmarshalText(text []byte) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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