saltstack / saltstack/salt

carbon returner not using metric_base_pattern (not implemented)

Open
#43,332 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

Despite the documentation saying that a metric pattern can be specified for the carbon configuration, it seems the functionality is not implemented.
https://docs.saltstack.com/en/latest/ref/returners/all/salt.returners.carbon_return.html

Setup
carbon:
  host: graphite.example.com
  port: 2013
  skip_on_error: True
  mode: text
  metric_base_pattern: PREFIX.salt.[module].[function].[minion_id]
Steps to Reproduce Issue

I had added some debug statements to the carbon returner, but even the metric_base_pattern variable would be set to None in https://github.com/saltstack/salt/blob/develop/salt/returners/carbon_return.py#L232.
I believe the line should actually be

    metric_base_pattern = opts.get('metric_base_pattern')

And then the attribute has to be added in _get_options in https://github.com/saltstack/salt/blob/develop/salt/returners/carbon_return.py#L111

    Returns options used for the carbon returner.
    '''
    attrs = {'host': 'host',
             'port': 'port',
             'skip': 'skip_on_error',
             'metric_base_pattern': 'metric_base_pattern',
             'mode': 'mode'}
...

And then last but not least, the functionality has to be implemented as to where the pattern is adhered to.
I'm not sure how to do that right now, otherwise I'd submit a pull request.

Versions Report
Salt Version:
           Salt: 2017.7.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: 3.2.2
       dateutil: 2.6.0
      docker-py: Not Installed
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 0.9.1
   msgpack-pure: 0.1.3
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4

System Versions:
           dist: Ubuntu 14.04 trusty
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 3.13.0-101-generic
         system: Linux
        version: Ubuntu 14.04 trusty

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with salt/returners/carbon_return.py, especially _get_options and the metric_base_pattern handling around the referenced lines. Compare the implementation with the carbon returner documentation and trace where emitted metric names are built. Done means the configured pattern is read and applied consistently, with behavior matching the documented configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.