bugfix: indent not used in MetricsData to_json#3197
Merged
lzchen merged 4 commits intoopen-telemetry:mainfrom Feb 24, 2023
Merged
bugfix: indent not used in MetricsData to_json#3197lzchen merged 4 commits intoopen-telemetry:mainfrom
lzchen merged 4 commits intoopen-telemetry:mainfrom
Conversation
The indent parameter was passed down to the resource metric's to_json method, but not used in MetricsData. This change fixes that. Signed-off-by: Alex Boten <aboten@lightstep.com>
srikanthccv
approved these changes
Feb 24, 2023
added 3 commits
February 24, 2023 09:03
lzchen
approved these changes
Feb 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The indent parameter was passed down to the resource metric's to_json method, but not used in MetricsData. This change fixes that.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested this by running the getting started example code. The output used to be:
{"resource_metrics": [{"resource": {"attributes": {"telemetry.sdk.language": "python", "telemetry.sdk.name": "opentelemetry", "telemetry.sdk.version": "1.17.0.dev0", "service.name": "unknown_service"}, "schema_url": ""}, "scope_metrics": [{"scope": {"name": "getting-started", "version": "0.1.2", "schema_url": ""}, "metrics": [{"name": "counter", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 1677187635593555000, "time_unix_nano": 1677187635593924000, "value": 1}], "aggregation_temporality": 2, "is_monotonic": true}}, {"name": "updown_counter", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 1677187635593610000, "time_unix_nano": 1677187635593924000, "value": -4}], "aggregation_temporality": 2, "is_monotonic": false}}, {"name": "histogram", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 1677187635593649000, "time_unix_nano": 1677187635593924000, "count": 1, "sum": 99.9, "bucket_counts": [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], "explicit_bounds": [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0], "min": 99.9, "max": 99.9}], "aggregation_temporality": 2}}, {"name": "observable_counter", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 1677187635593837000, "time_unix_nano": 1677187635593924000, "value": 1}], "aggregation_temporality": 2, "is_monotonic": true}}, {"name": "observable_updown_counter", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 1677187635593869000, "time_unix_nano": 1677187635593924000, "value": -10}], "aggregation_temporality": 2, "is_monotonic": false}}, {"name": "gauge", "description": "", "unit": "", "data": {"data_points": [{"attributes": {}, "start_time_unix_nano": 0, "time_unix_nano": 1677187635593924000, "value": 9}]}}], "schema_url": ""}], "schema_url": ""}]}It's now:
{ "resource_metrics": [ { "resource": { "attributes": { "telemetry.sdk.language": "python", "telemetry.sdk.name": "opentelemetry", "telemetry.sdk.version": "1.17.0.dev0", "service.name": "unknown_service" }, "schema_url": "" }, "scope_metrics": [ { "scope": { "name": "getting-started", "version": "0.1.2", "schema_url": "" }, "metrics": [ { "name": "counter", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 1677187655866373000, "time_unix_nano": 1677187655866615000, "value": 1 } ], "aggregation_temporality": 2, "is_monotonic": true } }, { "name": "updown_counter", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 1677187655866404000, "time_unix_nano": 1677187655866615000, "value": -4 } ], "aggregation_temporality": 2, "is_monotonic": false } }, { "name": "histogram", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 1677187655866431000, "time_unix_nano": 1677187655866615000, "count": 1, "sum": 99.9, "bucket_counts": [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "explicit_bounds": [ 0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0 ], "min": 99.9, "max": 99.9 } ], "aggregation_temporality": 2 } }, { "name": "observable_counter", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 1677187655866561000, "time_unix_nano": 1677187655866615000, "value": 1 } ], "aggregation_temporality": 2, "is_monotonic": true } }, { "name": "observable_updown_counter", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 1677187655866578000, "time_unix_nano": 1677187655866615000, "value": -10 } ], "aggregation_temporality": 2, "is_monotonic": false } }, { "name": "gauge", "description": "", "unit": "", "data": { "data_points": [ { "attributes": {}, "start_time_unix_nano": 0, "time_unix_nano": 1677187655866615000, "value": 9 } ] } } ], "schema_url": "" } ], "schema_url": "" } ] }Does This PR Require a Contrib Repo Change?
Checklist: