Skip to content

Dependency issue on opentelemetry-exporter-gcp-monitoring #162

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

Closed
euri10 opened this issue Jul 29, 2021 · 12 comments
Closed

Dependency issue on opentelemetry-exporter-gcp-monitoring #162

euri10 opened this issue Jul 29, 2021 · 12 comments
Labels
bug Something isn't working metrics priority: p1

Comments

@euri10
Copy link
Contributor

euri10 commented Jul 29, 2021

I have this in myy pyproject.toml and I'd like to upgrade

opentelemetry-instrumentation-fastapi = "0.17b0"
opentelemetry-instrumentation-asyncpg = "0.17b0"
opentelemetry-exporter-google-cloud = "0.17b0"

So it seems like opentelemetry-exporter-google-cloud was split in several new packages.

So I :

  1. poetry remove opentelemetry-exporter-google-cloud opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-asyncpg
  2. then I poetry add opentelemetry-exporter-gcp-trace opentelemetry-exporter-gcp-monitoring which works fine.
  3. finally as soon as I try to add poetry add opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-asyncpg I face this error:
❯ poetry add opentelemetry-instrumentation-fastapi opentelemetry-instrumentation-asyncpg
Using version ^0.23b2 for opentelemetry-instrumentation-fastapi
Using version ^0.23b2 for opentelemetry-instrumentation-asyncpg

Updating dependencies
Resolving dependencies... (0.8s)

  SolverProblemError

  Because no versions of opentelemetry-instrumentation-asyncpg match >0.23b2,<0.24
   and opentelemetry-instrumentation-asyncpg (0.23b2) depends on opentelemetry-instrumentation (0.23b2), opentelemetry-instrumentation-asyncpg (>=0.23b2,<0.24) requires opentelemetry-instrumentation (0.23b2).
  And because opentelemetry-instrumentation (0.23b2) depends on opentelemetry-api (1.4.1), opentelemetry-instrumentation-asyncpg (>=0.23b2,<0.24) requires opentelemetry-api (1.4.1).
  And because opentelemetry-exporter-gcp-monitoring (1.0.0a0) depends on opentelemetry-api (>=1.10a0,<2.0.0)
   and no versions of opentelemetry-exporter-gcp-monitoring match >1.0.0-alpha.0,<2.0.0, opentelemetry-instrumentation-asyncpg (>=0.23b2,<0.24) is incompatible with opentelemetry-exporter-gcp-monitoring (>=1.0.0-alpha.0,<2.0.0).
  So, because sfjapi depends on both opentelemetry-exporter-gcp-monitoring (^1.0.0-alpha.0) and opentelemetry-instrumentation-asyncpg (^0.23b2), version solving failed.

so this is quite clear that this is because of opentelemetry-exporter-gcp-monitoring:

And because opentelemetry-exporter-gcp-monitoring (1.0.0a0) depends on opentelemetry-api (>=1.10a0,<2.0.0)

so i wonder if there is a typo in its setup here

and if one should make it coherent with the rest ie make it dependant to 1.0.0a0 vs 1.10a0 at present.

currently install opentelemetry-exporter-gcp-monitoring alongside any other package seems like impossible or I'm missing something ?

@aabmass
Copy link
Collaborator

aabmass commented Jul 29, 2021

You're right that the packages have been split up. Unfortunately, OTel metrics are still a work in progress, so they were not released along with the 1.0 API/SDK but moved into a separate branch and released as 1.10a0 several months back. And yes, it appears to currently be impossible to install that exporter still with any other packages, because opentelemetry-instrumentation is still pinning the API version (we fixed this for the individual instrumentation packages).

Thanks for pointing this out, I think this is a bug in the OTel packaging, I will bring it up with the Python group.

@aabmass
Copy link
Collaborator

aabmass commented Jul 29, 2021

I am curious though, have you written any custom metric instrumentation? It might be easiest to just remove this for now as the OTel metrics spec is getting mostly gutted right now.

