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

awsprometheusremotewrite: Add support for given IAM roles #2675

Merged
merged 7 commits into from
Mar 15, 2021

Conversation

bonclay7
Copy link
Contributor

Description:
Adding to the aws prometheus exporter the possibility to assume a role to unlock cross account scenarios

Link to tracking Issue: #2654

Testing:
Added some unit tests to cover the new parameter by running make
Ran the collector using make run with a config to test the changes

Config

receivers:
  prometheus:
    config:
      global:
        scrape_interval: 15s
        scrape_timeout: 10s
      scrape_configs:
      - job_name: "prometheus-demo-app"
        static_configs:
        - targets: [ 0.0.0.0:8888 ]

exporters:
  awsprometheusremotewrite:
    endpoint: https://aps-workspaces.eu-west-1.amazonaws.com/workspaces/<ws_id>/api/v1/remote_write
    aws_auth:
      region: eu-west-1
      service: "aps"
      role_arn: "arn:aws:iam::account:role/role_name"
  logging:
    loglevel: debug
extensions:
  health_check:
  pprof:
    endpoint: :1888
  zpages:
    endpoint: :55679

service:
  extensions: [pprof, zpages, health_check]
  pipelines:
    metrics:
      receivers: [prometheus]
      exporters: [logging, awsprometheusremotewrite]

With metrics successfully being sent to the destination

Documentation:
Configuration option

@bonclay7 bonclay7 requested a review from a team March 12, 2021 17:34
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 12, 2021

CLA Signed

The committers are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented Mar 12, 2021

Codecov Report

Merging #2675 (4644921) into main (7c28ef1) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2675      +/-   ##
==========================================
+ Coverage   91.40%   91.43%   +0.02%     
==========================================
  Files         435      435              
  Lines       21626    21630       +4     
==========================================
+ Hits        19768    19778      +10     
+ Misses       1391     1388       -3     
+ Partials      467      464       -3     
Flag Coverage Δ
integration 69.18% <ø> (ø)
unit 90.34% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
exporter/awsprometheusremotewriteexporter/auth.go 86.36% <100.00%> (+10.75%) ⬆️
...porter/awsprometheusremotewriteexporter/factory.go 100.00% <100.00%> (ø)
receiver/k8sclusterreceiver/watcher.go 97.64% <0.00%> (+2.35%) ⬆️

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 7c28ef1...4644921. Read the comment docs.

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Please be nice with codecov :)

@bonclay7
Copy link
Contributor Author

Hi @bogdandrutu, I've tried !

@bogdandrutu bogdandrutu merged commit fcbe766 into open-telemetry:main Mar 15, 2021
@bonclay7 bonclay7 deleted the aws-assume-role branch March 15, 2021 16:11
pmatyjasek-sumo referenced this pull request in pmatyjasek-sumo/opentelemetry-collector-contrib Apr 28, 2021
* Add role_arn as a config option

* Add tests for role_arn

* update doc for role_arn

* Fix tests

* Add tests for roles scenarios

* Modify AWS session authentication

* Update role session identifier
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.

3 participants