Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions instana/agent/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import os
import json
from datetime import datetime

import urllib3
import requests
from datetime import datetime

from ..log import logger
from .base import BaseAgent
Expand Down Expand Up @@ -219,7 +220,6 @@ def report_data_payload(self, payload):

# Report metrics
metric_bundle = payload["metrics"]["plugins"][0]["data"]
# logger.debug(to_json(metric_bundle))
response = self.client.post(self.__data_url(),
data=to_json(metric_bundle),
headers={"Content-Type": "application/json"},
Expand Down
9 changes: 8 additions & 1 deletion instana/collector/helpers/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ def collect_metrics(self, with_snapshot=False):
plugin_data["name"] = "com.instana.plugin.python"
plugin_data["entityId"] = str(os.getpid())
plugin_data["data"] = DictionaryOfStan()
plugin_data["data"]["pid"] = str(os.getpid())

if hasattr(self.collector.agent, "announce_data"):
try:
plugin_data["data"]["pid"] = self.collector.agent.announce_data.pid
except Exception:
plugin_data["data"]["pid"] = str(os.getpid())
else:
plugin_data["data"]["pid"] = str(os.getpid())

self._collect_runtime_metrics(plugin_data, with_snapshot)

Expand Down