@euri10
Copy link
Contributor Author

euri10 commented Jul 30, 2021

I am curious though, have you written any custom metric instrumentation? It might be easiest to just remove this for now as the OTel metrics spec is getting mostly gutted right now.

No I didn't write anything custom, relevant part of my current code using the "old" opentelemetry-exporter-google-cloud package that provides both metrics exporter and trace exporter is

    metrics.set_meter_provider(MeterProvider())
    meter = metrics.get_meter(__name__)
    metrics.get_meter_provider().start_pipeline(  # type: ignore[attr-defined]
        meter, CloudMonitoringMetricsExporter(), 5
    )
    requests_counter = meter.create_counter(
        name="429_counter",
        description="number of 429 requests",
        unit="1",
        value_type=int,
        enabled=True,
    )

.... blablabla ....

    if app_settings_loaded.tracing_enabled:
        trace.set_tracer_provider(TracerProvider())
        cloud_trace_exporter = CloudTraceSpanExporter(
            project_id="blablabla",
        )
        trace_provider: TracerProvider = trace.get_tracer_provider()  # type: ignore[assignment]
        trace_provider.add_span_processor(
            BatchExportSpanProcessor(cloud_trace_exporter)
        )
        FastAPIInstrumentor.instrument_app(app)
        AsyncPGInstrumentor().instrument()

@aabmass
Copy link
Collaborator

aabmass commented Aug 2, 2021

requests_counter = meter.create_counter(
    name="429_counter",
    description="number of 429 requests",
    unit="1",
    value_type=int,
    enabled=True,
)

This is what I meant by custom metric instrumentation. I have a fix upstream for your issue open-telemetry/opentelemetry-python#2012. Once that is released, you should be able to upgrade

@euri10
Copy link
Contributor Author

euri10 commented Aug 2, 2021

much appreciated @aabmass !

@punya
Copy link
Contributor

punya commented Sep 8, 2021

@aabmass and @euri10 , can this be closed out now?

@euri10
Copy link
Contributor Author

euri10 commented Oct 4, 2021

@aabmass and @euri10 , can this be closed out now?

I tried to install the same way as above and it's ok now.
BUT, when running my code, I now have the same issue as open-telemetry/opentelemetry-python#2137

@euri10
Copy link
Contributor Author

euri10 commented Oct 4, 2021

for reference the packages used:

opentelemetry-exporter-gcp-trace = "1.0.0"
opentelemetry-exporter-gcp-monitoring = "1.0.0-alpha.0"
opentelemetry-instrumentation-fastapi = "0.24b0"
opentelemetry-instrumentation-asyncpg = "0.24b0"

@aabmass
Copy link
Collaborator

aabmass commented Oct 4, 2021

The OTel python SIG is reworking metrics from scratch and I don't expect any more releases with metrics past the 1.10a version until we have a new working metrics prototype. If this is a big issue, I'd recommend creating an issue in the open-telemetry/opentelemetry-python repo to see if the old branch can be rebased and a release made.

@f0o
Copy link

f0o commented Oct 27, 2022

It's been a while.... Any update on this?

Right now it seems that you can only use opentelemetry for either metrics or tracing.

Judging how amazingly painful monitoring_v3 is it seems that python devs need to make a deal with the devil and neglect either metrics or tracing... Or is there some hackaround to get both working?

@aabmass aabmass added the bug Something isn't working label Nov 2, 2022
@aabmass
Copy link
Collaborator

aabmass commented Nov 4, 2022

I'm working on updating the Cloud Monitoring exporter to work with the stable metrics SDK. Hopefully should have something working in the next week or so.

@aabmass
Copy link
Collaborator

aabmass commented Nov 8, 2022

Fixed with #204. The trace and monitoring exporters both now have the same wide dependency range:

Hoping to release this soon!

@aabmass aabmass closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working metrics priority: p1
Projects
None yet
Development

No branches or pull requests

4 participants