-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
azure_monitor/tests/auto_collection/live_metrics/test_manager.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/__init__.py
Outdated
Show resolved
Hide resolved
self.value = value | ||
|
||
|
||
class LiveMetricDocument(BaseObject): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, where are the specs for these schemas defined? I can't seem to find them here https://github.com/microsoft/ApplicationInsights-Home/tree/master/EndpointSpecs/Schemas/Bond
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some internal specs but you can use .NET classes as reference
https://github.com/microsoft/ApplicationInsights-dotnet/tree/develop/WEB/Src/PerformanceCollector/Perf.Shared/Implementation/QuickPulse/Service%20contract
Can you include a description of the control flow of live metrics? What are each of these classes used for and how (if any) is the user expected to interact with it? |
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/sender.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/sender.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/sender.py
Outdated
Show resolved
Hide resolved
"Expect": "100-continue", | ||
"Content-Type": "application/json; charset=utf-8", | ||
LIVE_METRICS_TRANSMISSION_TIME_HEADER: str( | ||
round(time.time()) * 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/__init__.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/__init__.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/__init__.py
Outdated
Show resolved
Hide resolved
machine_name=azure_monitor_context.get("ai.device.id"), | ||
metrics=None, | ||
stream_id=STREAM_ID, | ||
timestamp="/Date({0})/".format(str(int(time.time()) * 1000)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as here.
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/sender.py
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/exporter.py
Show resolved
Hide resolved
def __init__(self, instrumentation_key): | ||
self._instrumentation_key = instrumentation_key | ||
self._sender = LiveMetricsSender(self._instrumentation_key) | ||
self.subscribed = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the exporter keeping the state of subscribed, however there doesn't seem to be a nice way to do this. One way is to use the context
, where the key is LIVE_METRICS_{x} where x is the unique UUID for that manager and the value is subscribed or not. Another (ugly) way is to have a reference to the manager from the exporter and keep the state of subscribed in the manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since UUID is unique per application and not manager instance, I think it is fine to have a global variable in the context keeping track of the state of subscribed. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem is with internal threads, we have 3 different threads that would be using this global context variable, making this code easier to break in specific cases, my point is that is not worth to add this logic only because subscribed flag feels out of place.
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/manager.py
Outdated
Show resolved
Hide resolved
azure_monitor/src/azure_monitor/sdk/auto_collection/live_metrics/exporter.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Needed for #52