Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Metrics API behind internal package #2651

Merged
merged 2 commits into from
Apr 29, 2022

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Apr 28, 2022

Description

Moves the Metrics API behind an internal package opentelemetry._metrics._internal. This will remain with the underscore once we make a stable release of metrics i.e. opentelemetry.metrics._internal. Finally, all of the public API is expose in opentelemetry._metrics package __init__.py file. This clearly shows what the public is.

Updated tests and documentation to build with these changes.

Fixes #2622

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tests passing, docs look good

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@aabmass aabmass force-pushed the aaron-api-private branch 3 times, most recently from cbc1b03 to 946c9b4 Compare April 28, 2022 21:00
@aabmass
Copy link
Member Author

aabmass commented Apr 28, 2022

I separated the move of opentelemetry/_metrics/__init__.py into a separate commit so you can review the commits separately it will make your life easier 2c1cb20

Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

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

LGTM

@ocelotl
Copy link
Contributor

ocelotl commented Apr 28, 2022

Looks good, I have only one comment, this approach puts all public metric symbols in opentelemetry._metrics, instead of separating them into modules like opentelemetry._metrics.instrument, opentelemetry._metrics.point and so on which is more consistent with what we currently have in tracing.

@lzchen WDYT?

@aabmass
Copy link
Member Author

aabmass commented Apr 28, 2022

opentelemetry._metrics.instrument, opentelemetry._metrics.point and so on which is more consistent with what we currently have in tracing.

I took a look at tracing API, we have most stuff directly in opentelemetry.trace like Span, Link, etc:

__all__ = [
"DEFAULT_TRACE_OPTIONS",
"DEFAULT_TRACE_STATE",
"INVALID_SPAN",
"INVALID_SPAN_CONTEXT",
"INVALID_SPAN_ID",
"INVALID_TRACE_ID",
"NonRecordingSpan",
"Link",
"Span",
"SpanContext",
"SpanKind",
"TraceFlags",
"TraceState",
"TracerProvider",
"Tracer",
"format_span_id",
"format_trace_id",
"get_current_span",
"get_tracer",
"get_tracer_provider",
"set_tracer_provider",
"set_span_in_context",
"use_span",
"Status",
"StatusCode",
]

Even some stuff from opentelemetry.trace.propagation subpackage, like get_current_span() is re-exposed in opentelemetry.trace package.

I think it's reasonable to separate them out more for the SDK e.g. we could have an opentelemetry.sdk.metrics.export package like in tracing. Up to you @ocelotl as you're working on that PR. Wdyt?

@ocelotl
Copy link
Contributor

ocelotl commented Apr 28, 2022

opentelemetry._metrics.instrument, opentelemetry._metrics.point and so on which is more consistent with what we currently have in tracing.

I took a look at tracing API, we have most stuff directly in opentelemetry.trace like Span, Link, etc:

__all__ = [
"DEFAULT_TRACE_OPTIONS",
"DEFAULT_TRACE_STATE",
"INVALID_SPAN",
"INVALID_SPAN_CONTEXT",
"INVALID_SPAN_ID",
"INVALID_TRACE_ID",
"NonRecordingSpan",
"Link",
"Span",
"SpanContext",
"SpanKind",
"TraceFlags",
"TraceState",
"TracerProvider",
"Tracer",
"format_span_id",
"format_trace_id",
"get_current_span",
"get_tracer",
"get_tracer_provider",
"set_tracer_provider",
"set_span_in_context",
"use_span",
"Status",
"StatusCode",
]

Even some stuff from opentelemetry.trace.propagation subpackage, like get_current_span() is re-exposed in opentelemetry.trace package.

I think it's reasonable to separate them out more for the SDK e.g. we could have an opentelemetry.sdk.metrics.export package like in tracing. Up to you @ocelotl as you're working on that PR. Wdyt?

All right, if in tracing we have everything in the base module, then this approach is consistent. I can work on the corresponding PR for the SDK and have some separation there, approving. 👍

@ocelotl ocelotl merged commit 2972ebc into open-telemetry:main Apr 29, 2022
@aabmass aabmass deleted the aaron-api-private branch April 29, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make necessary API metrics symbols private
3 participants