Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Adding live metrics #96

Merged
merged 9 commits into from
Jun 15, 2020
Merged

Adding live metrics #96

merged 9 commits into from
Jun 15, 2020

Conversation

hectorhdzg
Copy link
Member

Fixes #52

@hectorhdzg hectorhdzg requested a review from lzchen as a code owner June 3, 2020 00:01
@hectorhdzg
Copy link
Member Author

Code to expose this to final user is not part of this PR, currently we need to add the AzureMetricsSpanProcessor to the TracerProvider and instantiate the AutoCollection classes, it will be good to have some initial configuration that take care of this


# pylint: disable=too-many-statements
# pylint: disable=too-many-branches
def convert_span_to_envelope(span: Span) -> protocol.Envelope:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move this here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need this conversion in LiveMetrics processing, could move to a more appropriate location like utility or something, any suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave this in trace and have LiveMetrics just import from trace module?

data.properties["_MS.links"] = json.dumps(links)
# TODO: tracestate, tags
envelope = convert_span_to_envelope(span)
envelope.ikey = self.options.instrumentation_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we can't set the ikey in the convert function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ikey is not available everywhere in the SDK, is currently specific to exporters, validation code is already in there, will need to centralize ikey management to be able to add the ikey in some shared function

@lzchen
Copy link
Contributor

lzchen commented Jun 3, 2020

Can you add a summary of all the changes in the description (including moving certain files) and also the reasoning behind those changes?

Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be good to document somewhere in a consolidated place exactly what standard metrics are autocollected and what live metrics are autocollected.

@codecov-commenter
Copy link

codecov-commenter commented Jun 5, 2020

Codecov Report

Merging #96 into master will increase coverage by 2.00%.
The diff coverage is 95.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   91.98%   93.99%   +2.00%     
==========================================
  Files          18       21       +3     
  Lines        1048     1132      +84     
  Branches      142      143       +1     
==========================================
+ Hits          964     1064     +100     
+ Misses         74       39      -35     
- Partials       10       29      +19     
Impacted Files Coverage Δ
...itor/sdk/auto_collection/metrics_span_processor.py 82.50% <82.50%> (ø)
...nitor/sdk/auto_collection/live_metrics/exporter.py 63.73% <85.71%> (+18.47%) ⬆️
azure_monitor/src/azure_monitor/export/__init__.py 98.75% <96.92%> (-1.25%) ⬇️
...monitor/src/azure_monitor/export/trace/__init__.py 100.00% <100.00%> (ø)
azure_monitor/src/azure_monitor/protocol.py 94.82% <100.00%> (+3.76%) ⬆️
.../src/azure_monitor/sdk/auto_collection/__init__.py 100.00% <100.00%> (ø)
..._monitor/sdk/auto_collection/dependency_metrics.py 100.00% <100.00%> (ø)
...nitor/sdk/auto_collection/live_metrics/__init__.py 100.00% <100.00%> (ø)
...onitor/sdk/auto_collection/live_metrics/manager.py 93.22% <100.00%> (-0.59%) ⬇️
...monitor/sdk/auto_collection/live_metrics/sender.py 86.36% <100.00%> (+0.64%) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a47bd4...0a5a2e2. Read the comment docs.

No need to differentiate between live and standard metrics in reuqests and dependencies
Add logic to stop collecting documents when live metrics are not subscribed
Fix issues with LiveMetric document creation
Copy link
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzchen lzchen merged commit b559ca9 into microsoft:master Jun 15, 2020
@lzchen lzchen mentioned this pull request Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add QuickPulse metrics
3 participants