from __future__ import absolute_import
from .base import BaseModule

import os

class HostInformationModule(BaseModule):
    key = 'host'

    def get_metrics(self):
        return {'name': os.uname()[1]}


def init():
    return HostInformationModule

import socket

from .base import BaseModule


class HostInformationModule(BaseModule):
    key = 'host'

    def get_metrics(self):
        return {'name': socket.gethostname()}


def init():
    return HostInformationModule

Use more portable function to get hostname
Use more portable function to get hostname

This addresses #11

- from __future__ import absolute_import
+ import socket
+ 
  from .base import BaseModule
  
- import os
  
  class HostInformationModule(BaseModule):
      key = 'host'
  
      def get_metrics(self):
-         return {'name': os.uname()[1]}
+         return {'name': socket.gethostname()}
  
  
  def init():
      return HostInformationModule
  
Use more portable function to get hostname
## Code Before:
from __future__ import absolute_import
from .base import BaseModule

import os

class HostInformationModule(BaseModule):
    key = 'host'

    def get_metrics(self):
        return {'name': os.uname()[1]}


def init():
    return HostInformationModule

## Instruction:
Use more portable function to get hostname
## Code After:
import socket

from .base import BaseModule


class HostInformationModule(BaseModule):
    key = 'host'

    def get_metrics(self):
        return {'name': socket.gethostname()}


def init():
    return HostInformationModule
